Skip to content

Commit 2bff7c0

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
RPP: add insightKey to each insight
This allows you to easily, for a given Insight model's data when you don't know the Insight, determine it. Bug: 394552594 Change-Id: Ib1ddb829fd129b1516ce1900cc334922ca64984a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6276165 Commit-Queue: Alina Varkki <[email protected]> Auto-Submit: Jack Franklin <[email protected]> Reviewed-by: Alina Varkki <[email protected]>
1 parent 9ff546b commit 2bff7c0

17 files changed

+24
-1
lines changed

front_end/models/trace/insights/CLSCulprits.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ function finalize(partialModel: PartialInsightModel<CLSCulpritsInsightModel>): C
523523
partialModel.worstCluster ? partialModel.topCulpritsByCluster.get(partialModel.worstCluster) ?? [] : [];
524524

525525
return {
526+
insightKey: 'CLSCulprits',
526527
strings: UIStrings,
527528
title: i18nString(UIStrings.title),
528529
description: i18nString(UIStrings.description),

front_end/models/trace/insights/DOMSize.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export function deps(): ['Renderer', 'AuctionWorklets', 'DOMStats'] {
7575
function finalize(partialModel: PartialInsightModel<DOMSizeInsightModel>): DOMSizeInsightModel {
7676
const relatedEvents = [...partialModel.largeLayoutUpdates, ...partialModel.largeStyleRecalcs];
7777
return {
78+
insightKey: 'DOMSize',
7879
strings: UIStrings,
7980
title: i18nString(UIStrings.title),
8081
description: i18nString(UIStrings.description),

front_end/models/trace/insights/DocumentLatency.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ function finalize(partialModel: PartialInsightModel<DocumentLatencyInsightModel>
171171
}
172172

173173
return {
174+
insightKey: 'DocumentLatency',
174175
strings: UIStrings,
175176
title: i18nString(UIStrings.title),
176177
description: i18nString(UIStrings.description),

front_end/models/trace/insights/DuplicateJavaScript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export function deps(): ['Scripts', 'NetworkRequests'] {
3939

4040
function finalize(partialModel: PartialInsightModel<DuplicateJavaScriptInsightModel>): DuplicateJavaScriptInsightModel {
4141
return {
42+
insightKey: 'DuplicateJavaScript',
4243
strings: UIStrings,
4344
title: i18nString(UIStrings.title),
4445
description: i18nString(UIStrings.description),

front_end/models/trace/insights/FontDisplay.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export type FontDisplayInsightModel = InsightModel<typeof UIStrings, {
4646

4747
function finalize(partialModel: PartialInsightModel<FontDisplayInsightModel>): FontDisplayInsightModel {
4848
return {
49+
insightKey: 'FontDisplay',
4950
strings: UIStrings,
5051
title: i18nString(UIStrings.title),
5152
description: i18nString(UIStrings.description),

front_end/models/trace/insights/ForcedReflow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ function aggregateForcedReflow(
190190

191191
function finalize(partialModel: PartialInsightModel<ForcedReflowInsightModel>): ForcedReflowInsightModel {
192192
return {
193+
insightKey: 'ForcedReflow',
193194
strings: UIStrings,
194195
title: i18nString(UIStrings.title),
195196
description: i18nString(UIStrings.description),

front_end/models/trace/insights/ImageDelivery.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export function getOptimizationMessageWithBytes(optimization: ImageOptimization)
158158

159159
function finalize(partialModel: PartialInsightModel<ImageDeliveryInsightModel>): ImageDeliveryInsightModel {
160160
return {
161+
insightKey: 'ImageDelivery',
161162
strings: UIStrings,
162163
title: i18nString(UIStrings.title),
163164
description: i18nString(UIStrings.description),

front_end/models/trace/insights/InteractionToNextPaint.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export type INPInsightModel = InsightModel<typeof UIStrings, {
6666

6767
function finalize(partialModel: PartialInsightModel<INPInsightModel>): INPInsightModel {
6868
return {
69+
insightKey: 'InteractionToNextPaint',
6970
strings: UIStrings,
7071
title: i18nString(UIStrings.title),
7172
description: i18nString(UIStrings.description),

front_end/models/trace/insights/LCPDiscovery.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function finalize(partialModel: PartialInsightModel<LCPDiscoveryInsightModel>):
7979
[partialModel.lcpEvent, partialModel.lcpRequest] :
8080
[];
8181
return {
82+
insightKey: 'LCPDiscovery',
8283
strings: UIStrings,
8384
title: i18nString(UIStrings.title),
8485
description: i18nString(UIStrings.description),

front_end/models/trace/insights/LCPPhases.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ export type LCPPhasesInsightModel = InsightModel<typeof UIStrings, {
9393
lcpRequest?: Types.Events.SyntheticNetworkRequest,
9494
phases?: LCPPhases,
9595
}>;
96+
export function isLCPPhases(model: InsightModel<{}, {}>): model is LCPPhasesInsightModel {
97+
return model.title === UIStrings.title;
98+
}
9699

97100
function anyValuesNaN(...values: number[]): boolean {
98101
return values.some(v => Number.isNaN(v));
@@ -154,6 +157,7 @@ function finalize(partialModel: PartialInsightModel<LCPPhasesInsightModel>): LCP
154157
relatedEvents.push(partialModel.lcpRequest);
155158
}
156159
return {
160+
insightKey: 'LCPPhases',
157161
strings: UIStrings,
158162
title: i18nString(UIStrings.title),
159163
description: i18nString(UIStrings.description),

0 commit comments

Comments
 (0)