Skip to content

Commit 162ed1f

Browse files
Connor ClarkDevtools-frontend LUCI CQ
authored andcommitted
[RPP] Tweak column for DuplicatedJavaScript; styling for sub-items
https://i.imgur.com/CJJu8Ok.png Bug: 394373632 Change-Id: I5e74ff18b8797ea48f2aecc0c2ffbd97e39c47ea Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6393949 Commit-Queue: Connor Clark <[email protected]> Reviewed-by: Paul Irish <[email protected]> Commit-Queue: Paul Irish <[email protected]> Auto-Submit: Connor Clark <[email protected]>
1 parent bc49007 commit 162ed1f

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

front_end/models/trace/insights/DuplicatedJavaScript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export const UIStrings = {
2727
'Remove large, duplicate JavaScript modules from bundles to reduce unnecessary bytes consumed by network activity.',
2828
/** Label for a column in a data table; entries will be the locations of JavaScript or CSS code, e.g. the name of a Javascript package or module. */
2929
columnSource: 'Source',
30-
/** Label for a column in a data table; entries will be the file size of a web resource in kilobytes. */
31-
columnResourceSize: 'Resource size',
30+
/** Label for a column in a data table; entries will be the number of wasted bytes due to duplication of a web resource. */
31+
columnDuplicatedBytes: 'Duplicated bytes',
3232
} as const;
3333

3434
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/DuplicatedJavaScript.ts', UIStrings);

front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class DuplicatedJavaScript extends BaseInsightComponent<DuplicateJavaScri
5656
return {
5757
values: [source, i18n.ByteUtilities.bytesToString(data.estimatedDuplicateBytes)],
5858
overlays: [...scriptToOverlay.values()],
59-
subRows: data.duplicates.map(({script, attributedSize: resourceSize}) => {
59+
subRows: data.duplicates.map(({script, attributedSize: resourceSize}, index) => {
6060
let overlays: Overlays.Overlays.TimelineOverlay[]|undefined;
6161
const overlay = scriptToOverlay.get(script);
6262
if (overlay) {
@@ -66,7 +66,7 @@ export class DuplicatedJavaScript extends BaseInsightComponent<DuplicateJavaScri
6666
return {
6767
values: [
6868
script.request ? eventRef(script.request) : script.url ?? 'unknown',
69-
i18n.ByteUtilities.bytesToString(resourceSize),
69+
index === 0 ? '--' : i18n.ByteUtilities.bytesToString(resourceSize),
7070
],
7171
overlays,
7272
};
@@ -80,7 +80,7 @@ export class DuplicatedJavaScript extends BaseInsightComponent<DuplicateJavaScri
8080
<devtools-performance-table
8181
.data=${{
8282
insight: this,
83-
headers: [i18nString(UIStrings.columnSource), i18nString(UIStrings.columnResourceSize)],
83+
headers: [i18nString(UIStrings.columnSource), i18nString(UIStrings.columnDuplicatedBytes)],
8484
rows,
8585
} as TableData}>
8686
</devtools-performance-table>

front_end/panels/timeline/components/insights/Table.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,16 @@ export class Table extends HTMLElement {
223223
const flattenedRows: TableDataRow[] = [];
224224
const rowEls: Lit.TemplateResult[] = [];
225225
function traverse(row: TableDataRow, depth = 0): void {
226-
const styles = Lit.Directives.styleMap({
226+
const thStyles = Lit.Directives.styleMap({
227227
paddingLeft: `calc(${depth} * var(--sys-size-5))`,
228228
borderLeft: depth ? 'var(--sys-size-1) solid var(--sys-color-divider)' : '',
229229
});
230+
const trStyles = Lit.Directives.styleMap({
231+
color: depth ? 'var(--sys-color-on-surface-subtle)' : '',
232+
});
230233
const columnEls = row.values.map(
231-
(value, i) => i === 0 ? html`<th scope="row" style=${styles}>${value}</th>` : html`<td>${value}</td>`);
232-
rowEls.push(html`<tr>${columnEls}</tr>`);
234+
(value, i) => i === 0 ? html`<th scope="row" style=${thStyles}>${value}</th>` : html`<td>${value}</td>`);
235+
rowEls.push(html`<tr style=${trStyles}>${columnEls}</tr>`);
233236

234237
flattenedRows.push(row);
235238

0 commit comments

Comments
 (0)