Added notebookServerInfo

This commit is contained in:
Srinath Narayanan 2021-08-22 12:38:15 -07:00
parent c0bd74ce1b
commit 78e5c88e3c
2 changed files with 6 additions and 19 deletions

View File

@ -465,7 +465,6 @@ export default class Explorer {
*/ */
const provisionData = { const provisionData = {
cosmosKey: userContext.masterKey,
cosmosEndpoint: userContext.databaseAccount.properties.documentEndpoint, cosmosEndpoint: userContext.databaseAccount.properties.documentEndpoint,
resourceId: userContext.databaseAccount.id, resourceId: userContext.databaseAccount.id,
dbAccountName: userContext.databaseAccount.name, dbAccountName: userContext.databaseAccount.name,
@ -480,25 +479,11 @@ export default class Explorer {
}, },
body: JSON.stringify(provisionData) body: JSON.stringify(provisionData)
}) })
const websocketId = await response.text(); var notebookServerInfo = await response.json();
const unprovisionData = {
resourceId: userContext.databaseAccount.id,
websocketId: websocketId
}
window.addEventListener("beforeunload", async () => {
const response = await window.fetch("http://localhost:443/api/containerpooling/unprovision", {
method: "POST",
headers: {
[HttpHeaders.contentType]: "application/json",
},
body: JSON.stringify(unprovisionData)
})
})
this.notebookServerInfo({ this.notebookServerInfo({
notebookServerEndpoint: userContext.features.notebookServerUrl || `http://localhost:443/api/containerpooling/resid${userContext.databaseAccount.id}/forward/`, notebookServerEndpoint: userContext.features.notebookServerUrl || `http://localhost:443/api/containerpooling/${notebookServerInfo.forwardingId}/forward/`,
authToken: userContext.features.notebookServerToken || "token", authToken: userContext.features.notebookServerToken || notebookServerInfo.notebookServerToken,
}); });
this.notebookServerInfo.valueHasMutated(); this.notebookServerInfo.valueHasMutated();
this.refreshNotebookList(); this.refreshNotebookList();

View File

@ -255,7 +255,9 @@ export class NotebookContentClient {
private fetchNotebookFiles(path: string): Promise<NotebookContentItem[]> { private fetchNotebookFiles(path: string): Promise<NotebookContentItem[]> {
return this.contentProvider return this.contentProvider
.get(this.getServerConfig(), path + "/directory", {}) .get(this.getServerConfig(), path, {
type: "directory",
})
.toPromise() .toPromise()
.then((xhr) => { .then((xhr) => {
if (xhr.status !== 200) { if (xhr.status !== 200) {