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

Filebrowser Context Menu should exclude Shut Down kernel for documents that don't support a kernel #11392

Closed
ianhi opened this issue Nov 2, 2021 · 1 comment · Fixed by #12919

Comments

@ianhi
Copy link
Contributor

ianhi commented Nov 2, 2021

Description

The context menu give the option to Shut Down Kernel even for documents that don't support one such as a .zip file and also for notebooks without a currently running kernel.

Continuation of #9960

Reproduce

Open filebrowser and right click on any non-folder item

Expected behavior

Shut Down Kernel only present in menu when there is a kernel to be shut down.

Context

  • Operating System and version: Linux Ubuntu 21.04
  • Browser and version: Firefox 93
  • JupyterLab version: 3.2.1
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.
@jasongrout
Copy link
Contributor

I think to do this well, it requires some changes in how the filebrowser exposes the selected items and the sessions it knows about, so the command can decide to disable itself if there are no current kernels running on the selected items. Presumably the command at

commands.addCommand(CommandIDs.shutdown, {
execute: () => {
const widget = tracker.currentWidget;
if (widget) {
return widget.shutdownKernels();
}
},
icon: stopIcon.bindprops({ stylesheet: 'menuItem' }),
label: trans.__('Shut Down Kernel')
});
would be able to determine what was selected and if any of the selected items had associated kernel sessions.

I also tried this, but it didn't seem to work.

diff --git a/packages/filebrowser-extension/schema/browser.json b/packages/filebrowser-extension/schema/browser.json
index c2a19defdf..24dc3dccd8 100644
--- a/packages/filebrowser-extension/schema/browser.json
+++ b/packages/filebrowser-extension/schema/browser.json
@@ -104,7 +104,7 @@
       },
       {
         "command": "filebrowser:shutdown",
-        "selector": ".jp-DirListing-item[data-isdir=\"false\"]",
+        "selector": ".jp-DirListing-item[data-isdir=\"false\"]:not(.jp-mod-running)",
         "rank": 11
       },
       {

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants