Skip to content
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

Allow configuring jupyterlab launcher category #453

Merged
merged 1 commit into from
Jun 11, 2024
Merged
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
8 changes: 7 additions & 1 deletion docs/source/server-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,15 @@ the following keys:
explicit entry.
2. **icon_path**
Full path to an svg icon that could be used with a launcher. Currently only used by the
JupyterLab launcher
JupyterLab launcher, when category is "Notebook" (default) or "Console".
3. **title**
Title to be used for the launcher entry. Defaults to the name of the server if missing.
4. **path_info**
The trailing path that is appended to the user's server URL to access the proxied server.
By default it is the name of the server followed by a trailing slash.
5. **category**
The category for the launcher item. Currently only used by the JupyterLab launcher.
By default it is "Notebook".
dylex marked this conversation as resolved.
Show resolved Hide resolved

### `new_browser_tab`

Expand Down
1 change: 1 addition & 0 deletions jupyter_server_proxy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ async def get(self):
"enabled": sp.launcher_entry.enabled,
"title": sp.launcher_entry.title,
"path_info": sp.launcher_entry.path_info,
"category": sp.launcher_entry.category,
},
"new_browser_tab": sp.new_browser_tab,
}
Expand Down
7 changes: 6 additions & 1 deletion jupyter_server_proxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


LauncherEntry = namedtuple(
"LauncherEntry", ["enabled", "icon_path", "title", "path_info"]
"LauncherEntry", ["enabled", "icon_path", "title", "path_info", "category"]
)
ServerProcess = namedtuple(
"ServerProcess",
Expand Down Expand Up @@ -148,6 +148,7 @@ def make_server_process(name, server_process_config, serverproxy_config):
icon_path=le.get("icon_path"),
title=le.get("title", name),
path_info=le.get("path_info", name + "/"),
category=le.get("category", "Notebook"),
),
new_browser_tab=server_process_config.get("new_browser_tab", True),
request_headers_override=server_process_config.get(
Expand Down Expand Up @@ -230,6 +231,10 @@ class ServerProxy(Configurable):
The trailing path that is appended to the user's server URL to access the proxied server.
By default it is the name of the server followed by a trailing slash.

category
The category for the launcher item. Currently only used by the JupyterLab launcher.
By default it is "Notebook".

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
2 changes: 1 addition & 1 deletion labextension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ async function activate(
launcher.add({
command: CommandIDs.open,
args: argsForServer(server_process),
category: "Notebook",
category: launcher_entry.category,
kernelIconUrl: launcher_entry.icon_url || void 0,
});
}
Expand Down
1 change: 1 addition & 0 deletions labextension/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@ export interface ILauncherEntry {
path_info: string;
// the `?` means this argument may not exist, but if it does, it must be a string
icon_url?: string;
category?: string;
}