blob: f86f3479c2fd28ab9ace0bce04a98520bb933278 [file] [log] [blame]
Tim van der Lippe67872d62021-11-30 14:00:171// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4import '../shell/shell.js';
Nancy Li1c659192022-09-16 09:19:305import '../../panels/mobile_throttling/mobile_throttling-meta.js';
Tim van der Lippe67872d62021-11-30 14:00:176import '../../panels/js_profiler/js_profiler-meta.js';
7import type * as Sources from '../../panels/sources/sources.js';
8import * as i18n from '../../core/i18n/i18n.js';
9import * as UI from '../../ui/legacy/legacy.js';
10import * as Common from '../../core/common/common.js';
11import * as Root from '../../core/root/root.js';
12import * as Main from '../main/main.js';
13
14import {NodeMainImpl} from './NodeMain.js'; // eslint-disable-line rulesdir/es_modules_import
15import {NodeConnectionsPanel} from './NodeConnectionsPanel.js'; // eslint-disable-line rulesdir/es_modules_import
16
17const UIStrings = {
18 /**
Jack Franklinfd72c072022-12-21 11:45:0119 *@description Text that refers to the network connection
20 */
Tim van der Lippe67872d62021-11-30 14:00:1721 connection: 'Connection',
22 /**
Jack Franklinfd72c072022-12-21 11:45:0123 *@description A tag of Node.js Connection Panel that can be searched in the command menu
24 */
Tim van der Lippe67872d62021-11-30 14:00:1725 node: 'node',
26 /**
27 *@description Command for showing the Connection tool
28 */
29 showConnection: 'Show Connection',
30 /**
31 *@description Title of the 'Node' tool in the Network Navigator View, which is part of the Sources tool
Jack Franklinfd72c072022-12-21 11:45:0132 */
Tim van der Lippe67872d62021-11-30 14:00:1733 networkTitle: 'Node',
34 /**
35 *@description Command for showing the 'Node' tool in the Network Navigator View, which is part of the Sources tool
Jack Franklinfd72c072022-12-21 11:45:0136 */
Andrés Olivares0650b4a2022-10-19 10:16:5937 showNode: 'Show Node',
Tim van der Lippe67872d62021-11-30 14:00:1738};
39
40const str_ = i18n.i18n.registerUIStrings('entrypoints/node_app/node_app.ts', UIStrings);
41const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
42
43let loadedSourcesModule: (typeof Sources|undefined);
44
45async function loadSourcesModule(): Promise<typeof Sources> {
46 if (!loadedSourcesModule) {
47 loadedSourcesModule = await import('../../panels/sources/sources.js');
48 }
49 return loadedSourcesModule;
50}
51
52UI.ViewManager.registerViewExtension({
53 location: UI.ViewManager.ViewLocationValues.PANEL,
54 id: 'node-connection',
55 title: i18nLazyString(UIStrings.connection),
56 commandPrompt: i18nLazyString(UIStrings.showConnection),
57 order: 0,
58 async loadView() {
59 return NodeConnectionsPanel.instance();
60 },
61 tags: [i18nLazyString(UIStrings.node)],
62});
63
64UI.ViewManager.registerViewExtension({
65 location: UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW,
66 id: 'navigator-network',
67 title: i18nLazyString(UIStrings.networkTitle),
68 commandPrompt: i18nLazyString(UIStrings.showNode),
69 order: 2,
70 persistence: UI.ViewManager.ViewPersistence.PERMANENT,
71 async loadView() {
72 const Sources = await loadSourcesModule();
73 return Sources.SourcesNavigator.NetworkNavigatorView.instance();
74 },
75});
76
Tim van der Lippe67872d62021-11-30 14:00:1777// @ts-ignore Exposed for legacy layout tests
Tim van der Lipped3b32d52021-12-02 12:55:5678self.runtime = Root.Runtime.Runtime.instance({forceNew: true});
Tim van der Lippe67872d62021-11-30 14:00:1779Common.Runnable.registerEarlyInitializationRunnable(NodeMainImpl.instance);
80new Main.MainImpl.MainImpl();