parent
9247a6c4a2
commit
b1ad80480e
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue