Skip to content

Commit

Permalink
Move VSCode and scheduler to appropriate positions
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed May 7, 2024
1 parent dad55b6 commit 864ea06
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupyterlab-new-launcher",
"version": "0.2.0",
"version": "0.2.1",
"description": "A redesigned JupyterLab launcher",
"keywords": [
"jupyter",
Expand Down
9 changes: 9 additions & 0 deletions schema/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@
"$ref": "#/$defs/collapseState"
}
}
},
"utilityCommands": {
"title": "Utility commands",
"description": "Commands for launcher buttons which should be moved to the utility bar in top right corner.",
"type": "array",
"items": {
"type": "string"
},
"default": ["inspector:open", "scheduling:list-jobs-from-launcher"]
}
},
"additionalProperties": false,
Expand Down
24 changes: 19 additions & 5 deletions src/launcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ export namespace NewLauncher {
}
}

const SERVER_PROXY_COMMAND = 'server-proxy:open';

export class NewLauncher extends Launcher {
constructor(options: NewLauncher.IOptions) {
super(options);
Expand Down Expand Up @@ -256,7 +258,8 @@ export class NewLauncher extends Launcher {
const consoleCategory = trans.__('Console');
const kernelCategories = [notebookCategory, consoleCategory];

const otherCommands = ['inspector:open'];
const otherCommands = this._settings.composite
.utilityCommands as ISettingsLayout['utilityCommands'];

const otherItems = items
.filter(item => otherCommands.includes(item.command))
Expand All @@ -265,8 +268,9 @@ export class NewLauncher extends Launcher {
// TODO: maybe better to filter out everything from default lab and re-populate the kernel categories manually to get more metadata?
const nonKernelItems = items.filter(
item =>
(!item.category || !kernelCategories.includes(item.category)) &&
!otherCommands.includes(item.command)
((!item.category || !kernelCategories.includes(item.category)) &&
!otherCommands.includes(item.command)) ||
item.command === SERVER_PROXY_COMMAND
);
const rankOverrides = {
'terminal:create-new': 3, // TODO: replace with terminal which asks for environment choice?
Expand All @@ -291,11 +295,21 @@ export class NewLauncher extends Launcher {
].sort((a, b) => (a?.rank ?? 0) - (b?.rank ?? 0));

const notebookItems = items
.filter(item => item.category && item.category === notebookCategory)
.filter(
item =>
item.category &&
item.category === notebookCategory &&
item.command !== SERVER_PROXY_COMMAND
)
.map(this.renderKernelCommand);

const consoleItems = items
.filter(item => item.category && item.category === consoleCategory)
.filter(
item =>
item.category &&
item.category === consoleCategory &&
item.command !== SERVER_PROXY_COMMAND
)
.map(this.renderKernelCommand);

// TODO: only create items once or if changed; dispose of them too
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface ISettingsLayout {
starredSection: boolean;
collapsedSections: Record<string, 'collapsed' | 'expanded'>;
searchAllSections: boolean;
utilityCommands: string[];
}

export interface IItem extends ILauncher.IItemOptions {
Expand Down

0 comments on commit 864ea06

Please sign in to comment.