From 338ba2d5f0d69f7fd2a76d73ccbf3faa4c5fe6d8 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Thu, 20 Jun 2019 22:16:28 -0700 Subject: [PATCH 1/6] move contextual help to the help menu --- packages/help-extension/package.json | 1 + packages/help-extension/src/index.tsx | 15 ++++++++++----- packages/mainmenu-extension/package.json | 1 - packages/mainmenu-extension/src/index.ts | 11 +++-------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/help-extension/package.json b/packages/help-extension/package.json index e4477dd2b168..bd11c83b042f 100644 --- a/packages/help-extension/package.json +++ b/packages/help-extension/package.json @@ -39,6 +39,7 @@ "@jupyterlab/application": "^1.0.0-alpha.13", "@jupyterlab/apputils": "^1.0.0-alpha.13", "@jupyterlab/coreutils": "^3.0.0-alpha.13", + "@jupyterlab/inspector": "^1.0.0-alpha.13", "@jupyterlab/mainmenu": "^1.0.0-alpha.13", "@jupyterlab/services": "^4.0.0-alpha.13", "@phosphor/widgets": "^1.8.0", diff --git a/packages/help-extension/src/index.tsx b/packages/help-extension/src/index.tsx index 0ef77c534d1c..56856d292590 100644 --- a/packages/help-extension/src/index.tsx +++ b/packages/help-extension/src/index.tsx @@ -18,6 +18,8 @@ import { import { PageConfig, URLExt } from '@jupyterlab/coreutils'; +import { IInspector } from '@jupyterlab/inspector'; + import { IMainMenu } from '@jupyterlab/mainmenu'; import { KernelMessage } from '@jupyterlab/services'; @@ -89,7 +91,7 @@ const plugin: JupyterFrontEndPlugin = { activate, id: '@jupyterlab/help-extension:plugin', requires: [IMainMenu], - optional: [ICommandPalette, ILayoutRestorer], + optional: [ICommandPalette, ILayoutRestorer, IInspector], autoStart: true }; @@ -109,7 +111,8 @@ function activate( app: JupyterFrontEnd, mainMenu: IMainMenu, palette: ICommandPalette | null, - restorer: ILayoutRestorer | null + restorer: ILayoutRestorer | null, + inspector: IInspector | null ): void { let counter = 0; const category = 'Help'; @@ -153,9 +156,11 @@ function activate( // Populate the Help menu. const helpMenu = mainMenu.helpMenu; - const labGroup = [CommandIDs.about, CommandIDs.launchClassic].map( - command => ({ command }) - ); + const labGroup = [ + CommandIDs.about, + inspector ? 'inspector:open' : null, + CommandIDs.launchClassic + ].map(command => ({ command })); helpMenu.addGroup(labGroup, 0); const resourcesGroup = RESOURCES.map(args => ({ args, diff --git a/packages/mainmenu-extension/package.json b/packages/mainmenu-extension/package.json index 080740ba9884..003d47c15258 100644 --- a/packages/mainmenu-extension/package.json +++ b/packages/mainmenu-extension/package.json @@ -39,7 +39,6 @@ "@jupyterlab/application": "^1.0.0-alpha.13", "@jupyterlab/apputils": "^1.0.0-alpha.13", "@jupyterlab/coreutils": "^3.0.0-alpha.13", - "@jupyterlab/inspector": "^1.0.0-alpha.13", "@jupyterlab/mainmenu": "^1.0.0-alpha.13", "@jupyterlab/services": "^4.0.0-alpha.13", "@phosphor/algorithm": "^1.1.3", diff --git a/packages/mainmenu-extension/src/index.ts b/packages/mainmenu-extension/src/index.ts index 53e634d8a136..f50ba5060534 100644 --- a/packages/mainmenu-extension/src/index.ts +++ b/packages/mainmenu-extension/src/index.ts @@ -18,8 +18,6 @@ import { ICommandPalette, showDialog, Dialog } from '@jupyterlab/apputils'; import { PageConfig, URLExt } from '@jupyterlab/coreutils'; -import { IInspector } from '@jupyterlab/inspector'; - import { IMainMenu, IMenuExtender, @@ -117,13 +115,12 @@ export namespace CommandIDs { const plugin: JupyterFrontEndPlugin = { id: '@jupyterlab/mainmenu-extension:plugin', requires: [ICommandPalette, IRouter], - optional: [IInspector, ILabShell], + optional: [ILabShell], provides: IMainMenu, activate: ( app: JupyterFrontEnd, palette: ICommandPalette, router: IRouter, - inspector: IInspector | null, labShell: ILabShell | null ): IMainMenu => { const { commands } = app; @@ -142,7 +139,7 @@ const plugin: JupyterFrontEndPlugin = { // Create the application menus. createEditMenu(app, menu.editMenu); - createFileMenu(app, menu.fileMenu, router, inspector); + createFileMenu(app, menu.fileMenu, router); createKernelMenu(app, menu.kernelMenu); createRunMenu(app, menu.runMenu); createSettingsMenu(app, menu.settingsMenu); @@ -293,7 +290,6 @@ export function createFileMenu( app: JupyterFrontEnd, menu: FileMenu, router: IRouter, - inspector: IInspector | null ): void { const commands = menu.menu.commands; @@ -413,8 +409,7 @@ export function createFileMenu( const newViewGroup = [ { command: 'docmanager:clone' }, - { command: CommandIDs.createConsole }, - inspector ? { command: 'inspector:open' } : null + { command: CommandIDs.createConsole } ].filter(item => !!item); // Add the close group From 4e135cb9227c37357e1eb97353dad4673c0b08d9 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Fri, 21 Jun 2019 11:44:24 -0700 Subject: [PATCH 2/6] Contextual help in its own menu group --- packages/help-extension/src/index.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/help-extension/src/index.tsx b/packages/help-extension/src/index.tsx index 56856d292590..9c3f1d0dcd8d 100644 --- a/packages/help-extension/src/index.tsx +++ b/packages/help-extension/src/index.tsx @@ -156,12 +156,17 @@ function activate( // Populate the Help menu. const helpMenu = mainMenu.helpMenu; - const labGroup = [ - CommandIDs.about, - inspector ? 'inspector:open' : null, - CommandIDs.launchClassic - ].map(command => ({ command })); + const labGroup = [CommandIDs.about, CommandIDs.launchClassic].map( + command => ({ command }) + ); helpMenu.addGroup(labGroup, 0); + + // Contextual help in its own group + const contextualHelpGroup = [inspector ? 'inspector:open' : null].map( + command => ({ command }) + ); + helpMenu.addGroup(contextualHelpGroup, 0); + const resourcesGroup = RESOURCES.map(args => ({ args, command: CommandIDs.open From 5936a19783ecac67731d489f393b96b2ebc49f44 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Fri, 21 Jun 2019 11:53:38 -0700 Subject: [PATCH 3/6] remove 'Open ' from contextual help label --- packages/inspector-extension/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/inspector-extension/src/index.ts b/packages/inspector-extension/src/index.ts index 0e1e6580ca47..710004481e4f 100644 --- a/packages/inspector-extension/src/index.ts +++ b/packages/inspector-extension/src/index.ts @@ -50,7 +50,7 @@ const inspector: JupyterFrontEndPlugin = { ): IInspector => { const { commands, shell } = app; const command = CommandIDs.open; - const label = 'Open Contextual Help'; + const label = 'Contextual Help'; const title = 'Contextual Help'; const namespace = 'inspector'; const tracker = new WidgetTracker>({ From d0a976f079e2d915e099bba6af9efbf1606a6d74 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Fri, 21 Jun 2019 12:24:09 -0700 Subject: [PATCH 4/6] consolidate title and label to label --- packages/inspector-extension/src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/inspector-extension/src/index.ts b/packages/inspector-extension/src/index.ts index 710004481e4f..e6f8ad8b19c4 100644 --- a/packages/inspector-extension/src/index.ts +++ b/packages/inspector-extension/src/index.ts @@ -51,7 +51,6 @@ const inspector: JupyterFrontEndPlugin = { const { commands, shell } = app; const command = CommandIDs.open; const label = 'Contextual Help'; - const title = 'Contextual Help'; const namespace = 'inspector'; const tracker = new WidgetTracker>({ namespace @@ -63,7 +62,7 @@ const inspector: JupyterFrontEndPlugin = { if (!inspector || inspector.isDisposed) { inspector = new MainAreaWidget({ content: new InspectorPanel() }); inspector.id = 'jp-inspector'; - inspector.title.label = title; + inspector.title.label = label; void tracker.add(inspector); source = source && !source.isDisposed ? source : null; inspector.content.source = source; @@ -83,7 +82,7 @@ const inspector: JupyterFrontEndPlugin = { inspector.isDisposed || !inspector.isAttached || !inspector.isVisible, - label: args => (args.isLauncher ? title : label), + label: label; iconClass: args => args.isLauncher ? 'jp-MaterialIcon jp-InspectorIcon' : '', execute: () => openInspector() @@ -91,7 +90,7 @@ const inspector: JupyterFrontEndPlugin = { // Add command to UI where possible. if (palette) { - palette.addItem({ command, category: title }); + palette.addItem({ command, category: label }); } if (launcher) { launcher.add({ command, args: { isLauncher: true } }); From 1d41402a1612b7b13265a6bae98b9e80e460171b Mon Sep 17 00:00:00 2001 From: Ian Rose Date: Fri, 21 Jun 2019 14:36:48 -0700 Subject: [PATCH 5/6] Make compile. --- packages/help-extension/style/index.css | 1 + packages/help-extension/tsconfig.json | 3 +++ packages/inspector-extension/src/index.ts | 2 +- packages/mainmenu-extension/tsconfig.json | 3 --- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/help-extension/style/index.css b/packages/help-extension/style/index.css index a192a3c9ab39..c065903f0e3f 100644 --- a/packages/help-extension/style/index.css +++ b/packages/help-extension/style/index.css @@ -6,6 +6,7 @@ /* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */ @import url('~@phosphor/widgets/style/index.css'); @import url('~@jupyterlab/apputils/style/index.css'); +@import url('~@jupyterlab/inspector/style/index.css'); @import url('~@jupyterlab/mainmenu/style/index.css'); @import url('./base.css'); diff --git a/packages/help-extension/tsconfig.json b/packages/help-extension/tsconfig.json index df557cb832f7..12ac1909a5d9 100644 --- a/packages/help-extension/tsconfig.json +++ b/packages/help-extension/tsconfig.json @@ -15,6 +15,9 @@ { "path": "../coreutils" }, + { + "path": "../inspector" + }, { "path": "../mainmenu" }, diff --git a/packages/inspector-extension/src/index.ts b/packages/inspector-extension/src/index.ts index e6f8ad8b19c4..b51647214e7b 100644 --- a/packages/inspector-extension/src/index.ts +++ b/packages/inspector-extension/src/index.ts @@ -82,7 +82,7 @@ const inspector: JupyterFrontEndPlugin = { inspector.isDisposed || !inspector.isAttached || !inspector.isVisible, - label: label; + label, iconClass: args => args.isLauncher ? 'jp-MaterialIcon jp-InspectorIcon' : '', execute: () => openInspector() diff --git a/packages/mainmenu-extension/tsconfig.json b/packages/mainmenu-extension/tsconfig.json index 12ac1909a5d9..df557cb832f7 100644 --- a/packages/mainmenu-extension/tsconfig.json +++ b/packages/mainmenu-extension/tsconfig.json @@ -15,9 +15,6 @@ { "path": "../coreutils" }, - { - "path": "../inspector" - }, { "path": "../mainmenu" }, From e9dbacc6912f79ffdb0c28512010107ac43245fb Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Fri, 21 Jun 2019 14:54:41 -0700 Subject: [PATCH 6/6] fix lint errors --- packages/mainmenu-extension/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mainmenu-extension/src/index.ts b/packages/mainmenu-extension/src/index.ts index f50ba5060534..883911a8055a 100644 --- a/packages/mainmenu-extension/src/index.ts +++ b/packages/mainmenu-extension/src/index.ts @@ -289,7 +289,7 @@ export function createEditMenu(app: JupyterFrontEnd, menu: EditMenu): void { export function createFileMenu( app: JupyterFrontEnd, menu: FileMenu, - router: IRouter, + router: IRouter ): void { const commands = menu.menu.commands;