- Notifications
You must be signed in to change notification settings - Fork5.5k
Close the browser tab when clicking on "Close and Shut Down Notebook"#6937
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
jtpio commentedJun 20, 2023
bot please update playwright snapshots |
jtpio commentedJun 20, 2023
cc@gutow for awareness |
andrii-i left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This looks and works well, thank you for working on this@jtpio.
I believe there is spaceto improve user experience further beyond adding parity with nbclassic:
- It's not clear what exactly "Close and Halt" and "Shut Down" items do and what is the difference between them. Please find suggestions below on renaming "Close and Halt" into "Close Notebook and Shutdown Kernel". "Shut Down" should then be renamed into "Shut Down Server". I think this can be done within this PR but can also be taken care of separately.
- "Close and Halt" terminates kernel of the notebook and "Shut Down" terminates server with all kernels. When this happens all unsaved data is lost. Therefore these buttons are destructive and can lead to data loss. To remedy this, we could ask a user to confirm his action via modal/popup window. We should then also add "..." to the end of both options to indicate that selecting the item will lead to further options or require additional input. It would probably be best to do it in a separate PR after Notebook 7 launch, please let me know if you agree with the approach and I can create an issue to track it.
| constid='notebook:close-and-halt'; | ||
| commands.addCommand(id,{ | ||
| label:trans.__('Close and Halt'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| label:trans.__('Close andHalt'), | |
| label:trans.__('CloseNotebookandShutdown Kernel'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If going with this suggestion then we'll likely need to useShut Down instead ofShutdown for consistency with the other menu entries.
ui-tests/test/notebook.spec.ts Outdated
| expect(awaitpanel.screenshot()).toMatchSnapshot(imageName); | ||
| }); | ||
| test('Clicking on "Close and Halt" should close the browser tab',async({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| test('Clicking on "Close andHalt" should close the browser tab',async({ | |
| test('Clicking on "CloseNotebookandShutdown Kernel" should close the browser tab',async({ |
| ); | ||
| awaitpage.goto(`notebooks/${tmpPath}/${notebook}`); | ||
| constmenuPath='File>Close and Halt'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| constmenuPath='File>Close andHalt'; | |
| constmenuPath='File>CloseNotebookandShutdown Kernel'; |
jtpio commentedJun 21, 2023
Good question. JupyterLab uses "Close and Shut Down Notebook", while for the Classic Notebook it's "Close and Halt". This PR went with "Close and Halt" so it looks the same as the classic notebook and also taking into consideration#6398 (for example if folks have screenshots showing these menu entries in the course materials). However for consistency with JupyterLab it would be fine to go with "Close and Shut Down Notebook" yes, no strong opinion.
Normally there is already a dialog (see the second screencast): |
andrii-i commentedJun 21, 2023
From my point of view, "Close and Shut Down Notebook" is significantly more clear in explaining its function. "Close and Shut Down Notebook" still describes what happens with kernel better vs for example "Close and Halt Notebook" as "halt" implies pausing. Also we already use "Shut Down" for process termination so with "halt" we would be introducing a second term for the same action. We could also check in with other contributors during the call today.
Yes, somehow missed this. |
jtpio commentedJun 21, 2023
Yes that sounds fine too. Users familiar with the |
Co-Authored-By: Andrii Ieroshenko <ieroshenkoa@gmail.com>
jtpio commentedJun 21, 2023
bot please update playwright snapshots |
jtpio commentedJun 21, 2023
FYI@andrii-i I updated the PR to take your suggestions in consideration. |
jtpio commentedJun 22, 2023
Merging as the comments above have been addressed. Thanks@andrii-i for the review! |

Uh oh!
There was an error while loading.Please reload this page.
Fixes#6934
Fixes#1159
This mimics the behavior of the Classic Notebook:
close-and-halt.mp4
In Notebook 7:
notebook-7-close-and-halt.mp4
Changes
closeAndCleaners