Skip to content

Commit

Permalink
Fix defaults for optionals, remove placeholder exhibits, do not add s…
Browse files Browse the repository at this point in the history
…ection if empty (#19)

* Allow `None` for optional items

* Remove default values which were used for tests

* Only
  • Loading branch information
krassowski authored Jun 13, 2024
1 parent f909204 commit 2f59b08
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
1 change: 1 addition & 0 deletions jupyterlab_gallery/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def get(self):
json.dumps(
{
"title": self.gallery_manager.title,
"exhibitsConfigured": len(self.gallery_manager.exhibits) != 0,
"apiVersion": "1.0",
}
)
Expand Down
32 changes: 13 additions & 19 deletions jupyterlab_gallery/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,30 @@ def __init__(self, *args, **kwargs):
Dict(
per_key_traits={
"git": Unicode(help="Git URL used for cloning"),
"homepage": Unicode(help="User-facing URL to open if any"),
"title": Unicode(help="Name of the exhibit"),
"description": Unicode(help="Short description"),
"homepage": Unicode(
help="User-facing URL to open if any", allow_none=True
),
"description": Unicode(help="Short description", allow_none=True),
"token": Unicode(
help="Personal access token - required if the repository is private"
help="Personal access token - required if the repository is private",
allow_none=True,
),
"account": Unicode(
help="Username or name of application - required if the repository is private"
help="Username or name of application - required if the repository is private",
allow_none=True,
),
# TODO: validate path exists
"icon": Unicode(help="Path to an svg or png, or base64 encoded string"),
"icon": Unicode(
help="Path to an svg or png, or base64 encoded string",
allow_none=True,
),
# other ideas: `path_in_repository`, `documentation_url`
}
),
config=True,
allow_none=False,
default_value=[
{
"git": "https://github.com/nebari-dev/nebari.git",
"homepage": "https://github.com/nebari-dev/nebari/",
"title": "Nebari",
"description": "🪴 Nebari - your open source data science platform",
},
{
"git": "https://github.com/nebari-dev/nebari-docker-images.git",
"homepage": "https://github.com/nebari-dev/nebari-docker-images/",
"title": "Nebari docker images",
"description": "Nebari Docker images",
},
],
default_value=[],
)

destination = Unicode(
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const plugin: JupyterFrontEndPlugin<void> = {

const title = data.title === 'Gallery' ? trans.__('Gallery') : data.title;
// add the widget to sidebar before waiting for server reply to reduce UI jitter
if (launcher && isNewLauncher(launcher)) {
if (launcher && isNewLauncher(launcher) && data.exhibitsConfigured) {
launcher.addSection({
title,
className: 'jp-Launcher-openExample',
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface IGalleryReply {
title: string;
apiVersion: string;
exhibitsConfigured: boolean;
}

export interface IExhibitReply {
Expand Down

0 comments on commit 2f59b08

Please sign in to comment.