@@ -97,10 +97,15 @@ const UIStrings = {
9797 *@description Text in Application Panel Sidebar of the Application panel
9898 */
9999 backgroundServices : 'Background services' ,
100+ /**
101+ *@description Text in Background Service View of the Application panel.
102+ * An event here refers to a background service event that is an entry in a table.
103+ */
104+ noEventSelected : 'No event selected' ,
100105 /**
101106 *@description Text in Background Service View of the Application panel
102107 */
103- selectAnEntryToViewMetadata : 'Select an entry to view metadata' ,
108+ selectAnEventToViewMetadata : 'Select an event to view its metadata' ,
104109 /**
105110 *@description Text in Background Service View of the Application panel
106111 *@example {Background Fetch} PH1
@@ -226,6 +231,7 @@ export class BackgroundServiceView extends UI.Widget.VBox {
226231
227232 this . splitWidget . setMainWidget ( this . dataGrid . asWidget ( ) ) ;
228233 this . splitWidget . setSidebarWidget ( this . previewPanel ) ;
234+ this . splitWidget . hideMain ( ) ;
229235
230236 this . showPreview ( null ) ;
231237 }
@@ -288,6 +294,7 @@ export class BackgroundServiceView extends UI.Widget.VBox {
288294 private clearView ( ) : void {
289295 this . selectedEventNode = null ;
290296 this . dataGrid . rootNode ( ) . removeChildren ( ) ;
297+ this . splitWidget . hideMain ( ) ;
291298 this . saveButton . setEnabled ( false ) ;
292299 this . showPreview ( null ) ;
293300 }
@@ -356,6 +363,10 @@ export class BackgroundServiceView extends UI.Widget.VBox {
356363 const dataNode = new EventDataNode ( data , serviceEvent . eventMetadata ) ;
357364 this . dataGrid . rootNode ( ) . appendChild ( dataNode ) ;
358365
366+ if ( this . splitWidget . showMode ( ) !== UI . SplitWidget . ShowMode . BOTH ) {
367+ this . splitWidget . showBoth ( ) ;
368+ }
369+
359370 if ( this . dataGrid . rootNode ( ) . children . length === 1 ) {
360371 this . saveButton . setEnabled ( true ) ;
361372 this . showPreview ( this . selectedEventNode ) ;
@@ -471,37 +482,31 @@ export class BackgroundServiceView extends UI.Widget.VBox {
471482 return ;
472483 }
473484
474- this . preview = new UI . Widget . VBox ( ) ;
475- this . preview . contentElement . classList . add ( 'background-service-preview' , 'fill' ) ;
476- const centered = this . preview . contentElement . createChild ( 'div' ) ;
477-
485+ const emptyWidget = new UI . EmptyWidget . EmptyWidget ( '' , '' ) ;
478486 if ( this . dataGrid . rootNode ( ) . children . length ) {
479- // Inform users that grid entries are clickable.
480- centered . createChild ( 'p' ) . textContent = i18nString ( UIStrings . selectAnEntryToViewMetadata ) ;
487+ emptyWidget . header = i18nString ( UIStrings . noEventSelected ) ;
488+ emptyWidget . text = i18nString ( UIStrings . selectAnEventToViewMetadata ) ;
481489 } else if ( this . recordButton . isToggled ( ) ) {
482490 // Inform users that we are recording/waiting for events.
483491 const featureName = BackgroundServiceView . getUIString ( this . serviceName ) . toLowerCase ( ) ;
484- const emptyWidget = new UI . EmptyWidget . EmptyWidget (
485- i18nString ( UIStrings . recordingSActivity , { PH1 : featureName } ) ,
486- i18nString ( UIStrings . devtoolsWillRecordAllSActivity , { PH1 : featureName } ) ) ;
487- emptyWidget . show ( centered ) ;
492+ emptyWidget . header = i18nString ( UIStrings . recordingSActivity , { PH1 : featureName } ) ;
493+ emptyWidget . text = i18nString ( UIStrings . devtoolsWillRecordAllSActivity , { PH1 : featureName } ) ;
488494 } else {
489495 const recordShortcuts =
490496 UI . ShortcutRegistry . ShortcutRegistry . instance ( ) . shortcutsForAction ( 'background-service.toggle-recording' ) [ 0 ] ;
491- const emptyWidget = new UI . EmptyWidget . EmptyWidget (
492- i18nString ( UIStrings . noRecording ) ,
493- i18nString (
494- UIStrings . startRecordingToDebug ,
495- { PH1 : i18nString ( UIStrings . startRecordingEvents ) , PH2 : recordShortcuts . title ( ) } ) ) ;
497+ emptyWidget . header = i18nString ( UIStrings . noRecording ) ;
498+ emptyWidget . text = i18nString (
499+ UIStrings . startRecordingToDebug ,
500+ { PH1 : i18nString ( UIStrings . startRecordingEvents ) , PH2 : recordShortcuts . title ( ) } ) ;
496501 emptyWidget . appendLink ( this . createLearnMoreLink ( ) ) ;
497- emptyWidget . show ( centered ) ;
498502
499503 const button = UI . UIUtils . createTextButton (
500504 i18nString ( UIStrings . startRecordingEvents ) , ( ) => this . toggleRecording ( ) ,
501505 { jslogContext : 'start-recording' , variant : Buttons . Button . Variant . TONAL } ) ;
502506 emptyWidget . contentElement . appendChild ( button ) ;
503507 }
504508
509+ this . preview = emptyWidget ;
505510 this . preview . show ( this . previewPanel . contentElement ) ;
506511 }
507512
0 commit comments