Skip to content

Commit 204c010

Browse files
committed
Applied changes resquested by Enric.
1 parent 7391789 commit 204c010

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

SwanFileBrowser/src/swanfilebrowser.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22
// Author: Omar.Zapata@cern.ch 2021
33

44
/**
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.
67
*
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.
916
*/
1017

1118
import { FilterFileBrowserModel, FileBrowser } from '@jupyterlab/filebrowser';
@@ -34,11 +41,11 @@ export interface ISwanProjectOptions {
3441
* Customized SwanFileBrowserModel that inherits from FilterFileBrowserModel.
3542
*
3643
* 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:
3845
* 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
4047
* 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
4249
* to be configured again and the ProjectDialog is called.
4350
*/
4451
export class SwanFileBrowserModel extends FilterFileBrowserModel {
@@ -55,7 +62,7 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
5562
* Request to set the kernelspec manager path in the backend.
5663
* Local service manager.services.kernelspecs is updated as well.
5764
*
58-
* @param path path get information from jupyter api
65+
* @param path path to get information from jupyter api
5966
* @returns json object with the information of the path or json object with the information of the error.
6067
*/
6168
protected kernelSpecSetPathRequest(path: string): any {
@@ -105,7 +112,7 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
105112
* Request to get the project information
106113
*
107114
* @param path path to the project
108-
* @returns json object with the project information information.
115+
* @returns json object with the project information.
109116
*/
110117
protected projectInfoRequest(path: string): any {
111118
const uri = 'swan/project/info?caller=swanfilebrowser&path=' + path;
@@ -121,7 +128,7 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
121128
/**
122129
* Request to get contents from a path
123130
*
124-
* @param cwd path get information from jupyter api
131+
* @param cwd path to get information from jupyter api
125132
* @returns json object with the information of the path
126133
*/
127134
protected contentRequest(cwd: string): any {
@@ -139,8 +146,8 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
139146
/**
140147
* Method to check if the project information is valid or it is corrupted.
141148
*
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.
144151
*/
145152
protected isValidProject(project_data: JSONObject): boolean {
146153
for (const tag in this.project_tags) {
@@ -152,7 +159,7 @@ export class SwanFileBrowserModel extends FilterFileBrowserModel {
152159
}
153160

154161
/**
155-
* Overloaded method cd, to check folder information before go in.
162+
* Overloaded method cd, to check folder information before changing directory.
156163
*
157164
* @param newValue new path
158165
* @returns void promise.

0 commit comments

Comments
 (0)