Skip to content

Commit b5a7775

Browse files
Adriana IxbaDevtools-frontend LUCI CQ
authored andcommitted
[RPP] Open the summary tab when selecting the 3p insight
This also limits the 3p insight to show only the top 3 entities Bug:394651390 Change-Id: I768d1f6b8b20179d1e29caf4a8603c3bf4966991 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6253619 Reviewed-by: Adam Raine <[email protected]> Commit-Queue: Adriana Ixba <[email protected]> Auto-Submit: Adriana Ixba <[email protected]>
1 parent d36860c commit b5a7775

22 files changed

+168
-65
lines changed

front_end/models/trace/insights/CLSCulprits.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import * as Types from '../types/types.js';
1010

1111
import {
1212
InsightCategory,
13+
InsightKeys,
1314
type InsightModel,
1415
type InsightSetContext,
1516
type PartialInsightModel,
16-
type RequiredData
17+
type RequiredData,
1718
} from './types.js';
1819

1920
export const UIStrings = {
@@ -523,7 +524,7 @@ function finalize(partialModel: PartialInsightModel<CLSCulpritsInsightModel>): C
523524
partialModel.worstCluster ? partialModel.topCulpritsByCluster.get(partialModel.worstCluster) ?? [] : [];
524525

525526
return {
526-
insightKey: 'CLSCulprits',
527+
insightKey: InsightKeys.CLS_CULPRITS,
527528
strings: UIStrings,
528529
title: i18nString(UIStrings.title),
529530
description: i18nString(UIStrings.description),

front_end/models/trace/insights/Common.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ import type * as Lantern from '../lantern/lantern.js';
88
import * as Types from '../types/types.js';
99

1010
import {getLogNormalScore} from './Statistics.js';
11-
import type {InsightModels, InsightSet, InsightSetContext, MetricSavings, TraceInsightSets} from './types.js';
11+
import {
12+
InsightKeys,
13+
type InsightModels,
14+
type InsightSet,
15+
type InsightSetContext,
16+
type MetricSavings,
17+
type TraceInsightSets
18+
} from './types.js';
1219

1320
const GRAPH_SAVINGS_PRECISION = 50;
1421

@@ -34,7 +41,7 @@ export function getInsight<InsightName extends keyof InsightModels>(
3441

3542
export function getLCP(insights: TraceInsightSets|null, key: string|null):
3643
{value: Types.Timing.Micro, event: Types.Events.LargestContentfulPaintCandidate}|null {
37-
const insight = getInsight('LCPPhases', insights, key);
44+
const insight = getInsight(InsightKeys.LCP_PHASES, insights, key);
3845
if (!insight || !insight.lcpMs || !insight.lcpEvent) {
3946
return null;
4047
}
@@ -45,7 +52,7 @@ export function getLCP(insights: TraceInsightSets|null, key: string|null):
4552

4653
export function getINP(insights: TraceInsightSets|null, key: string|null):
4754
{value: Types.Timing.Micro, event: Types.Events.SyntheticInteractionPair}|null {
48-
const insight = getInsight('InteractionToNextPaint', insights, key);
55+
const insight = getInsight(InsightKeys.INTERACTION_TO_NEXT_PAINT, insights, key);
4956
if (!insight?.longestInteractionEvent?.dur) {
5057
return null;
5158
}
@@ -56,7 +63,7 @@ export function getINP(insights: TraceInsightSets|null, key: string|null):
5663

5764
export function getCLS(
5865
insights: TraceInsightSets|null, key: string|null): {value: number, worstClusterEvent: Types.Events.Event|null} {
59-
const insight = getInsight('CLSCulprits', insights, key);
66+
const insight = getInsight(InsightKeys.CLS_CULPRITS, insights, key);
6067
if (!insight) {
6168
// Unlike the other metrics, there is always a value for CLS even with no data.
6269
return {value: 0, worstClusterEvent: null};

front_end/models/trace/insights/DOMSize.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as Types from '../types/types.js';
99

1010
import {
1111
InsightCategory,
12+
InsightKeys,
1213
type InsightModel,
1314
type InsightSetContext,
1415
type PartialInsightModel,
@@ -75,7 +76,7 @@ export function deps(): ['Renderer', 'AuctionWorklets', 'DOMStats'] {
7576
function finalize(partialModel: PartialInsightModel<DOMSizeInsightModel>): DOMSizeInsightModel {
7677
const relatedEvents = [...partialModel.largeLayoutUpdates, ...partialModel.largeStyleRecalcs];
7778
return {
78-
insightKey: 'DOMSize',
79+
insightKey: InsightKeys.DOM_SIZE,
7980
strings: UIStrings,
8081
title: i18nString(UIStrings.title),
8182
description: i18nString(UIStrings.description),

front_end/models/trace/insights/DocumentLatency.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as Types from '../types/types.js';
99
import {
1010
type Checklist,
1111
InsightCategory,
12+
InsightKeys,
1213
type InsightModel,
1314
type InsightSetContext,
1415
InsightWarning,
@@ -171,7 +172,7 @@ function finalize(partialModel: PartialInsightModel<DocumentLatencyInsightModel>
171172
}
172173

173174
return {
174-
insightKey: 'DocumentLatency',
175+
insightKey: InsightKeys.DOCUMENT_LATENCY,
175176
strings: UIStrings,
176177
title: i18nString(UIStrings.title),
177178
description: i18nString(UIStrings.description),

front_end/models/trace/insights/DuplicateJavaScript.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as Helpers from '../helpers/helpers.js';
88

99
import {
1010
InsightCategory,
11+
InsightKeys,
1112
type InsightModel,
1213
type InsightSetContext,
1314
type PartialInsightModel,
@@ -39,7 +40,7 @@ export function deps(): ['Scripts', 'NetworkRequests'] {
3940

4041
function finalize(partialModel: PartialInsightModel<DuplicateJavaScriptInsightModel>): DuplicateJavaScriptInsightModel {
4142
return {
42-
insightKey: 'DuplicateJavaScript',
43+
insightKey: InsightKeys.DUPLICATE_JAVASCRIPT,
4344
strings: UIStrings,
4445
title: i18nString(UIStrings.title),
4546
description: i18nString(UIStrings.description),

front_end/models/trace/insights/FontDisplay.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as Types from '../types/types.js';
99

1010
import {
1111
InsightCategory,
12+
InsightKeys,
1213
type InsightModel,
1314
type InsightSetContext,
1415
type PartialInsightModel,
@@ -46,7 +47,7 @@ export type FontDisplayInsightModel = InsightModel<typeof UIStrings, {
4647

4748
function finalize(partialModel: PartialInsightModel<FontDisplayInsightModel>): FontDisplayInsightModel {
4849
return {
49-
insightKey: 'FontDisplay',
50+
insightKey: InsightKeys.FONT_DISPLAY,
5051
strings: UIStrings,
5152
title: i18nString(UIStrings.title),
5253
description: i18nString(UIStrings.description),

front_end/models/trace/insights/ForcedReflow.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
type BottomUpCallStack,
1313
type ForcedReflowAggregatedData,
1414
InsightCategory,
15+
InsightKeys,
1516
type InsightModel,
1617
type PartialInsightModel,
1718
type RequiredData,
@@ -190,7 +191,7 @@ function aggregateForcedReflow(
190191

191192
function finalize(partialModel: PartialInsightModel<ForcedReflowInsightModel>): ForcedReflowInsightModel {
192193
return {
193-
insightKey: 'ForcedReflow',
194+
insightKey: InsightKeys.FORCED_REFLOW,
194195
strings: UIStrings,
195196
title: i18nString(UIStrings.title),
196197
description: i18nString(UIStrings.description),

front_end/models/trace/insights/ImageDelivery.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type * as Types from '../types/types.js';
99
import {metricSavingsForWastedBytes} from './Common.js';
1010
import {
1111
InsightCategory,
12+
InsightKeys,
1213
type InsightModel,
1314
type InsightSetContext,
1415
type PartialInsightModel,
@@ -158,7 +159,7 @@ export function getOptimizationMessageWithBytes(optimization: ImageOptimization)
158159

159160
function finalize(partialModel: PartialInsightModel<ImageDeliveryInsightModel>): ImageDeliveryInsightModel {
160161
return {
161-
insightKey: 'ImageDelivery',
162+
insightKey: InsightKeys.IMAGE_DELIVERY,
162163
strings: UIStrings,
163164
title: i18nString(UIStrings.title),
164165
description: i18nString(UIStrings.description),

front_end/models/trace/insights/InteractionToNextPaint.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import type {SyntheticInteractionPair} from '../types/TraceEvents.js';
88

99
import {
1010
InsightCategory,
11+
InsightKeys,
1112
type InsightModel,
1213
type InsightSetContext,
1314
type PartialInsightModel,
14-
type RequiredData
15+
type RequiredData,
1516
} from './types.js';
1617

1718
export const UIStrings = {
@@ -66,7 +67,7 @@ export type INPInsightModel = InsightModel<typeof UIStrings, {
6667

6768
function finalize(partialModel: PartialInsightModel<INPInsightModel>): INPInsightModel {
6869
return {
69-
insightKey: 'InteractionToNextPaint',
70+
insightKey: InsightKeys.INTERACTION_TO_NEXT_PAINT,
7071
strings: UIStrings,
7172
title: i18nString(UIStrings.title),
7273
description: i18nString(UIStrings.description),

front_end/models/trace/insights/LCPDiscovery.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as Types from '../types/types.js';
1010
import {
1111
type Checklist,
1212
InsightCategory,
13+
InsightKeys,
1314
type InsightModel,
1415
type InsightSetContext,
1516
InsightWarning,
@@ -79,7 +80,7 @@ function finalize(partialModel: PartialInsightModel<LCPDiscoveryInsightModel>):
7980
[partialModel.lcpEvent, partialModel.lcpRequest] :
8081
[];
8182
return {
82-
insightKey: 'LCPDiscovery',
83+
insightKey: InsightKeys.LCP_DISCOVERY,
8384
strings: UIStrings,
8485
title: i18nString(UIStrings.title),
8586
description: i18nString(UIStrings.description),

0 commit comments

Comments
 (0)