mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-01 12:56:54 +08:00
Add commands to open tree and running
This commit is contained in:
parent
0fcce28d16
commit
d1e0510777
@ -44,19 +44,17 @@ namespace CommandIDs {
|
||||
* Toggle the Zen mode
|
||||
*/
|
||||
export const toggleZen = 'application:toggle-zen';
|
||||
}
|
||||
|
||||
/**
|
||||
* A plugin to dispose the Tabs menu
|
||||
*/
|
||||
const noTabsMenu: JupyterFrontEndPlugin<void> = {
|
||||
id: '@jupyterlab-classic/application-extension:no-tabs-menu',
|
||||
requires: [IMainMenu],
|
||||
autoStart: true,
|
||||
activate: (app: JupyterFrontEnd, menu: IMainMenu) => {
|
||||
menu.tabsMenu.dispose();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Open the tree page.
|
||||
*/
|
||||
export const openTree = 'application:open-tree';
|
||||
|
||||
/**
|
||||
* Open the runnning page.
|
||||
*/
|
||||
export const openRunning = 'application:open-running';
|
||||
}
|
||||
|
||||
/**
|
||||
* The logo plugin.
|
||||
@ -83,6 +81,60 @@ const logo: JupyterFrontEndPlugin<void> = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A plugin to dispose the Tabs menu
|
||||
*/
|
||||
const noTabsMenu: JupyterFrontEndPlugin<void> = {
|
||||
id: '@jupyterlab-classic/application-extension:no-tabs-menu',
|
||||
requires: [IMainMenu],
|
||||
autoStart: true,
|
||||
activate: (app: JupyterFrontEnd, menu: IMainMenu) => {
|
||||
menu.tabsMenu.dispose();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Add commands to open the tree and running pages.
|
||||
*/
|
||||
const pages: JupyterFrontEndPlugin<void> = {
|
||||
id: '@jupyterlab-classic/application-extension:pages',
|
||||
autoStart: true,
|
||||
optional: [ICommandPalette, IMainMenu],
|
||||
activate: (
|
||||
app: JupyterFrontEnd,
|
||||
palette: ICommandPalette,
|
||||
menu: IMainMenu
|
||||
): void => {
|
||||
const baseUrl = PageConfig.getBaseUrl();
|
||||
|
||||
app.commands.addCommand(CommandIDs.openTree, {
|
||||
label: 'Open the File Browser',
|
||||
execute: (args: any) => {
|
||||
window.open(`${baseUrl}classic/tree`);
|
||||
}
|
||||
});
|
||||
|
||||
app.commands.addCommand(CommandIDs.openRunning, {
|
||||
label: 'Open the Running Sessions',
|
||||
execute: (args: any) => {
|
||||
window.open(`${baseUrl}classic/running`);
|
||||
}
|
||||
});
|
||||
|
||||
if (palette) {
|
||||
palette.addItem({ command: CommandIDs.openTree, category: 'View' });
|
||||
palette.addItem({ command: CommandIDs.openRunning, category: 'View' });
|
||||
}
|
||||
|
||||
if (menu) {
|
||||
menu.viewMenu.addGroup(
|
||||
[{ command: CommandIDs.openTree }, { command: CommandIDs.openRunning }],
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The default paths for a JupyterLab Classic app.
|
||||
*/
|
||||
@ -275,6 +327,7 @@ const zen: JupyterFrontEndPlugin<void> = {
|
||||
const plugins: JupyterFrontEndPlugin<any>[] = [
|
||||
logo,
|
||||
noTabsMenu,
|
||||
pages,
|
||||
paths,
|
||||
router,
|
||||
sessionDialogs,
|
||||
|
Loading…
Reference in New Issue
Block a user