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

Updates warning message on double file open #375

Merged
merged 4 commits into from
Oct 17, 2024
Merged
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
16 changes: 7 additions & 9 deletions packages/docprovider-extension/src/filebrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ namespace CommandIDs {
}
const DOCUMENT_TIMELINE_URL = 'api/collaboration/timeline';

const TWO_SESSIONS_WARNING =
'The file %1 has been opened with two different views. ' +
'This is not supported. Please close this view; otherwise, ' +
'some of your edits may not be saved properly.';

/**
* The default collaborative drive provider.
*/
Expand Down Expand Up @@ -306,10 +311,7 @@ export const logger: JupyterFrontEndPlugin<void> = {
if (emission.level === 'WARNING') {
showDialog({
title: trans.__('Warning'),
body: trans.__(
`Two collaborative sessions are accessing the file ${emission.path} simultaneously.
\nOpening the same file using different views simultaneously is not supported. Please, close one view; otherwise, you might lose some of your progress.`
),
body: trans.__(TWO_SESSIONS_WARNING, emission.path),
buttons: [Dialog.okButton()]
});
}
Expand Down Expand Up @@ -355,11 +357,7 @@ export const logger: JupyterFrontEndPlugin<void> = {
if (emission.level === 'WARNING') {
showDialog({
title: trans.__('Warning'),
body: trans.__(
`Two collaborative sessions are accessing the file %1 simultaneously.
\nOpening a document with multiple views simultaneously is not supported. Please close one view; otherwise, you might lose some of your progress.`,
emission.path
),
body: trans.__(TWO_SESSIONS_WARNING, emission.path),
buttons: [Dialog.warnButton({ label: trans.__('Ok') })]
});
}
Expand Down
Loading