File tree Expand file tree Collapse file tree 4 files changed +36
-5
lines changed Expand file tree Collapse file tree 4 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,19 @@ import { nullTranslator } from '@jupyterlab/translation';
1111import { ICollaborativeDrive } from './tokens' ;
1212import { Dialog , showDialog } from '@jupyterlab/apputils' ;
1313
14+ /**
15+ * Notebook cell executor posting a request to the server for execution.
16+ */
1417export class NotebookCellServerExecutor implements INotebookCellExecutor {
1518 private _contents : Contents . IManager ;
1619 private _drive : ICollaborativeDrive ;
1720 private _serverSettings : ServerConnection . ISettings ;
1821
22+ /**
23+ * Constructor
24+ *
25+ * @param options Constructor options; the contents manager, the collaborative drive and optionally the server settings.
26+ */
1927 constructor ( options : {
2028 contents : Contents . IManager ;
2129 drive : ICollaborativeDrive ;
@@ -27,6 +35,12 @@ export class NotebookCellServerExecutor implements INotebookCellExecutor {
2735 options . serverSettings ?? ServerConnection . makeSettings ( ) ;
2836 }
2937
38+ /**
39+ * Execute a given cell of the notebook.
40+ *
41+ * @param options Execution options
42+ * @returns Execution success status
43+ */
3044 async runCell ( {
3145 cell,
3246 notebook,
Original file line number Diff line number Diff line change @@ -23,7 +23,10 @@ export type SharedDocumentFactory = (
2323 options : Contents . ISharedFactoryOptions
2424) => YDocument < DocumentChange > ;
2525
26- export interface IRoomNameOptions {
26+ /**
27+ * Options needed to build the room name for a file metadata.
28+ */
29+ export interface IFileMetadata {
2730 /**
2831 * Document format; 'text', 'base64',...
2932 */
@@ -43,7 +46,12 @@ export interface IRoomNameOptions {
4346 * server using the Jupyter REST API and a WebSocket connection.
4447 */
4548export interface ICollaborativeDrive extends Contents . IDrive {
46- getRoomName ( options : IRoomNameOptions ) : string | null ;
49+ /**
50+ * Get a room name for a given file.
51+ *
52+ * @param metadata File metadata
53+ */
54+ getRoomName ( metadata : IFileMetadata ) : string | null ;
4755 /**
4856 * SharedModel factory for the YDrive.
4957 */
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
1212 ICollaborativeDrive ,
1313 ISharedModelFactory ,
1414 SharedDocumentFactory ,
15- type IRoomNameOptions
15+ type IFileMetadata
1616} from './tokens' ;
1717
1818const DISABLE_RTC =
@@ -94,8 +94,14 @@ export class YDrive extends Drive implements ICollaborativeDrive {
9494 return super . get ( localPath , options ) ;
9595 }
9696
97- getRoomName ( options : IRoomNameOptions ) : string | null {
98- const key = `${ options . format } :${ options . type } :${ options . localPath } ` ;
97+ /**
98+ * Get a room name for a given file.
99+ *
100+ * @param metadata File metadata
101+ */
102+ getRoomName ( metadata : IFileMetadata ) : string | null {
103+ // FIXME we have issue with that key in case of file rename
104+ const key = `${ metadata . format } :${ metadata . type } :${ metadata . localPath } ` ;
99105 const provider = this . _providers . get ( key ) ;
100106 return provider ?. roomName ?? null ;
101107 }
Original file line number Diff line number Diff line change @@ -77,6 +77,9 @@ export class WebSocketProvider implements IDocumentProvider {
7777 return this . _ready . promise ;
7878 }
7979
80+ /**
81+ * Room name
82+ */
8083 get roomName ( ) : string | null {
8184 return this . _yWebsocketProvider ?. roomname ?? null ;
8285 }
You can’t perform that action at this time.
0 commit comments