Skip to content

Commit a519142

Browse files
Connor ClarkDevtools-frontend LUCI CQ
authored andcommitted
[RPP] Use correct label for field metrics in insight sidebar
Bug: 368135130 Change-Id: I37c22d8a7626918cf6e7573c97ac6a9283bc2421 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6202364 Reviewed-by: Adam Raine <[email protected]> Commit-Queue: Connor Clark <[email protected]>
1 parent f9b094a commit a519142

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

front_end/panels/timeline/components/SidebarSingleInsightSet.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ const UIStrings = {
3838
* @example {4} PH1
3939
*/
4040
passedInsights: 'Passed insights ({PH1})',
41+
/**
42+
* @description Label denoting that metrics were observed in the field, from real use data (CrUX). Also denotes if from URL or Origin dataset.
43+
* @example {URL} PH1
44+
*/
45+
fieldScoreLabel: 'Field ({PH1})',
46+
/**
47+
* @description Label for an option that selects the page's specific URL as opposed to it's entire origin/domain.
48+
*/
49+
urlOption: 'URL',
50+
/**
51+
* @description Label for an option that selects the page's entire origin/domain as opposed to it's specific URL.
52+
*/
53+
originOption: 'Origin',
4154
/**
4255
* @description Title for button that closes a warning popup.
4356
*/
@@ -282,15 +295,22 @@ export class SidebarSingleInsightSet extends HTMLElement {
282295
const inpEl = this.#renderMetricValue('INP', inp?.value ?? null, null);
283296
const clsEl = this.#renderMetricValue('CLS', cls?.value ?? null, null);
284297

298+
let scope = i18nString(UIStrings.originOption);
299+
if (lcp?.pageScope === 'url' || inp?.pageScope === 'url') {
300+
scope = i18nString(UIStrings.urlOption);
301+
}
302+
303+
// clang-format off
285304
fieldMetricsTemplateResult = html`
286305
<div class="metrics-row">
287306
<span>${lcpEl}</span>
288307
<span>${inpEl}</span>
289308
<span>${clsEl}</span>
290-
<span class="row-label">Field (Origin)</span>
309+
<span class="row-label">${i18nString(UIStrings.fieldScoreLabel, {PH1: scope})}</span>
291310
</div>
292311
<span class="row-border"></span>
293312
`;
313+
// clang-format on
294314
}
295315

296316
const localValues = {

front_end/panels/timeline/overlays/OverlaysImpl.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ const UIStrings = {
2424
* @example {URL} PH2
2525
*/
2626
fieldMetricMarkerField: '{PH1} - Field ({PH2})',
27+
/**
28+
* @description Label for an option that selects the page's specific URL as opposed to it's entire origin/domain.
29+
*/
30+
urlOption: 'URL',
31+
/**
32+
* @description Label for an option that selects the page's entire origin/domain as opposed to it's specific URL.
33+
*/
34+
originOption: 'Origin',
2735
};
2836
const str_ = i18n.i18n.registerUIStrings('panels/timeline/overlays/OverlaysImpl.ts', UIStrings);
2937
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -1595,9 +1603,9 @@ export class Overlays extends EventTarget {
15951603
i18n.TimeUtilities.formatMicroSecondsTime(fieldResult.value);
15961604
let scope: string = fieldResult.pageScope;
15971605
if (fieldResult.pageScope === 'url') {
1598-
scope = 'URL';
1606+
scope = i18nString(UIStrings.urlOption);
15991607
} else if (fieldResult.pageScope === 'origin') {
1600-
scope = 'Origin';
1608+
scope = i18nString(UIStrings.originOption);
16011609
}
16021610
popoverContents.createChild('span', 'overlay-popover-title').textContent =
16031611
i18nString(UIStrings.fieldMetricMarkerField, {

0 commit comments

Comments
 (0)