@@ -10,6 +10,7 @@ import * as Platform from '../../core/platform/platform.js';
1010import * as SDK from '../../core/sdk/sdk.js' ;
1111import * as Protocol from '../../generated/protocol.js' ;
1212import * as Bindings from '../../models/bindings/bindings.js' ;
13+ import * as Buttons from '../../ui/components/buttons/buttons.js' ;
1314import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js' ;
1415// eslint-disable-next-line rulesdir/es-modules-import
1516import emptyWidgetStyles from '../../ui/legacy/emptyWidget.css.js' ;
@@ -96,10 +97,6 @@ const UIStrings = {
9697 *@description Text in Application Panel Sidebar of the Application panel
9798 */
9899 backgroundServices : 'Background services' ,
99- /**
100- *@description Text that is usually a hyperlink to more documentation
101- */
102- learnMore : 'Learn more' ,
103100 /**
104101 *@description Text in Background Service View of the Application panel
105102 */
@@ -109,17 +106,23 @@ const UIStrings = {
109106 *@example {Background Fetch} PH1
110107 */
111108 recordingSActivity : 'Recording {PH1} activity...' ,
109+ /**
110+ *@description Text in Background Service View of the Application panel
111+ */
112+ noRecording : 'No recording yet' ,
112113 /**
113114 *@description Inform users that DevTools are recording/waiting for events in the Periodic Background Sync tool of the Application panel
114115 *@example {Background Fetch} PH1
115116 */
116117 devtoolsWillRecordAllSActivity : 'DevTools will record all {PH1} activity for up to 3 days, even when closed.' ,
117118 /**
118- *@description Text in Background Service View of the Application panel
119- *@example {record} PH1
120- *@example {Ctrl + R} PH2
119+ *@description Text in Background Service View of the Application panel to instruct the user on how to start a recording for
120+ * background services.
121+ *
122+ *@example {Start recording events} PH1
123+ *@example {Ctrl + E} PH2
121124 */
122- clickTheRecordButtonSOrHitSTo : 'Click the record button {PH1} or hit {PH2} to start recording .' ,
125+ startRecordingToDebug : 'Start to debug background services by using the " {PH1}" button or by hitting {PH2}.' ,
123126 /**
124127 *@description Text to show an item is empty
125128 */
@@ -429,7 +432,7 @@ export class BackgroundServiceView extends UI.Widget.VBox {
429432 this . storageKeyManager . storageKeys ( ) . includes ( storageKey ) ;
430433 }
431434
432- private createLearnMoreLink ( ) : Element {
435+ private createLearnMoreLink ( ) : Platform . DevToolsPath . UrlString {
433436 let url = 'https://developer.chrome.com/docs/devtools/javascript/background-services/?utm_source=devtools' ;
434437
435438 switch ( this . serviceName ) {
@@ -449,7 +452,7 @@ export class BackgroundServiceView extends UI.Widget.VBox {
449452 break ;
450453 }
451454
452- return UI . XLink . XLink . create ( url , i18nString ( UIStrings . learnMore ) , undefined , undefined , 'learn-more' ) ;
455+ return url as Platform . DevToolsPath . UrlString ;
453456 }
454457
455458 private showPreview ( dataNode : EventDataNode | null ) : void {
@@ -479,23 +482,25 @@ export class BackgroundServiceView extends UI.Widget.VBox {
479482 } else if ( this . recordButton . isToggled ( ) ) {
480483 // Inform users that we are recording/waiting for events.
481484 const featureName = BackgroundServiceView . getUIString ( this . serviceName ) . toLowerCase ( ) ;
482- centered . createChild ( 'p' ) . textContent = i18nString ( UIStrings . recordingSActivity , { PH1 : featureName } ) ;
483- centered . createChild ( 'p' ) . textContent = i18nString ( UIStrings . devtoolsWillRecordAllSActivity , { PH1 : featureName } ) ;
485+ const emptyWidget = new UI . EmptyWidget . EmptyWidget (
486+ i18nString ( UIStrings . recordingSActivity , { PH1 : featureName } ) ,
487+ i18nString ( UIStrings . devtoolsWillRecordAllSActivity , { PH1 : featureName } ) ) ;
488+ emptyWidget . show ( centered ) ;
484489 } else {
485- const landingRecordButton = UI . Toolbar . Toolbar . createActionButton ( this . recordAction ) ;
486-
487- const recordKey = document . createElement ( 'b' ) ;
488- recordKey . classList . add ( 'background-service-shortcut' ) ;
489- recordKey . textContent = UI . ShortcutRegistry . ShortcutRegistry . instance ( )
490- . shortcutsForAction ( 'background-service.toggle-recording' ) [ 0 ]
491- . title ( ) ;
492-
493- const inlineButton = UI . UIUtils . createInlineButton ( landingRecordButton ) ;
494- inlineButton . classList . add ( 'background-service-record-inline-button' ) ;
495- centered . createChild ( 'p' ) . appendChild ( i18n . i18n . getFormatLocalizedString (
496- str_ , UIStrings . clickTheRecordButtonSOrHitSTo , { PH1 : inlineButton , PH2 : recordKey } ) ) ;
497-
498- centered . appendChild ( this . createLearnMoreLink ( ) ) ;
490+ const recordShortcuts =
491+ UI . ShortcutRegistry . ShortcutRegistry . instance ( ) . shortcutsForAction ( 'background-service.toggle-recording' ) [ 0 ] ;
492+ const emptyWidget = new UI . EmptyWidget . EmptyWidget (
493+ i18nString ( UIStrings . noRecording ) ,
494+ i18nString (
495+ UIStrings . startRecordingToDebug ,
496+ { PH1 : i18nString ( UIStrings . startRecordingEvents ) , PH2 : recordShortcuts . title ( ) } ) ) ;
497+ emptyWidget . appendLink ( this . createLearnMoreLink ( ) ) ;
498+ emptyWidget . show ( centered ) ;
499+
500+ const button = UI . UIUtils . createTextButton (
501+ i18nString ( UIStrings . startRecordingEvents ) , ( ) => this . toggleRecording ( ) ,
502+ { jslogContext : 'start-recording' , variant : Buttons . Button . Variant . PRIMARY } ) ;
503+ emptyWidget . contentElement . appendChild ( button ) ;
499504 }
500505
501506 this . preview . show ( this . previewPanel . contentElement ) ;
0 commit comments