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

Restore close and shutdown confirmation dialog #7430

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/notebook-extension/src/index.ts
Original file line number Diff line number Diff line change
@@ -163,9 +163,15 @@ const closeTab: JupyterFrontEndPlugin<void> = {
commands.addCommand(id, {
label: trans.__('Close and Shut Down Notebook'),
execute: async () => {
// Shut the kernel down, without confirmation
await commands.execute('notebook:shutdown-kernel', { activate: false });
window.close();
const confirm = window.confirm(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sai-chand04 for working on this.

As discussed in #7398, the idea was to introduce a setting to let users override the default behavior. Which does not seem to be the case here for now.

trans.__('Are you sure you want to close and shut down the notebook?')
);
if (confirm) {
await commands.execute('notebook:shutdown-kernel', {
activate: false,
});
window.close();
}
},
});
menu.fileMenu.closeAndCleaners.add({

Unchanged files with check annotations Beta

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import { IJupyterLabPage, expect, galata } from '@jupyterlab/galata';

Check warning on line 4 in ui-tests/test/mobile.spec.ts

GitHub Actions / Test Lint

'IJupyterLabPage' is defined but never used
import { test } from './fixtures';
await hideAddCellButton(notebook);
}
expect(await notebook.screenshot()).toMatchSnapshot('notebook.png');

Check failure on line 71 in ui-tests/test/mobile.spec.ts

GitHub Actions / ui-tests (chromium)

[chromium] › test/mobile.spec.ts:41:7 › Mobile › The layout should be more compact on the notebook page

1) [chromium] › test/mobile.spec.ts:41:7 › Mobile › The layout should be more compact on the notebook page Error: Screenshot comparison failed: 637 pixels (ratio 0.01 of all image pixels) are different. Expected: /home/runner/work/notebook/notebook/ui-tests/test/mobile.spec.ts-snapshots/notebook-chromium-linux.png Received: /home/runner/work/notebook/notebook/ui-tests/test-results/test-mobile-Mobile-The-lay-36afb-ompact-on-the-notebook-page-chromium/notebook-actual.png Diff: /home/runner/work/notebook/notebook/ui-tests/test-results/test-mobile-Mobile-The-lay-36afb-ompact-on-the-notebook-page-chromium/notebook-diff.png 69 | } 70 | > 71 | expect(await notebook.screenshot()).toMatchSnapshot('notebook.png'); | ^ 72 | await notebook.close(); 73 | }); 74 | }); at /home/runner/work/notebook/notebook/ui-tests/test/mobile.spec.ts:71:41
await notebook.close();
});
});
const toolbar = page.getByRole('toolbar');
['Rename', 'Delete', 'Open', 'Download', 'Delete'].forEach(async (text) => {
expect(toolbar.getByText(text)).toBeVisible();

Check failure on line 39 in ui-tests/test/filebrowser.spec.ts

GitHub Actions / ui-tests (firefox)

[firefox] › test/filebrowser.spec.ts:31:7 › File Browser › Select one file

1) [firefox] › test/filebrowser.spec.ts:31:7 › File Browser › Select one file ──────────────────── Error: expect(locator).toBeVisible() Locator: getByRole('toolbar').getByText('Download') Expected: visible Received: hidden Call log: - expect.toBeVisible with timeout 5000ms - waiting for getByRole('toolbar').getByText('Download') 37 | 38 | ['Rename', 'Delete', 'Open', 'Download', 'Delete'].forEach(async (text) => { > 39 | expect(toolbar.getByText(text)).toBeVisible(); | ^ 40 | }); 41 | }); 42 | at forEach (/home/runner/work/notebook/notebook/ui-tests/test/filebrowser.spec.ts:39:39) at /home/runner/work/notebook/notebook/ui-tests/test/filebrowser.spec.ts:38:56
});
});