Add two files of notebook component in Matser (#363)

* “minor changes”
This commit is contained in:
Chris-MS-896
2021-01-12 12:55:21 -06:00
committed by GitHub
parent 9247a6c4a2
commit b1ad80480e
3 changed files with 11 additions and 7 deletions

View File

@@ -11,7 +11,7 @@ import { stringifyNotebook } from "@nteract/commutable";
export class NotebookContentClient {
constructor(
private notebookServerInfo: ko.Observable<DataModels.NotebookWorkspaceConnectionInfo>,
private notebookBasePath: ko.Observable<string>,
public notebookBasePath: ko.Observable<string>,
private contentProvider: IContentProvider
) {}
@@ -117,8 +117,11 @@ export class NotebookContentClient {
private async checkIfFilepathExists(filepath: string): Promise<boolean> {
const parentDirPath = NotebookUtil.getParentPath(filepath);
const items = await this.fetchNotebookFiles(parentDirPath);
return items.some(value => FileSystemUtil.isPathEqual(value.path, filepath));
if (parentDirPath) {
const items = await this.fetchNotebookFiles(parentDirPath);
return items.some(value => FileSystemUtil.isPathEqual(value.path, filepath));
}
return false;
}
/**
@@ -189,7 +192,7 @@ export class NotebookContentClient {
const dir = xhr.response;
const item = NotebookUtil.createNotebookContentItem(dir.name, dir.path, dir.type);
item.parent = parent;
parent.children.push(item);
parent.children!.push(item);
return item;
});
}
@@ -225,7 +228,7 @@ export class NotebookContentClient {
* Convert rx-jupyter type to our type
* @param type
*/
private static getType(type: FileType): NotebookContentItemType {
public static getType(type: FileType): NotebookContentItemType {
switch (type) {
case "directory":
return NotebookContentItemType.Directory;