mirror of
https://github.com/jupyter/notebook.git
synced 2024-11-21 01:11:21 +08:00
More retro updates
This commit is contained in:
parent
6614c0d62a
commit
5fa11dd67d
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -106,5 +106,5 @@ jobs:
|
||||
jupyter labextension list 2>&1 | grep -ie "@jupyter-notebook/lab-extension.*enabled.*ok" -
|
||||
jupyter server extension list
|
||||
jupyter server extension list 2>&1 | grep -ie "notebook.*enabled" -
|
||||
jupyter retro --version
|
||||
jupyter retro --help
|
||||
jupyter notebook --version
|
||||
jupyter notebook --help
|
||||
|
@ -1,4 +1,3 @@
|
||||
{
|
||||
"NotebookApp": { "collaborative": true, "expose_app_in_browser": true },
|
||||
"LabApp": { "collaborative": true, "expose_app_in_browser": true }
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ app_dir = get_app_dir()
|
||||
version = __version__
|
||||
|
||||
|
||||
class RetroHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHandler):
|
||||
class NotebookBaseHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHandler):
|
||||
def get_page_config(self):
|
||||
config = LabConfig()
|
||||
app = self.extensionapp
|
||||
@ -37,7 +37,7 @@ class RetroHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHan
|
||||
"terminalsAvailable": self.settings.get("terminals_available", False),
|
||||
"token": self.settings["token"],
|
||||
"fullStaticUrl": ujoin(self.base_url, "static", self.name),
|
||||
"frontendUrl": ujoin(self.base_url, "retro/"),
|
||||
"frontendUrl": ujoin(self.base_url, "/"),
|
||||
"exposeAppInBrowser": app.expose_app_in_browser,
|
||||
"collaborative": app.collaborative,
|
||||
}
|
||||
@ -93,13 +93,13 @@ class RetroHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHan
|
||||
return page_config
|
||||
|
||||
|
||||
class RetroRedirectHandler(RetroHandler):
|
||||
class RedirectHandler(NotebookBaseHandler):
|
||||
@web.authenticated
|
||||
def get(self):
|
||||
return self.redirect(self.base_url+'retro/tree')
|
||||
return self.redirect(self.base_url+'tree')
|
||||
|
||||
|
||||
class RetroTreeHandler(RetroHandler):
|
||||
class TreeHandler(NotebookBaseHandler):
|
||||
@web.authenticated
|
||||
async def get(self, path=None):
|
||||
"""
|
||||
@ -137,28 +137,28 @@ class RetroTreeHandler(RetroHandler):
|
||||
raise web.HTTPError(404)
|
||||
|
||||
|
||||
class RetroConsoleHandler(RetroHandler):
|
||||
class ConsoleHandler(NotebookBaseHandler):
|
||||
@web.authenticated
|
||||
def get(self, path=None):
|
||||
tpl = self.render_template("consoles.html", page_config=self.get_page_config())
|
||||
return self.write(tpl)
|
||||
|
||||
|
||||
class RetroTerminalHandler(RetroHandler):
|
||||
class TerminalHandler(NotebookBaseHandler):
|
||||
@web.authenticated
|
||||
def get(self, path=None):
|
||||
tpl = self.render_template("terminals.html", page_config=self.get_page_config())
|
||||
return self.write(tpl)
|
||||
|
||||
|
||||
class RetroFileHandler(RetroHandler):
|
||||
class FileHandler(NotebookBaseHandler):
|
||||
@web.authenticated
|
||||
def get(self, path=None):
|
||||
tpl = self.render_template("edit.html", page_config=self.get_page_config())
|
||||
return self.write(tpl)
|
||||
|
||||
|
||||
class RetroNotebookHandler(RetroHandler):
|
||||
class NotebookHandler(NotebookBaseHandler):
|
||||
@web.authenticated
|
||||
def get(self, path=None):
|
||||
tpl = self.render_template("notebooks.html", page_config=self.get_page_config())
|
||||
@ -174,9 +174,9 @@ class NotebookApp(LabServerApp):
|
||||
description = "Jupyter Notebook - A web-based notebook environment for interactive computing"
|
||||
version = version
|
||||
app_version = version
|
||||
extension_url = "/retro"
|
||||
default_url = "/retro/tree"
|
||||
file_url_prefix = "/retro/notebooks"
|
||||
extension_url = "/tree"
|
||||
default_url = "/tree"
|
||||
file_url_prefix = "/notebooks"
|
||||
load_other_extensions = True
|
||||
app_dir = app_dir
|
||||
app_settings_dir = pjoin(app_dir, "settings")
|
||||
@ -211,15 +211,15 @@ class NotebookApp(LabServerApp):
|
||||
(
|
||||
rf"/{self.file_url_prefix}/((?!.*\.ipynb($|\?)).*)",
|
||||
web.RedirectHandler,
|
||||
{"url": "/retro/edit/{0}"},
|
||||
{"url": "/edit/{0}"},
|
||||
)
|
||||
)
|
||||
self.handlers.append(("/retro/?", RetroRedirectHandler))
|
||||
self.handlers.append(("/retro/tree(.*)", RetroTreeHandler))
|
||||
self.handlers.append(("/retro/notebooks(.*)", RetroNotebookHandler))
|
||||
self.handlers.append(("/retro/edit(.*)", RetroFileHandler))
|
||||
self.handlers.append(("/retro/consoles/(.*)", RetroConsoleHandler))
|
||||
self.handlers.append(("/retro/terminals/(.*)", RetroTerminalHandler))
|
||||
self.handlers.append(("/retro/?", RedirectHandler))
|
||||
self.handlers.append(("/tree(.*)", TreeHandler))
|
||||
self.handlers.append(("/notebooks(.*)", NotebookHandler))
|
||||
self.handlers.append(("/edit(.*)", FileHandler))
|
||||
self.handlers.append(("/consoles/(.*)", ConsoleHandler))
|
||||
self.handlers.append(("/terminals/(.*)", TerminalHandler))
|
||||
super().initialize_handlers()
|
||||
|
||||
def initialize_templates(self):
|
||||
|
@ -137,7 +137,7 @@ const logo: JupyterFrontEndPlugin<void> = {
|
||||
activate: (app: JupyterFrontEnd) => {
|
||||
const baseUrl = PageConfig.getBaseUrl();
|
||||
const node = document.createElement('a');
|
||||
node.href = `${baseUrl}retro/tree`;
|
||||
node.href = `${baseUrl}tree`;
|
||||
node.target = '_blank';
|
||||
node.rel = 'noopener noreferrer';
|
||||
const logo = new Widget({ node });
|
||||
@ -258,7 +258,7 @@ const pages: JupyterFrontEndPlugin<void> = {
|
||||
app.commands.addCommand(CommandIDs.openTree, {
|
||||
label: trans.__('Open Files'),
|
||||
execute: () => {
|
||||
window.open(`${baseUrl}retro/tree`);
|
||||
window.open(`${baseUrl}tree`);
|
||||
}
|
||||
});
|
||||
|
||||
@ -490,7 +490,7 @@ const title: JupyterFrontEndPlugin<void> = {
|
||||
return;
|
||||
}
|
||||
const encoded = encodeURIComponent(newPath);
|
||||
router.navigate(`/retro/${route}/${encoded}`, {
|
||||
router.navigate(`/${route}/${encoded}`, {
|
||||
skipRouting: true
|
||||
});
|
||||
}
|
||||
@ -596,7 +596,7 @@ const tree: JupyterFrontEndPlugin<JupyterFrontEnd.ITreeResolver> = {
|
||||
const set = new DisposableSet();
|
||||
const delegate = new PromiseDelegate<JupyterFrontEnd.ITreeResolver.Paths>();
|
||||
|
||||
const treePattern = new RegExp('/retro(/tree/.*)?');
|
||||
const treePattern = new RegExp('/(/tree/.*)?');
|
||||
|
||||
set.add(
|
||||
commands.addCommand(CommandIDs.resolveTree, {
|
||||
@ -651,7 +651,6 @@ const treePathUpdater: JupyterFrontEndPlugin<ITreePathUpdater> = {
|
||||
if (treePath !== PageConfig.getOption('treePath')) {
|
||||
const path = URLExt.join(
|
||||
PageConfig.getOption('baseUrl') || '/',
|
||||
'retro',
|
||||
'tree',
|
||||
URLExt.encodeParts(treePath)
|
||||
);
|
||||
|
@ -63,7 +63,7 @@ const redirect: JupyterFrontEndPlugin<void> = {
|
||||
// bail if the console is already added to the main area
|
||||
return;
|
||||
}
|
||||
window.open(`${baseUrl}retro/consoles/${sessionContext.path}`, '_blank');
|
||||
window.open(`${baseUrl}consoles/${sessionContext.path}`, '_blank');
|
||||
|
||||
// the widget is not needed anymore
|
||||
console.dispose();
|
||||
|
@ -41,7 +41,7 @@ const opener: JupyterFrontEndPlugin<void> = {
|
||||
}
|
||||
const ext = PathExt.extname(path);
|
||||
const route = ext === '.ipynb' ? 'notebooks' : 'edit';
|
||||
window.open(`${baseUrl}retro/${route}/${path}`);
|
||||
window.open(`${baseUrl}${route}/${path}`);
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ const launchButtons: JupyterFrontEndPlugin<void> = {
|
||||
command: 'jupyter-notebook:open-retro',
|
||||
commandLabel: trans.__('Open With %1', 'Jupyter Notebook'),
|
||||
buttonLabel: 'openRetro',
|
||||
urlPrefix: `${baseUrl}retro/tree/`
|
||||
urlPrefix: `${baseUrl}tree/`
|
||||
});
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ const launchRetroTree: JupyterFrontEndPlugin<void> = {
|
||||
commands.addCommand(CommandIDs.launchRetroTree, {
|
||||
label: trans.__('Launch Jupyter Notebook File Browser'),
|
||||
execute: () => {
|
||||
window.open(PageConfig.getBaseUrl() + 'retro/tree');
|
||||
window.open(PageConfig.getBaseUrl() + 'tree');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -68,7 +68,7 @@ const redirect: JupyterFrontEndPlugin<void> = {
|
||||
return;
|
||||
}
|
||||
const name = terminal.content.session.name;
|
||||
window.open(`${baseUrl}retro/terminals/${name}`, '_blank');
|
||||
window.open(`${baseUrl}terminals/${name}`, '_blank');
|
||||
|
||||
// dispose the widget since it is not used on this page
|
||||
terminal.dispose();
|
||||
|
@ -6,7 +6,7 @@
|
||||
"license": "BSD-3-Clause",
|
||||
"description": "Jupyter Notebook UI Tests",
|
||||
"scripts": {
|
||||
"start": "jupyter retro --config test/jupyter_server_config.py",
|
||||
"start": "jupyter notebook --config test/jupyter_server_config.py",
|
||||
"start:detached": "yarn run start&",
|
||||
"test": "playwright test",
|
||||
"test:debug": "PWDEBUG=1 playwright test",
|
||||
|
@ -4,7 +4,7 @@ module.exports = {
|
||||
...baseConfig,
|
||||
timeout: 240000,
|
||||
use: {
|
||||
appPath: '/retro'
|
||||
appPath: '/'
|
||||
},
|
||||
retries: 1
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ test.describe('Notebook', () => {
|
||||
const href = await page.evaluate(() => {
|
||||
return document.querySelector('#jp-RetroLogo')?.getAttribute('href');
|
||||
});
|
||||
expect(href).toContain('/retro/tree');
|
||||
expect(href).toContain('/tree');
|
||||
});
|
||||
|
||||
test('Renaming the notebook should be possible', async ({
|
||||
|
@ -34,5 +34,5 @@ test('should update url when navigating in filebrowser', async ({
|
||||
await page.waitForSelector(`.jp-FileBrowser-crumbs >> text=/${SUBFOLDER}/`);
|
||||
|
||||
const url = new URL(page.url());
|
||||
expect(url.pathname).toEqual(`/retro/tree/${tmpPath}/${SUBFOLDER}`);
|
||||
expect(url.pathname).toEqual(`/tree/${tmpPath}/${SUBFOLDER}`);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user