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';
11
11
import { ICollaborativeDrive } from './tokens' ;
12
12
import { Dialog , showDialog } from '@jupyterlab/apputils' ;
13
13
14
+ /**
15
+ * Notebook cell executor posting a request to the server for execution.
16
+ */
14
17
export class NotebookCellServerExecutor implements INotebookCellExecutor {
15
18
private _contents : Contents . IManager ;
16
19
private _drive : ICollaborativeDrive ;
17
20
private _serverSettings : ServerConnection . ISettings ;
18
21
22
+ /**
23
+ * Constructor
24
+ *
25
+ * @param options Constructor options; the contents manager, the collaborative drive and optionally the server settings.
26
+ */
19
27
constructor ( options : {
20
28
contents : Contents . IManager ;
21
29
drive : ICollaborativeDrive ;
@@ -27,6 +35,12 @@ export class NotebookCellServerExecutor implements INotebookCellExecutor {
27
35
options . serverSettings ?? ServerConnection . makeSettings ( ) ;
28
36
}
29
37
38
+ /**
39
+ * Execute a given cell of the notebook.
40
+ *
41
+ * @param options Execution options
42
+ * @returns Execution success status
43
+ */
30
44
async runCell ( {
31
45
cell,
32
46
notebook,
Original file line number Diff line number Diff line change @@ -23,7 +23,10 @@ export type SharedDocumentFactory = (
23
23
options : Contents . ISharedFactoryOptions
24
24
) => YDocument < DocumentChange > ;
25
25
26
- export interface IRoomNameOptions {
26
+ /**
27
+ * Options needed to build the room name for a file metadata.
28
+ */
29
+ export interface IFileMetadata {
27
30
/**
28
31
* Document format; 'text', 'base64',...
29
32
*/
@@ -43,7 +46,12 @@ export interface IRoomNameOptions {
43
46
* server using the Jupyter REST API and a WebSocket connection.
44
47
*/
45
48
export 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 ;
47
55
/**
48
56
* SharedModel factory for the YDrive.
49
57
*/
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
12
12
ICollaborativeDrive ,
13
13
ISharedModelFactory ,
14
14
SharedDocumentFactory ,
15
- type IRoomNameOptions
15
+ type IFileMetadata
16
16
} from './tokens' ;
17
17
18
18
const DISABLE_RTC =
@@ -94,8 +94,14 @@ export class YDrive extends Drive implements ICollaborativeDrive {
94
94
return super . get ( localPath , options ) ;
95
95
}
96
96
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 } ` ;
99
105
const provider = this . _providers . get ( key ) ;
100
106
return provider ?. roomName ?? null ;
101
107
}
Original file line number Diff line number Diff line change @@ -77,6 +77,9 @@ export class WebSocketProvider implements IDocumentProvider {
77
77
return this . _ready . promise ;
78
78
}
79
79
80
+ /**
81
+ * Room name
82
+ */
80
83
get roomName ( ) : string | null {
81
84
return this . _yWebsocketProvider ?. roomname ?? null ;
82
85
}
You can’t perform that action at this time.
0 commit comments