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

Launcher items should include semantic information about action they perform #16180

Open
krassowski opened this issue Apr 17, 2024 · 0 comments

Comments

@krassowski
Copy link
Member

krassowski commented Apr 17, 2024

Problem

Currently the launcher cards, both in core JupyterLab and in extensions, mix up a number of concepts:

  • creating a new document (notebook/file)
  • opening a widget panel (contextual help)
  • opening a new transient session (terminal/console)
  • opening a session of external application (VSCode, RStudio in many jupyterhub deployments)

Because Launcher only includes three default categories ("Notebook", "Console", "Other"), extensions end up adding things all over the place. For example:

  • jupyter-server-proxy, an official extension from JupyterHub team adds VSCode and RStudio under "Notebook".
  • "contextual help" tile is added under "Other"
  • "console" and "terminal" are in separate places, although they conceptual represent the same thing

Currently there is no way for extensions nor core to add annotations about what type of an action an item will perform, so the core launcher - nor launcher extensions - cannot take advantage of this.

Related to #3795

Proposed Solution

Add a new field to ILauncher.IItemOptions interface; make it optional for now for compatibility, but mark it as required in a future major release (say JupyterLab v6).

Annotating the action that will be performed when clicking on an item will also help with making better aria labels.

For example action?: 'new-session' | 'new-document' | 'launch-external-application' | 'open-widget' where

  • new-document: notebook, file, etc
  • new-session: terminal/console - transient things without associated file on disk (maybe new-transient-session)
  • launch-external-application: VSCode, RStudio, Viola, etc
  • open-widget: contextual help, LSP diagnostics panel

Additional context

While launcher items have metadata field:

export interface IItemOptions {
/**
* The command ID for the launcher item.
*
* #### Notes
* If the command's `execute` method returns a `Widget` or
* a promise that resolves with a `Widget`, then that widget will
* replace the launcher in the same location of the application
* shell. If the `execute` method does something else
* (i.e., create a modal dialog), then the launcher will not be
* disposed.
*/
command: string;
/**
* The arguments given to the command for
* creating the launcher item.
*
* ### Notes
* The launcher will also add the current working
* directory of the filebrowser in the `cwd` field
* of the args, which a command may use to create
* the activity with respect to the right directory.
*/
args?: ReadonlyJSONObject;
/**
* The category for the launcher item.
*
* The default value is an empty string.
*/
category?: string;
/**
* The rank for the launcher item.
*
* The rank is used when ordering launcher items for display. After grouping
* into categories, items are sorted in the following order:
* 1. Rank (lower is better)
* 3. Display Name (locale order)
*
* The default rank is `Infinity`.
*/
rank?: number;
/**
* For items that have a kernel associated with them, the URL of the kernel
* icon.
*
* This is not a CSS class, but the URL that points to the icon in the kernel
* spec.
*/
kernelIconUrl?: string;
/**
* Metadata about the item. This can be used by the launcher to
* affect how the item is displayed.
*/
metadata?: ReadonlyJSONObject;
}

This is not typed nor useful here because what we need is consistency from anyone who adds items to launcher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants