@@ -309,19 +309,15 @@ export class TimelineDetailsPane extends
309309 /**
310310 * Updates the UI shown in the Summary tab, and updates the UI to select the
311311 * summary tab.
312- * @param node this is passed as an additional piece of DOM that will be
313- * rendered in the summary view. This is a temporary ability to allow
314- * incremental migration to the UI Eng vision.
315312 */
316- private async updateSummaryAndSelectTab ( node : Node | null ) : Promise < void > {
313+ private async updateSummaryPane ( ) : Promise < void > {
317314 const allTabs = this . tabbedPane . otherTabs ( Tab . Details ) ;
318315 for ( let i = 0 ; i < allTabs . length ; ++ i ) {
319316 if ( ! this . rangeDetailViews . has ( allTabs [ i ] ) ) {
320317 this . tabbedPane . closeTab ( allTabs [ i ] ) ;
321318 }
322319 }
323320
324- this . #summaryContent. node = node ?? null ;
325321 this . #summaryContent. requestUpdate ( ) ;
326322 await this . #summaryContent. updateComplete ;
327323 }
@@ -365,7 +361,7 @@ export class TimelineDetailsPane extends
365361 */
366362 private scheduleUpdateContentsFromWindow ( forceImmediateUpdate = false ) : void {
367363 if ( ! this . #parsedTrace) {
368- void this . updateSummaryAndSelectTab ( null ) ;
364+ void this . updateSummaryPane ( ) ;
369365 return ;
370366 }
371367 if ( forceImmediateUpdate ) {
@@ -413,11 +409,12 @@ export class TimelineDetailsPane extends
413409 return ;
414410 }
415411
412+ this . #summaryContent. selectedRange = null ;
416413 this . #summaryContent. selectedEvent = event ;
417414 this . #summaryContent. eventToRelatedInsightsMap = this . #eventToRelatedInsightsMap;
418415 this . #summaryContent. linkifier = this . detailsLinkifier ;
419416 this . #summaryContent. target = targetForEvent ( this . #parsedTrace, event ) ;
420- await this . updateSummaryAndSelectTab ( null ) ;
417+ await this . updateSummaryPane ( ) ;
421418 this . appendExtraDetailsTabsForTraceEvent ( event ) ;
422419 }
423420
@@ -546,12 +543,13 @@ export class TimelineDetailsPane extends
546543 return ;
547544 }
548545
549- const minBoundsMilli = Trace . Helpers . Timing . traceWindowMilliSeconds ( this . #parsedTrace. Meta . traceBounds ) . min ;
550- const aggregatedStats = TimelineUIUtils . statsForTimeRange ( this . #selectedEvents, startTime , endTime ) ;
551- const startOffset = startTime - minBoundsMilli ;
552- const endOffset = endTime - minBoundsMilli ;
553- const summaryDetailElem = TimelineUIUtils . generateSummaryDetails (
554- aggregatedStats , startOffset , endOffset , this . #selectedEvents, this . #thirdPartyTree) ;
546+ this . #summaryContent. selectedEvent = null ;
547+ this . #summaryContent. selectedRange = {
548+ events : this . #selectedEvents,
549+ thirdPartyTree : this . #thirdPartyTree,
550+ startTime,
551+ endTime,
552+ } ;
555553
556554 // This is a bit of a hack as we are midway through migrating this to
557555 // the new UI Eng vision.
@@ -560,7 +558,7 @@ export class TimelineDetailsPane extends
560558 // (so the 3P Tree View is attached to the DOM) and then we tell it to
561559 // update.
562560 // This will be fixed once we migrate this component fully to the new vision (b/407751379)
563- void this . updateSummaryAndSelectTab ( summaryDetailElem ) . then ( ( ) => {
561+ void this . updateSummaryPane ( ) . then ( ( ) => {
564562 this . #thirdPartyTree. updateContents ( this . selection || selectionFromRangeMilliSeconds ( startTime , endTime ) ) ;
565563 } ) ;
566564
@@ -592,15 +590,14 @@ export enum Tab {
592590 /* eslint-enable @typescript-eslint/naming-convention */
593591}
594592
593+ interface SelectedRange {
594+ startTime : Trace . Types . Timing . Milli ;
595+ endTime : Trace . Types . Timing . Milli ;
596+ events : Trace . Types . Events . Event [ ] ;
597+ thirdPartyTree : ThirdPartyTreeViewWidget ;
598+ }
599+
595600interface SummaryViewInput {
596- // This is a helper to allow an incremental migration to the new UI Eng vision.
597- // Currently, this is used in two scenarios:
598- // 1. When the user selects a TimelineFrame (screenshot).
599- // 2. When no trace event is selected, and the user is looking at a range.
600- // Both of these scenarios need to be updated to use the new UI Eng Vision,
601- // and then we can remove the ability for this UI to take an arbitrary DOM
602- // Node to render.
603- node : Node | null ;
604601 selectedEvent : Trace . Types . Events . Event | null ;
605602 eventToRelatedInsightsMap : TimelineComponents . RelatedInsightChips . EventToRelatedInsightsMap | null ;
606603 parsedTrace : Trace . Handlers . Types . ParsedTrace | null ;
@@ -609,6 +606,7 @@ interface SummaryViewInput {
609606 target : SDK . Target . Target | null ;
610607 linkifier : Components . Linkifier . Linkifier | null ;
611608 filmStrip : Trace . Extras . FilmStrip . Data | null ;
609+ selectedRange : SelectedRange | null ;
612610}
613611
614612type View = ( input : SummaryViewInput , output : object , target : HTMLElement ) => void ;
@@ -617,8 +615,8 @@ const SUMMARY_DEFAULT_VIEW: View = (input, _output, target) => {
617615 render (
618616 html `
619617 < style > ${ detailsViewStyles } </ style >
620- ${ input . node ?? nothing }
621618 ${ Directives . until ( renderSelectedEventDetails ( input ) ) }
619+ ${ input . selectedRange ? generateRangeSummaryDetails ( input ) : nothing }
622620 < devtools-widget data-related-insight-chips .widgetConfig =${
623621 UI . Widget . widgetConfig ( TimelineComponents . RelatedInsightChips . RelatedInsightChips , {
624622 activeEvent : input . selectedEvent ,
@@ -631,7 +629,6 @@ const SUMMARY_DEFAULT_VIEW: View = (input, _output, target) => {
631629
632630class SummaryView extends UI . Widget . Widget {
633631 #view: View ;
634- node : Node | null = null ;
635632 selectedEvent : Trace . Types . Events . Event | null = null ;
636633 eventToRelatedInsightsMap : TimelineComponents . RelatedInsightChips . EventToRelatedInsightsMap | null = null ;
637634 parsedTrace : Trace . Handlers . Types . ParsedTrace | null = null ;
@@ -640,6 +637,7 @@ class SummaryView extends UI.Widget.Widget {
640637 target : SDK . Target . Target | null = null ;
641638 linkifier : Components . Linkifier . Linkifier | null = null ;
642639 filmStrip : Trace . Extras . FilmStrip . Data | null = null ;
640+ selectedRange : SelectedRange | null = null ;
643641
644642 constructor ( element ?: HTMLElement , view = SUMMARY_DEFAULT_VIEW ) {
645643 super ( element ) ;
@@ -649,20 +647,37 @@ class SummaryView extends UI.Widget.Widget {
649647 override performUpdate ( ) : void {
650648 this . #view(
651649 {
652- node : this . node ,
653650 selectedEvent : this . selectedEvent ,
654651 eventToRelatedInsightsMap : this . eventToRelatedInsightsMap ,
655652 parsedTrace : this . parsedTrace ,
656653 traceInsightsSets : this . traceInsightsSets ,
657654 entityMapper : this . entityMapper ,
658655 target : this . target ,
659656 linkifier : this . linkifier ,
660- filmStrip : this . filmStrip
657+ filmStrip : this . filmStrip ,
658+ selectedRange : this . selectedRange ,
661659 } ,
662660 { } , this . contentElement ) ;
663661 }
664662}
665663
664+ function generateRangeSummaryDetails ( input : SummaryViewInput ) : LitTemplate {
665+ const { parsedTrace, selectedRange} = input ;
666+
667+ if ( ! selectedRange || ! parsedTrace ) {
668+ return nothing ;
669+ }
670+
671+ const minBoundsMilli = Trace . Helpers . Timing . microToMilli ( parsedTrace . Meta . traceBounds . min ) ;
672+ const { events, startTime, endTime, thirdPartyTree} = selectedRange ;
673+ const aggregatedStats = TimelineUIUtils . statsForTimeRange ( events , startTime , endTime ) ;
674+ const startOffset = startTime - minBoundsMilli ;
675+ const endOffset = endTime - minBoundsMilli ;
676+ const summaryDetailElem =
677+ TimelineUIUtils . generateSummaryDetails ( aggregatedStats , startOffset , endOffset , events , thirdPartyTree ) ;
678+ return html `${ summaryDetailElem } ` ;
679+ }
680+
666681async function renderSelectedEventDetails (
667682 input : SummaryViewInput ,
668683 ) : Promise < LitTemplate > {
0 commit comments