parent
9247a6c4a2
commit
b1ad80480e
|
@ -1,6 +1,5 @@
|
||||||
import { Observable, of } from "rxjs";
|
import { Observable, of } from "rxjs";
|
||||||
import { AjaxRequest, AjaxResponse } from "rxjs/ajax";
|
import { AjaxRequest, AjaxResponse } from "rxjs/ajax";
|
||||||
import { ServerConfig } from "@nteract/types";
|
|
||||||
|
|
||||||
let fakeAjaxResponse: AjaxResponse = {
|
let fakeAjaxResponse: AjaxResponse = {
|
||||||
originalEvent: <Event>(<unknown>undefined),
|
originalEvent: <Event>(<unknown>undefined),
|
||||||
|
@ -12,7 +11,7 @@ let fakeAjaxResponse: AjaxResponse = {
|
||||||
responseType: "json"
|
responseType: "json"
|
||||||
};
|
};
|
||||||
export const sessions = {
|
export const sessions = {
|
||||||
create: (serverConfig: ServerConfig, body: object): Observable<AjaxResponse> => of(fakeAjaxResponse),
|
create: (serverConfig: unknown, body: object): Observable<AjaxResponse> => of(fakeAjaxResponse),
|
||||||
__setResponse: (response: AjaxResponse) => {
|
__setResponse: (response: AjaxResponse) => {
|
||||||
fakeAjaxResponse = response;
|
fakeAjaxResponse = response;
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { stringifyNotebook } from "@nteract/commutable";
|
||||||
export class NotebookContentClient {
|
export class NotebookContentClient {
|
||||||
constructor(
|
constructor(
|
||||||
private notebookServerInfo: ko.Observable<DataModels.NotebookWorkspaceConnectionInfo>,
|
private notebookServerInfo: ko.Observable<DataModels.NotebookWorkspaceConnectionInfo>,
|
||||||
private notebookBasePath: ko.Observable<string>,
|
public notebookBasePath: ko.Observable<string>,
|
||||||
private contentProvider: IContentProvider
|
private contentProvider: IContentProvider
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@ -117,8 +117,11 @@ export class NotebookContentClient {
|
||||||
|
|
||||||
private async checkIfFilepathExists(filepath: string): Promise<boolean> {
|
private async checkIfFilepathExists(filepath: string): Promise<boolean> {
|
||||||
const parentDirPath = NotebookUtil.getParentPath(filepath);
|
const parentDirPath = NotebookUtil.getParentPath(filepath);
|
||||||
const items = await this.fetchNotebookFiles(parentDirPath);
|
if (parentDirPath) {
|
||||||
return items.some(value => FileSystemUtil.isPathEqual(value.path, filepath));
|
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 dir = xhr.response;
|
||||||
const item = NotebookUtil.createNotebookContentItem(dir.name, dir.path, dir.type);
|
const item = NotebookUtil.createNotebookContentItem(dir.name, dir.path, dir.type);
|
||||||
item.parent = parent;
|
item.parent = parent;
|
||||||
parent.children.push(item);
|
parent.children!.push(item);
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -225,7 +228,7 @@ export class NotebookContentClient {
|
||||||
* Convert rx-jupyter type to our type
|
* Convert rx-jupyter type to our type
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
private static getType(type: FileType): NotebookContentItemType {
|
public static getType(type: FileType): NotebookContentItemType {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "directory":
|
case "directory":
|
||||||
return NotebookContentItemType.Directory;
|
return NotebookContentItemType.Directory;
|
||||||
|
|
|
@ -68,6 +68,8 @@
|
||||||
"./src/Explorer/Tables/DataTable/CacheBase.ts",
|
"./src/Explorer/Tables/DataTable/CacheBase.ts",
|
||||||
"./src/Explorer/Tables/Entities.ts",
|
"./src/Explorer/Tables/Entities.ts",
|
||||||
"./src/Explorer/Tabs/TabComponents.ts",
|
"./src/Explorer/Tabs/TabComponents.ts",
|
||||||
|
"./src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts",
|
||||||
|
"./src/Explorer/Notebook/NotebookContentClient.ts",
|
||||||
"./src/GitHub/GitHubConnector.ts",
|
"./src/GitHub/GitHubConnector.ts",
|
||||||
"./src/Index.ts",
|
"./src/Index.ts",
|
||||||
"./src/NotebookWorkspaceManager/NotebookWorkspaceResourceProviderMockClients.ts",
|
"./src/NotebookWorkspaceManager/NotebookWorkspaceResourceProviderMockClients.ts",
|
||||||
|
|
Loading…
Reference in New Issue