44
55import * as Common from '../../core/common/common.js' ;
66import * as i18n from '../../core/i18n/i18n.js' ;
7+ import type * as Platform from '../../core/platform/platform.js' ;
78import * as UI from '../../ui/legacy/legacy.js' ;
89import * as VisualLogging from '../../ui/visual_logging/visual_logging.js' ;
910
@@ -16,23 +17,32 @@ const UIStrings = {
1617 * Inspection hereby refers to viewing, navigating and understanding the memory through this tool.
1718 */
1819 noOpenInspections : 'No open inspections' ,
20+ /**
21+ *@description Label in the Linear Memory inspector tool that serves as a placeholder if no inspections are open (i.e. nothing to see here).
22+ * Inspection hereby refers to viewing, navigating and understanding the memory through this tool.
23+ */
24+ memoryInspectorExplanation : 'On this page you can inspect binary data.' ,
25+ /**
26+ *@description Label in the Linear Memory inspector tool for a link.
27+ */
28+ learnMore : 'Learn more' ,
1929} ;
2030const str_ = i18n . i18n . registerUIStrings ( 'panels/linear_memory_inspector/LinearMemoryInspectorPane.ts' , UIStrings ) ;
2131const i18nString = i18n . i18n . getLocalizedString . bind ( undefined , str_ ) ;
2232let inspectorInstance : LinearMemoryInspectorPane ;
2333
34+ const MEMORY_INSPECTOR_EXPLANATION_URL =
35+ 'https://developer.chrome.com/docs/devtools/memory-inspector' as Platform . DevToolsPath . UrlString ;
36+
2437export class LinearMemoryInspectorPane extends Common . ObjectWrapper . eventMixin < EventTypes , typeof UI . Widget . VBox > (
2538 UI . Widget . VBox ) {
2639 readonly #tabbedPane: UI . TabbedPane . TabbedPane ;
2740
2841 constructor ( ) {
2942 super ( false ) ;
3043 this . element . setAttribute ( 'jslog' , `${ VisualLogging . panel ( 'linear-memory-inspector' ) . track ( { resize : true } ) } ` ) ;
31- const placeholder = document . createElement ( 'div' ) ;
32- placeholder . textContent = i18nString ( UIStrings . noOpenInspections ) ;
33- placeholder . style . display = 'flex' ;
3444 this . #tabbedPane = new UI . TabbedPane . TabbedPane ( ) ;
35- this . #tabbedPane. setPlaceholderElement ( placeholder ) ;
45+ this . #tabbedPane. setPlaceholderElement ( this . createPlaceholder ( ) ) ;
3646 this . #tabbedPane. setCloseableTabs ( true ) ;
3747 this . #tabbedPane. setAllowTabReorder ( true , true ) ;
3848 this . #tabbedPane. addEventListener ( UI . TabbedPane . Events . TabClosed , this . #tabClosed, this ) ;
@@ -41,6 +51,21 @@ export class LinearMemoryInspectorPane extends Common.ObjectWrapper.eventMixin<E
4151 'jslog' , `${ VisualLogging . toolbar ( ) . track ( { keydown : 'ArrowUp|ArrowLeft|ArrowDown|ArrowRight|Enter|Space' } ) } ` ) ;
4252 }
4353
54+ createPlaceholder ( ) : HTMLElement {
55+ const placeholder = document . createElement ( 'div' ) ;
56+ placeholder . classList . add ( 'empty-state' ) ;
57+
58+ placeholder . createChild ( 'span' , 'empty-state-header' ) . textContent = i18nString ( UIStrings . noOpenInspections ) ;
59+
60+ const description = placeholder . createChild ( 'div' , 'empty-state-description' ) ;
61+ description . createChild ( 'span' ) . textContent = i18nString ( UIStrings . memoryInspectorExplanation ) ;
62+ const link = UI . XLink . XLink . create (
63+ MEMORY_INSPECTOR_EXPLANATION_URL , i18nString ( UIStrings . learnMore ) , undefined , undefined , 'learn-more' ) ;
64+ description . appendChild ( link ) ;
65+
66+ return placeholder ;
67+ }
68+
4469 static instance ( ) : LinearMemoryInspectorPane {
4570 if ( ! inspectorInstance ) {
4671 inspectorInstance = new LinearMemoryInspectorPane ( ) ;
0 commit comments