[module.json extensions] help views

Bug: 1134103
Change-Id: I797fc82b277511f0aa11cb365c7dfd0f933b4ef4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2629728
Commit-Queue: Andres Olivares <andoli@chromium.org>
Auto-Submit: Andres Olivares <andoli@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
This commit is contained in:
Andres Olivares
2021-01-18 20:31:36 +00:00
committed by Commit Bot
parent 4ce36a5a37
commit f2a99e868d
10 changed files with 65 additions and 16 deletions
+1
View File
@@ -238,6 +238,7 @@ grd_files_release_sources = [
"front_end/heap_snapshot_worker/heap_snapshot_worker-legacy.js",
"front_end/heap_snapshot_worker/heap_snapshot_worker.js",
"front_end/help/help-legacy.js",
"front_end/help/help-meta.js",
"front_end/help/help.js",
"front_end/help/help_module.js",
"front_end/host/host-legacy.js",
+1
View File
@@ -74,6 +74,7 @@ devtools_module_entrypoint_sources = [
"heap_snapshot_worker/heap_snapshot_worker-legacy.js",
"heap_snapshot_worker/heap_snapshot_worker.js",
"help/help-legacy.js",
"help/help-meta.js",
"help/help.js",
"host/host-legacy.js",
"host/host.js",
+1
View File
@@ -54,6 +54,7 @@ group("front_end") {
"heap_snapshot_model:bundle",
"heap_snapshot_worker:worker_entrypoint",
"help:bundle",
"help:meta",
"i18n:bundle",
"inline_editor:bundle",
"input:bundle",
+1
View File
@@ -14,6 +14,7 @@ import './developer_resources/developer_resources-meta.js';
import './inspector_main/inspector_main-meta.js';
import './resources/resources-meta.js';
import './issues/issues-meta.js';
import './help/help-meta.js';
import * as Startup from './startup/startup.js';
Startup.RuntimeInstantiator.startApplication('devtools_app');
+6
View File
@@ -36,3 +36,9 @@ devtools_entrypoint("legacy") {
deps = [ ":bundle" ]
}
devtools_entrypoint("meta") {
entrypoint = "help-meta.ts"
deps = [ ":bundle" ]
}
-4
View File
@@ -6,10 +6,6 @@
import * as i18n from '../i18n/i18n.js';
export const UIStrings = {
/**
*@description Title of the 'What's New' tool in the bottom drawer
*/
whatsNew: 'What\'s New',
/**
*@description Text for DevTools appearance
*/
+9
View File
@@ -27,6 +27,7 @@ export const UIStrings = {
};
const str_ = i18n.i18n.registerUIStrings('help/ReleaseNoteView.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
let releaseNoteViewInstance: ReleaseNoteView;
export class ReleaseNoteView extends UI.Widget.VBox {
_releaseNoteElement: Element;
@@ -39,6 +40,14 @@ export class ReleaseNoteView extends UI.Widget.VBox {
this.contentElement.appendChild(this._releaseNoteElement);
}
static instance(opts: {forceNew: boolean|null;} = {forceNew: null}): ReleaseNoteView {
const {forceNew} = opts;
if (!releaseNoteViewInstance || forceNew) {
releaseNoteViewInstance = new ReleaseNoteView();
}
return releaseNoteViewInstance;
}
elementsToRestoreScrollPositionsFor(): Element[] {
return [this._releaseNoteElement];
}
+43
View File
@@ -0,0 +1,43 @@
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as i18n from '../i18n/i18n.js';
import * as Root from '../root/root.js';
import * as UI from '../ui/ui.js';
// eslint-disable-next-line rulesdir/es_modules_import
import type * as Help from './help.js';
export const UIStrings = {
/**
*@description Title of the 'What's New' tool in the bottom drawer
*/
whatsNew: 'What\'s New',
};
const str_ = i18n.i18n.registerUIStrings('help/help-meta.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
let loadedHelpModule: (typeof Help|undefined);
async function loadHelpModule(): Promise<typeof Help> {
if (!loadedHelpModule) {
// Side-effect import resources in module.json
await Root.Runtime.Runtime.instance().loadModulePromise('help');
loadedHelpModule = await import('./help.js');
}
return loadedHelpModule;
}
UI.ViewManager.registerViewExtension({
location: UI.ViewManager.ViewLocationValues.DRAWER_VIEW,
id: 'release-note',
title: () => i18nString(UIStrings.whatsNew),
commandPrompt: 'Show What\'s New',
persistence: UI.ViewManager.ViewPersistence.CLOSEABLE,
order: 1,
async loadView() {
const Help = await loadHelpModule();
return Help.ReleaseNoteView.ReleaseNoteView.instance();
},
});
-9
View File
@@ -1,14 +1,5 @@
{
"extensions": [
{
"type": "view",
"location": "drawer-view",
"id": "release-note",
"title": "What's New",
"persistence": "closeable",
"order": 1,
"className": "Help.ReleaseNoteView"
},
{
"type": "setting",
"category": "Appearance",
+3 -3
View File
@@ -398,6 +398,9 @@
"event_listeners/EventListenersView.ts | toggleWhetherEventListenerIs": {
"message": "Toggle whether event listener is passive or blocking"
},
"help/help-meta.ts | whatsNew": {
"message": "What's New"
},
"help/ModuleUIStrings.ts | appearance": {
"message": "Appearance"
},
@@ -419,9 +422,6 @@
"help/ModuleUIStrings.ts | showWhatsNewAfterEachUpdate": {
"message": "Show What's New after each update"
},
"help/ModuleUIStrings.ts | whatsNew": {
"message": "What's New"
},
"help/ReleaseNoteView.ts | close": {
"message": "Close"
},