Skip to content

Commit 971865f

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored andcommitted
Use <devtools-new-data-grid> in WebBundleInfoView.
Bug: 390346490 Change-Id: Ie32bd92e44ed51e8c3d95fddd4f127cab3b4da96 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6187104 Reviewed-by: Wolfgang Beyer <[email protected]> Auto-Submit: Danil Somsikov <[email protected]> Commit-Queue: Danil Somsikov <[email protected]>
1 parent b001870 commit 971865f

File tree

3 files changed

+35
-46
lines changed

3 files changed

+35
-46
lines changed

front_end/panels/network/components/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ devtools_module("components") {
5252
"../../../ui/components/legacy_wrapper:bundle",
5353
"../../../ui/components/report_view:bundle",
5454
"../../../ui/legacy:bundle",
55+
"../../../ui/legacy/components/data_grid:bundle",
5556
"../../../ui/lit-html:bundle",
5657
"../forward:bundle",
5758
]

front_end/panels/network/components/WebBundleInfoView.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
*/
66
:host {
77
--icon-padding: 4px;
8+
9+
display: flex;
10+
flex-direction: column;
11+
height: 100%;
812
}
913

1014
.header {
@@ -17,3 +21,7 @@
1721
.icon {
1822
margin: 0 var(--icon-padding);
1923
}
24+
25+
devtools-new-data-grid {
26+
height: 100%;
27+
}

front_end/panels/network/components/WebBundleInfoView.ts

Lines changed: 26 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import '../../../ui/components/data_grid/data_grid.js';
5+
import '../../../ui/legacy/components/data_grid/data_grid.js';
66
import '../../../ui/components/icon_button/icon_button.js';
77

88
import * as Common from '../../../core/common/common.js';
99
import * as i18n from '../../../core/i18n/i18n.js';
1010
import type * as SDK from '../../../core/sdk/sdk.js';
1111
import {PanelUtils} from '../../../panels/utils/utils.js';
12-
import type * as DataGrid from '../../../ui/components/data_grid/data_grid.js';
1312
import type * as IconButton from '../../../ui/components/icon_button/icon_button.js';
1413
import * as LegacyWrapper from '../../../ui/components/legacy_wrapper/legacy_wrapper.js';
1514
import * as LitHtml from '../../../ui/lit-html/lit-html.js';
@@ -18,6 +17,10 @@ import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
1817
import webBundleInfoViewStyles from './WebBundleInfoView.css.js';
1918

2019
const {render, html} = LitHtml;
20+
const {mimeFromURL, fromMimeTypeOverride, fromMimeType} = Common.ResourceType.ResourceType;
21+
const {iconDataForResourceType} = PanelUtils;
22+
23+
type IconData = IconButton.Icon.IconData;
2124

2225
const UIStrings = {
2326
/**
@@ -49,63 +52,40 @@ export class WebBundleInfoView extends LegacyWrapper.LegacyWrapper.WrappableComp
4952
}
5053

5154
override async render(): Promise<void> {
52-
const rows = this.#webBundleInfo.resourceUrls?.map(url => {
53-
const mimeType = Common.ResourceType.ResourceType.mimeFromURL(url) || null;
54-
const resourceType = Common.ResourceType.ResourceType.fromMimeTypeOverride(mimeType) ||
55-
Common.ResourceType.ResourceType.fromMimeType(mimeType);
56-
const iconData = PanelUtils.iconDataForResourceType(resourceType);
57-
return {
58-
cells: [
59-
{
60-
columnId: 'url',
61-
value: null,
62-
renderer(): LitHtml.TemplateResult {
63-
return html`
64-
<div style="display: flex;">
65-
<devtools-icon class="icon"
66-
.data=${{...iconData, width: '20px'} as IconButton.Icon.IconData}>
67-
</devtools-icon>
68-
<span>${url}</span>
69-
</div>`;
70-
},
71-
},
72-
],
73-
};
74-
});
75-
render(
76-
html`
55+
// clang-format off
56+
render(html`
7757
<div class="header">
7858
<devtools-icon class="icon"
79-
.data=${{color: 'var(--icon-default)', iconName: 'bundle', width: '20px'} as IconButton.Icon.IconData}>
59+
.data=${{color: 'var(--icon-default)', iconName: 'bundle', width: '20px'} as IconData}>
8060
</devtools-icon>
8161
<span>${this.#webBundleName}</span>
8262
<x-link href="https://web.dev/web-bundles/#explaining-web-bundles"
8363
jslog=${VisualLogging.link('webbundle-explainer').track({
8464
click: true,
8565
})}>
8666
<devtools-icon class="icon"
87-
.data=${{color: 'var(--icon-default)', iconName: 'help', width: '16px'} as IconButton.Icon.IconData}>
67+
.data=${{color: 'var(--icon-default)', iconName: 'help', width: '16px'} as IconData}>
8868
</devtools-icon>
8969
</x-link>
9070
</div>
91-
<div>
92-
<devtools-data-grid
93-
.data=${{
94-
columns: [
95-
{
96-
id: 'url',
97-
title: i18nString(UIStrings.bundledResource),
98-
widthWeighting: 1,
99-
visible: true,
100-
hideable: false,
101-
},
102-
],
103-
rows,
104-
activeSort: null,
105-
} as DataGrid.DataGrid.DataGridData}>
106-
</devtools-data-grid>
107-
</div>`,
71+
<devtools-new-data-grid>
72+
<table>
73+
<tr><th id="url">${i18nString(UIStrings.bundledResource)}</th></tr>
74+
${this.#webBundleInfo.resourceUrls?.map(url => {
75+
const mimeType = mimeFromURL(url) || null;
76+
const resourceType = fromMimeTypeOverride(mimeType) || fromMimeType(mimeType);
77+
const iconData = iconDataForResourceType(resourceType);
78+
return html`<tr><td>
79+
<div style="display: flex;">
80+
<devtools-icon class="icon" .data=${{...iconData, width: '20px'} as IconData}>
81+
</devtools-icon>
82+
<span>${url}</span>
83+
</div></td></tr>`;
84+
})}
85+
</table>
86+
</devtools-new-data-grid>`,
10887
this.#shadow, {host: this});
88+
// clang-format on
10989
}
11090
}
11191

0 commit comments

Comments
 (0)