2
2
// Author: Omar.Zapata@cern .ch 2021
3
3
4
4
/**
5
- * This file containts the implementation for SwanFileBrowser and SwanFileBrowserModel classes.
5
+ * This file contains the implementation for SwanFileBrowser and SwanFileBrowserModel classes.
6
+ * The code in this file is mainly from us.
6
7
*
7
- * Those classes are the replacement for the default FileBrowser and allows to
8
- * manipulated the paths to check if the folder is a project or not and to set the proper kernel path.
8
+ * Those classes are the replacement for the default FileBrowser and allow to
9
+ * manipulate the paths to check if the folder is a project or not and to set the proper kernel path.
10
+ *
11
+ * Modifications on this file:
12
+ * -> created the class SwanFileBrowserModel that extends from FilterFileBrowserModel
13
+ * -> created the class SwanFileBrowser extends from FileBrowser
14
+ *
15
+ * All new methods were implemented by us, take a look in the documentation below for every class and method for more details.
9
16
*/
10
17
11
18
import { FilterFileBrowserModel , FileBrowser } from '@jupyterlab/filebrowser' ;
@@ -34,11 +41,11 @@ export interface ISwanProjectOptions {
34
41
* Customized SwanFileBrowserModel that inherits from FilterFileBrowserModel.
35
42
*
36
43
* This class has overloaded the method 'async cd(newValue: string): Promise<void>'
37
- * that a allows to take actions before go to the directory, actions like:
44
+ * that allows to take actions before changing directory, actions like:
38
45
* 1) Get the contents of the folder (to check if the folder is a project)
39
- * 2) If the folder is a project we can ge the information of the project stored in the .swanproject
46
+ * 2) If the folder is a project we can get the information of the project stored in the .swanproject
40
47
* 3) if the information for the project is right then we can set the kernel spec manager
41
- * 4) If the project is corrupted, the a Dialog is showed up telling the user the project requires
48
+ * 4) If the project is corrupted, the Dialog is showed up telling the user the project requires
42
49
* to be configured again and the ProjectDialog is called.
43
50
*/
44
51
export class SwanFileBrowserModel extends FilterFileBrowserModel {
@@ -55,7 +62,7 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
55
62
* Request to set the kernelspec manager path in the backend.
56
63
* Local service manager.services.kernelspecs is updated as well.
57
64
*
58
- * @param path path get information from jupyter api
65
+ * @param path path to get information from jupyter api
59
66
* @returns json object with the information of the path or json object with the information of the error.
60
67
*/
61
68
protected kernelSpecSetPathRequest ( path : string ) : any {
@@ -105,7 +112,7 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
105
112
* Request to get the project information
106
113
*
107
114
* @param path path to the project
108
- * @returns json object with the project information information .
115
+ * @returns json object with the project information.
109
116
*/
110
117
protected projectInfoRequest ( path : string ) : any {
111
118
const uri = 'swan/project/info?caller=swanfilebrowser&path=' + path ;
@@ -121,7 +128,7 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
121
128
/**
122
129
* Request to get contents from a path
123
130
*
124
- * @param cwd path get information from jupyter api
131
+ * @param cwd path to get information from jupyter api
125
132
* @returns json object with the information of the path
126
133
*/
127
134
protected contentRequest ( cwd : string ) : any {
@@ -139,8 +146,8 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
139
146
/**
140
147
* Method to check if the project information is valid or it is corrupted.
141
148
*
142
- * @param project_data json with project data such as name, stack, release etc..
143
- * @returns true if the project is valid or false it the project is corrupted.
149
+ * @param project_data json with project data such as name, stack, release etc.
150
+ * @returns true if the project is valid or false if the project is corrupted.
144
151
*/
145
152
protected isValidProject ( project_data : JSONObject ) : boolean {
146
153
for ( const tag in this . project_tags ) {
@@ -152,7 +159,7 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
152
159
}
153
160
154
161
/**
155
- * Overloaded method cd, to check folder information before go in .
162
+ * Overloaded method cd, to check folder information before changing directory .
156
163
*
157
164
* @param newValue new path
158
165
* @returns void promise.
0 commit comments