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' ;
66import '../../../ui/components/icon_button/icon_button.js' ;
77
88import * as Common from '../../../core/common/common.js' ;
99import * as i18n from '../../../core/i18n/i18n.js' ;
1010import type * as SDK from '../../../core/sdk/sdk.js' ;
1111import { PanelUtils } from '../../../panels/utils/utils.js' ;
12- import type * as DataGrid from '../../../ui/components/data_grid/data_grid.js' ;
1312import type * as IconButton from '../../../ui/components/icon_button/icon_button.js' ;
1413import * as LegacyWrapper from '../../../ui/components/legacy_wrapper/legacy_wrapper.js' ;
1514import * as LitHtml from '../../../ui/lit-html/lit-html.js' ;
@@ -18,6 +17,10 @@ import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
1817import webBundleInfoViewStyles from './WebBundleInfoView.css.js' ;
1918
2019const { render, html} = LitHtml ;
20+ const { mimeFromURL, fromMimeTypeOverride, fromMimeType} = Common . ResourceType . ResourceType ;
21+ const { iconDataForResourceType} = PanelUtils ;
22+
23+ type IconData = IconButton . Icon . IconData ;
2124
2225const 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