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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,5 @@
import { Observable, of } from "rxjs";
import { AjaxRequest, AjaxResponse } from "rxjs/ajax";
import { ServerConfig } from "@nteract/types";
let fakeAjaxResponse: AjaxResponse = {
originalEvent: <Event>(<unknown>undefined),
@ -12,7 +11,7 @@ let fakeAjaxResponse: AjaxResponse = {
responseType: "json"
};
export const sessions = {
create: (serverConfig: ServerConfig, body: object): Observable<AjaxResponse> => of(fakeAjaxResponse),
create: (serverConfig: unknown, body: object): Observable<AjaxResponse> => of(fakeAjaxResponse),
__setResponse: (response: AjaxResponse) => {
fakeAjaxResponse = response;
},

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;

View File

@ -68,6 +68,8 @@
"./src/Explorer/Tables/DataTable/CacheBase.ts",
"./src/Explorer/Tables/Entities.ts",
"./src/Explorer/Tabs/TabComponents.ts",
"./src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts",
"./src/Explorer/Notebook/NotebookContentClient.ts",
"./src/GitHub/GitHubConnector.ts",
"./src/Index.ts",
"./src/NotebookWorkspaceManager/NotebookWorkspaceResourceProviderMockClients.ts",