Skip to content

support for URL filename and URL parameters #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion jupyter_server_proxy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ async def get(self):
'launcher_entry': {
'enabled': sp.launcher_entry.enabled,
'title': sp.launcher_entry.title,
'path_info': sp.launcher_entry.path_info
'path_info': sp.launcher_entry.path_info,
'urlfile': sp.launcher_entry.urlfile
},
'new_browser_tab' : sp.new_browser_tab
}
Expand Down
9 changes: 7 additions & 2 deletions jupyter_server_proxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def make_handlers(base_url, server_processes):
))
return handlers

LauncherEntry = namedtuple('LauncherEntry', ['enabled', 'icon_path', 'title', 'path_info'])
LauncherEntry = namedtuple('LauncherEntry', ['enabled', 'icon_path', 'title', 'path_info', 'urlfile'])
ServerProcess = namedtuple('ServerProcess', [
'name', 'command', 'environment', 'timeout', 'absolute_url', 'port', 'mappath', 'launcher_entry', 'new_browser_tab', 'request_headers_override'])

Expand All @@ -124,7 +124,8 @@ def make_server_process(name, server_process_config):
enabled=le.get('enabled', True),
icon_path=le.get('icon_path'),
title=le.get('title', name),
path_info=le.get('path_info', name + "/")
path_info=le.get('path_info', name + "/"),
urlfile=le.get('urlfile', '')
),
new_browser_tab=server_process_config.get('new_browser_tab', True),
request_headers_override=server_process_config.get('request_headers_override', {})
Expand Down Expand Up @@ -184,6 +185,10 @@ class ServerProxy(Configurable):
title
Title to be used for the launcher entry. Defaults to the name of the server if missing.

urlfile
URL file name and URL parameters to be added to the base URL of the launcher entry.
Default is none.

new_browser_tab
Set to True (default) to make the proxied server interface opened as a new browser tab. Set to False
to have it open a new JupyterLab tab. This has no effect in classic notebook.
Expand Down
6 changes: 5 additions & 1 deletion jupyter_server_proxy/static/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ define(['jquery', 'base/js/namespace', 'base/js/utils'], function($, Jupyter, ut
.addClass('new-' + server_process.name);

/* create our list item's link */
var urlfile = '';
if (server_process.launcher_entry.urlfile) {
urlfile = server_process.launcher_entry.urlfile;
}
var $entry_link = $('<a>')
.attr('role', 'menuitem')
.attr('tabindex', '-1')
.attr('href', base_url + server_process.launcher_entry.path_info)
.attr('href', base_url + server_process.launcher_entry.path_info + urlfile)
.attr('target', '_blank')
.text(server_process.launcher_entry.title);

Expand Down
2 changes: 1 addition & 1 deletion jupyterlab-server-proxy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jupyterlab/server-proxy",
"version": "3.0.2",
"version": "3.1.0",
"description": "Jupyter server extension to supervise and proxy web services",
"keywords": [
"jupyter",
Expand Down
7 changes: 5 additions & 2 deletions jupyterlab-server-proxy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ async function activate(app: JupyterFrontEnd, launcher: ILauncher, restorer: ILa
if (!server_process.launcher_entry.enabled) {
continue;
}

const url = PageConfig.getBaseUrl() + server_process.name + '/';
var urlfile = '';
if (server_process.launcher_entry.urlfile) {
urlfile = server_process.launcher_entry.urlfile;
}
const url = PageConfig.getBaseUrl() + server_process.name + '/' + urlfile;
const title = server_process.launcher_entry.title;
const newBrowserTab = server_process.new_browser_tab;
const id = namespace + ':' + server_process.name;
Expand Down