notebook icon indicating copy to clipboard operation
notebook copied to clipboard

`File > Shutdown` in classic notebook ask if I want to shutdow JupyterLab

Open Carreau opened this issue 1 year ago • 9 comments
trafficstars

Super tiny issue, not important, but in notebook vs, when in a notebook if I go to "File" -> "Shut Down" is asks "Please confirm you want to shut down JupyterLab."

Carreau avatar Dec 13 '23 16:12 Carreau

Thanks @Carreau for reporting.

Is this with Notebook 6.5?

jtpio avatar Dec 13 '23 17:12 jtpio

I see the "shut down JupyterLab" message in Notebook 7.0.6.

image

JasonWeill avatar Dec 30 '23 01:12 JasonWeill

Hello, I am new to open source contributions, and this will be my first attempt at one for Jupyter Notebook. Would this be a good issue to start with? Additionally, any guidance on how to approach this problem would be very much appreciated.

sawickid avatar Apr 22 '24 19:04 sawickid

I'm not a JupyterLab dev but I would try to:

  1. clone the repo, and try to install the dev version
  2. find where the error message is defined (using grep for example to find the sentence "Please confirm...")
  3. see if you manage to make a modification (e.g. rename on the given line from "JupyterLab" to something else, and see if that works).
  4. There likely a few other places where "JupyterLab" is hardcoded – finding them and listing them is useful.

Report your findings like:

'It looks like there are 5 places in src/blah/index.ts that needs "JupyterLab" to become a variable. I don't know how to pass the variable with the name into this, but it look like we have access to the "Config" variable, maybe that can hold the name of the current application'.

Then we can iterate on what to do.

Carreau avatar Apr 23 '24 08:04 Carreau

Looks like this could be fixed upstream in JupyterLab. The message is currently defined here:

https://github.com/jupyterlab/jupyterlab/blob/8819549495cd11470b4db7464d1d59c53cfce787/packages/mainmenu-extension/src/index.ts#L378

return showDialog({
    title: trans.__('Shutdown confirmation'),
    body: trans.__('Please confirm you want to shut down JupyterLab.'),
    buttons: [
      Dialog.cancelButton(),
      Dialog.warnButton({ label: trans.__('Shut Down') })
    ]
})

So instead of having "JupyterLab" hardcoded, maybe it could use app.name?

jtpio avatar Apr 23 '24 08:04 jtpio

So instead of having "JupyterLab" hardcoded, maybe it could use app.name?

Quite possible, I saw that a app:JupyterFrontEnd was available, but I was not too familiar with which properties it had.

Carreau avatar Apr 23 '24 09:04 Carreau

Notebook defines its name here:

https://github.com/jupyter/notebook/blob/f6a56f5608ccbf88fef165a6295c6475ff218f7b/packages/application/src/app.ts#L63

So app.name should indeed pick up the correct app name.

@sawickid would you like to try opening a PR on the JupyterLab repo? https://github.com/jupyterlab/jupyterlab

jtpio avatar Apr 23 '24 09:04 jtpio

Absolutely, I'll do that ASAP. Thank you!

sawickid avatar Apr 23 '24 16:04 sawickid

Sidenote, there are a few other places that could be audited for review as to wheter "JupyterLab" should be hardcoded:

$ rg trans -tts | grep JupyterLab
packages/mainmenu-extension/src/index.ts:    caption: trans.__('Shut down JupyterLab'),
packages/mainmenu-extension/src/index.ts:        body: trans.__('Please confirm you want to shut down JupyterLab.'),
packages/mainmenu-extension/src/index.ts:    caption: trans.__('Log out of JupyterLab'),
packages/extensionmanager/src/model.ts:                ? trans.__('reload JupyterLab')
packages/application-extension/src/index.tsx:            {trans.__('JupyterLab build is suggested:')}
packages/theme-light-extension/src/index.ts:      displayName: trans.__('JupyterLab Light'),
packages/rendermime/src/widgets.ts:      source: trans.__('JavaScript output is disabled in JupyterLab'),
packages/help-extension/src/index.tsx:        text: trans.__('JupyterLab Reference'),
packages/help-extension/src/index.tsx:        text: trans.__('JupyterLab FAQ'),
packages/theme-dark-high-contrast-extension/src/index.ts:      displayName: trans.__('JupyterLab Dark High Contrast'),
packages/theme-dark-extension/src/index.ts:      displayName: trans.__('JupyterLab Dark'),
packages/apputils-extension/src/workspacesplugin.ts:      displayName: trans.__('JupyterLab Workspace File'),
packages/extensionmanager-extension/src/index.ts:      body: trans.__(`Thanks for trying out JupyterLab's extension manager.

Carreau avatar Apr 24 '24 08:04 Carreau