Skip to content

Commit

Permalink
Updates warning message on double file open (#375)
Browse files Browse the repository at this point in the history
* Updates warning message, refactors

* Removes newlines, which are ignored

* Clarifies two separate views

* Update packages/docprovider-extension/src/filebrowser.ts

Co-authored-by: David Brochart <[email protected]>

---------

Co-authored-by: David Brochart <[email protected]>
  • Loading branch information
JasonWeill and davidbrochart authored Oct 17, 2024
1 parent b3d8d29 commit c809930
Showing 1 changed file with 7 additions and 9 deletions.
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

0 comments on commit c809930

Please sign in to comment.