Skip to content

Commit

Permalink
Merge pull request #453 from dylex/category
Browse files Browse the repository at this point in the history
Allow configuring jupyterlab launcher category
  • Loading branch information
yuvipanda authored Jun 11, 2024
2 parents 75cba2c + 8455608 commit f7a860d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
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".

### `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;
}

0 comments on commit f7a860d

Please sign in to comment.