-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Close the browser tab when clicking on "Close and Shut Down Notebook" #6937
Conversation
bot please update playwright snapshots |
cc @gutow for awareness |
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.
|
||
const id = '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 and Halt'), | |
label: trans.__('Close Notebook and Shutdown 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 use Shut Down
instead of Shutdown
for consistency with the other menu entries.
ui-tests/test/notebook.spec.ts
Outdated
@@ -155,4 +155,24 @@ test.describe('Notebook', () => { | |||
const imageName = 'notebooktools-right-panel.png'; | |||
expect(await panel.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 and Halt" should close the browser tab', async ({ | |
test('Clicking on "Close Notebook and Shutdown Kernel" should close the browser tab', async ({ |
); | ||
await page.goto(`notebooks/${tmpPath}/${notebook}`); | ||
|
||
const menuPath = '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.
const menuPath = 'File>Close and Halt'; | |
const menuPath = 'File>Close Notebook and Shutdown Kernel'; |
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): |
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. |
Yes that sounds fine too. Users familiar with the |
Co-Authored-By: Andrii Ieroshenko <[email protected]>
bot please update playwright snapshots |
FYI @andrii-i I updated the PR to take your suggestions in consideration. |
Merging as the comments above have been addressed. Thanks @andrii-i for the review! |
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