mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-15 04:00:34 +08:00
commit
803170eec4
@ -114,6 +114,11 @@ async function main() {
|
||||
].includes(id)
|
||||
)
|
||||
]);
|
||||
} else if (page === 'running') {
|
||||
mods = mods.concat([
|
||||
require('@jupyterlab-classic/running-extension'),
|
||||
require('@jupyterlab/running-extension')
|
||||
]);
|
||||
} else if (page === 'notebooks') {
|
||||
mods = mods.concat([
|
||||
require('@jupyterlab/completer-extension').default.filter(({ id }) =>
|
||||
|
@ -15,6 +15,7 @@
|
||||
"@jupyterlab-classic/docmanager-extension": "^0.1.0",
|
||||
"@jupyterlab-classic/filebrowser-extension": "^0.1.0",
|
||||
"@jupyterlab-classic/notebook-extension": "^0.1.0",
|
||||
"@jupyterlab-classic/running-extension": "^0.1.0",
|
||||
"@jupyterlab-classic/ui-components": "^0.1.0",
|
||||
"@jupyterlab/apputils-extension": "^3.0.0-rc.12",
|
||||
"@jupyterlab/codemirror-extension": "^3.0.0-rc.12",
|
||||
@ -24,6 +25,7 @@
|
||||
"@jupyterlab/mathjax2-extension": "^3.0.0-rc.12",
|
||||
"@jupyterlab/notebook-extension": "^3.0.0-rc.12",
|
||||
"@jupyterlab/rendermime-extension": "^3.0.0-rc.12",
|
||||
"@jupyterlab/running-extension": "^3.0.0-rc.12",
|
||||
"@jupyterlab/shortcuts-extension": "^3.0.0-rc.12",
|
||||
"@jupyterlab/tooltip-extension": "^3.0.0-rc.12",
|
||||
"@jupyterlab/theme-light-extension": "^3.0.0-rc.12",
|
||||
|
@ -1,11 +1,13 @@
|
||||
@import url('~@jupyterlab-classic/application-extension/style/index.css');
|
||||
@import url('~@jupyterlab-classic/filebrowser-extension/style/index.css');
|
||||
@import url('~@jupyterlab-classic/notebook-extension/style/index.css');
|
||||
@import url('~@jupyterlab-classic/running-extension/style/index.css');
|
||||
@import url('~@jupyterlab-classic/ui-components/style/index.css');
|
||||
|
||||
/* TODO: check is the the extension package can be used directly */
|
||||
@import url('~@jupyterlab/completer/style/index.css');
|
||||
@import url('~@jupyterlab/tooltip/style/index.css');
|
||||
@import url('~@jupyterlab/running/style/index.css');
|
||||
|
||||
@import url('~@jupyterlab/codemirror-extension/style/index.css');
|
||||
@import url('~@jupyterlab/docmanager-extension/style/index.css');
|
||||
|
@ -87,6 +87,20 @@ class ClassicTreeHandler(ClassicPageConfigMixin, ExtensionHandlerJinjaMixin, Ext
|
||||
)
|
||||
|
||||
|
||||
class ClassicRunningHandler(ClassicPageConfigMixin, ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHandler):
|
||||
@web.authenticated
|
||||
def get(self, path=None):
|
||||
page_config = self.get_page_config()
|
||||
return self.write(
|
||||
self.render_template(
|
||||
"running.html",
|
||||
base_url=self.base_url,
|
||||
token=self.settings["token"],
|
||||
page_config=page_config,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class ClassicNotebookHandler(ClassicPageConfigMixin, ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHandler):
|
||||
@web.authenticated
|
||||
def get(self, path=None):
|
||||
@ -117,6 +131,7 @@ class ClassicApp(NBClassicConfigShimMixin, LabServerApp):
|
||||
def initialize_handlers(self):
|
||||
super().initialize_handlers()
|
||||
self.handlers.append(("/classic/tree(.*)", ClassicTreeHandler))
|
||||
self.handlers.append(("/classic/running", ClassicRunningHandler))
|
||||
self.handlers.append(("/classic/notebooks(.*)", ClassicNotebookHandler))
|
||||
|
||||
def initialize_templates(self):
|
||||
|
36
jupyterlab_classic/templates/running.html
Normal file
36
jupyterlab_classic/templates/running.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{page_config['appName'] | e}} - Running Sessions</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{# Copy so we do not modify the page_config with updates. #}
|
||||
{% set page_config_full = page_config.copy() %}
|
||||
|
||||
{# Set a dummy variable - we just want the side effect of the update. #}
|
||||
{% set _ = page_config_full.update(baseUrl=base_url, wsUrl=ws_url) %}
|
||||
|
||||
{# Sentinel value to say that we are on the tree page #}
|
||||
{% set _ = page_config_full.update(classicPage='running') %}
|
||||
|
||||
<script id="jupyter-config-data" type="application/json">
|
||||
{{ page_config_full | tojson }}
|
||||
</script>
|
||||
<script src="{{page_config['fullStaticUrl'] | e}}/bundle.js" main="index"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* Remove token from URL. */
|
||||
(function () {
|
||||
var parsedUrl = new URL(window.location.href);
|
||||
if (parsedUrl.searchParams.get('token')) {
|
||||
parsedUrl.searchParams.delete('token');
|
||||
window.history.replaceState({ }, '', parsedUrl.href);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -44,19 +44,22 @@ 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 JupyterLab
|
||||
*/
|
||||
export const openLab = 'application:open-lab';
|
||||
|
||||
/**
|
||||
* 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 +86,74 @@ 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.openLab, {
|
||||
label: 'Open JupyterLab',
|
||||
execute: () => {
|
||||
window.open(`${baseUrl}lab`);
|
||||
}
|
||||
});
|
||||
|
||||
app.commands.addCommand(CommandIDs.openTree, {
|
||||
label: 'Open the File Browser',
|
||||
execute: () => {
|
||||
window.open(`${baseUrl}classic/tree`);
|
||||
}
|
||||
});
|
||||
|
||||
app.commands.addCommand(CommandIDs.openRunning, {
|
||||
label: 'Open the Running Sessions',
|
||||
execute: () => {
|
||||
window.open(`${baseUrl}classic/running`);
|
||||
}
|
||||
});
|
||||
|
||||
if (palette) {
|
||||
[CommandIDs.openLab, CommandIDs.openRunning, CommandIDs.openTree].forEach(
|
||||
command => {
|
||||
palette.addItem({ command, category: 'View' });
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (menu) {
|
||||
menu.viewMenu.addGroup(
|
||||
[
|
||||
{ command: CommandIDs.openLab },
|
||||
{ command: CommandIDs.openTree },
|
||||
{ command: CommandIDs.openRunning }
|
||||
],
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The default paths for a JupyterLab Classic app.
|
||||
*/
|
||||
@ -183,7 +254,7 @@ const topVisibility: JupyterFrontEndPlugin<void> = {
|
||||
|
||||
app.commands.addCommand(CommandIDs.toggleTop, {
|
||||
label: 'Show Header',
|
||||
execute: (args: any) => {
|
||||
execute: () => {
|
||||
top.setHidden(top.isVisible);
|
||||
},
|
||||
isToggled: () => top.isVisible
|
||||
@ -242,7 +313,7 @@ const zen: JupyterFrontEndPlugin<void> = {
|
||||
let zenModeEnabled = false;
|
||||
commands.addCommand(CommandIDs.toggleZen, {
|
||||
label: 'Toggle Zen Mode',
|
||||
execute: (args: any) => {
|
||||
execute: () => {
|
||||
if (!zenModeEnabled) {
|
||||
elem.requestFullscreen();
|
||||
toggleOn();
|
||||
@ -275,6 +346,7 @@ const zen: JupyterFrontEndPlugin<void> = {
|
||||
const plugins: JupyterFrontEndPlugin<any>[] = [
|
||||
logo,
|
||||
noTabsMenu,
|
||||
pages,
|
||||
paths,
|
||||
router,
|
||||
sessionDialogs,
|
||||
|
53
packages/running-extension/package.json
Normal file
53
packages/running-extension/package.json
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "@jupyterlab-classic/running-extension",
|
||||
"version": "0.1.0",
|
||||
"description": "JupyterLab Classic - Running Extension",
|
||||
"homepage": "https://github.com/jtpio/jupyterlab-classic",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jtpio/jupyterlab-classic/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jtpio/jupyterlab-classic.git"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"author": "Project Jupyter",
|
||||
"sideEffects": [
|
||||
"style/**/*.css"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"style": "style/index.css",
|
||||
"directories": {
|
||||
"lib": "lib/"
|
||||
},
|
||||
"files": [
|
||||
"lib/*.d.ts",
|
||||
"lib/*.js.map",
|
||||
"lib/*.js",
|
||||
"schema/*.json",
|
||||
"style/**/*.css"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc -b",
|
||||
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
|
||||
"docs": "typedoc src",
|
||||
"prepublishOnly": "npm run build",
|
||||
"watch": "tsc -b --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jupyterlab/application": "^3.0.0-rc.12",
|
||||
"@jupyterlab/running": "^3.0.0-rc.12",
|
||||
"@jupyterlab/translation": "^3.0.0-rc.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "~3.0.0",
|
||||
"typescript": "~4.0.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"jupyterlab": {
|
||||
"extension": true
|
||||
}
|
||||
}
|
36
packages/running-extension/src/index.ts
Normal file
36
packages/running-extension/src/index.ts
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (c) Jupyter Development Team.
|
||||
// Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import {
|
||||
JupyterFrontEnd,
|
||||
JupyterFrontEndPlugin
|
||||
} from '@jupyterlab/application';
|
||||
|
||||
import { IRunningSessionManagers, RunningSessions } from '@jupyterlab/running';
|
||||
|
||||
import { ITranslator } from '@jupyterlab/translation';
|
||||
|
||||
/**
|
||||
* The default running sessions extension.
|
||||
*/
|
||||
const plugin: JupyterFrontEndPlugin<void> = {
|
||||
id: '@jupyterlab-classic/running-extension:plugin',
|
||||
requires: [IRunningSessionManagers],
|
||||
autoStart: true,
|
||||
activate: (
|
||||
app: JupyterFrontEnd,
|
||||
manager: IRunningSessionManagers,
|
||||
translator: ITranslator
|
||||
): void => {
|
||||
const running = new RunningSessions(manager, translator);
|
||||
running.id = 'jp-running-sessions';
|
||||
|
||||
// re-add the widget to the main area
|
||||
app.shell.add(running, 'main');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Export the plugin as default.
|
||||
*/
|
||||
export default plugin;
|
3
packages/running-extension/style/base.css
Normal file
3
packages/running-extension/style/base.css
Normal file
@ -0,0 +1,3 @@
|
||||
.jp-RunningSessions {
|
||||
height: 100%;
|
||||
}
|
3
packages/running-extension/style/index.css
Normal file
3
packages/running-extension/style/index.css
Normal file
@ -0,0 +1,3 @@
|
||||
@import url('~@jupyterlab/running/style/index.css');
|
||||
|
||||
@import url('./base.css');
|
8
packages/running-extension/tsconfig.json
Normal file
8
packages/running-extension/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfigbase",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
29
yarn.lock
29
yarn.lock
@ -2148,6 +2148,35 @@
|
||||
lodash.escape "^4.0.1"
|
||||
marked "^1.1.1"
|
||||
|
||||
"@jupyterlab/running-extension@^3.0.0-rc.12":
|
||||
version "3.0.0-rc.13"
|
||||
resolved "https://registry.yarnpkg.com/@jupyterlab/running-extension/-/running-extension-3.0.0-rc.13.tgz#dab8b62512e0ef7318393c5683d0104cb84c7183"
|
||||
integrity sha512-vdAY+wsvSwZoXfnO/U7Md+bnBH7RSbbUxXjwuGEJ4ht1eaOOEFs9llIx9CuJeN/FQkfZufpH/MV5JM5FqHtKMw==
|
||||
dependencies:
|
||||
"@jupyterlab/application" "^3.0.0-rc.13"
|
||||
"@jupyterlab/coreutils" "^5.0.0-rc.13"
|
||||
"@jupyterlab/docregistry" "^3.0.0-rc.13"
|
||||
"@jupyterlab/running" "^3.0.0-rc.13"
|
||||
"@jupyterlab/services" "^6.0.0-rc.13"
|
||||
"@jupyterlab/translation" "^3.0.0-rc.13"
|
||||
"@jupyterlab/ui-components" "^3.0.0-rc.13"
|
||||
"@lumino/algorithm" "^1.3.3"
|
||||
"@lumino/signaling" "^1.4.3"
|
||||
"@lumino/widgets" "^1.16.1"
|
||||
|
||||
"@jupyterlab/running@^3.0.0-rc.12", "@jupyterlab/running@^3.0.0-rc.13":
|
||||
version "3.0.0-rc.13"
|
||||
resolved "https://registry.yarnpkg.com/@jupyterlab/running/-/running-3.0.0-rc.13.tgz#df0d732d23d6c0c56a1512bfb0a988b05a8af4df"
|
||||
integrity sha512-852VZ6+H3xSl6DtPBe5VE1NhVprY6xgL9a5EAxeqrTljeC2IbBgt9FjBjYDfBcBkj9kdupuyU8biHbFJKNlSiw==
|
||||
dependencies:
|
||||
"@jupyterlab/apputils" "^3.0.0-rc.13"
|
||||
"@jupyterlab/translation" "^3.0.0-rc.13"
|
||||
"@jupyterlab/ui-components" "^3.0.0-rc.13"
|
||||
"@lumino/coreutils" "^1.5.3"
|
||||
"@lumino/disposable" "^1.4.3"
|
||||
"@lumino/signaling" "^1.4.3"
|
||||
react "^17.0.1"
|
||||
|
||||
"@jupyterlab/services@^6.0.0-rc.12":
|
||||
version "6.0.0-rc.12"
|
||||
resolved "https://registry.yarnpkg.com/@jupyterlab/services/-/services-6.0.0-rc.12.tgz#f0b1415ee3f203d74ac791193b87d5b126fc8ea2"
|
||||
|
Loading…
Reference in New Issue
Block a user