From a133134b8b4c6dcff7ddf8521cecdc2370cb86b6 Mon Sep 17 00:00:00 2001 From: victor-meng <56978073+victor-meng@users.noreply.github.com> Date: Mon, 9 Nov 2020 15:22:51 -0800 Subject: [PATCH] Fix create and delete database (#317) --- src/Explorer/Panes/AddDatabasePane.ts | 10 +++++++--- src/Utils/arm/request.ts | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Explorer/Panes/AddDatabasePane.ts b/src/Explorer/Panes/AddDatabasePane.ts index 2010a1c60..c47b36e7e 100644 --- a/src/Explorer/Panes/AddDatabasePane.ts +++ b/src/Explorer/Panes/AddDatabasePane.ts @@ -296,12 +296,16 @@ export default class AddDatabasePane extends ContextualPaneBase { this.isExecuting(true); const createDatabaseParams: DataModels.CreateDatabaseParams = { - autoPilotMaxThroughput: this.maxAutoPilotThroughputSet(), databaseId: addDatabasePaneStartMessage.database.id, - databaseLevelThroughput: addDatabasePaneStartMessage.database.shared, - offerThroughput: addDatabasePaneStartMessage.offerThroughput + databaseLevelThroughput: addDatabasePaneStartMessage.database.shared }; + if (this.isAutoPilotSelected()) { + createDatabaseParams.autoPilotMaxThroughput = this.maxAutoPilotThroughputSet(); + } else { + createDatabaseParams.offerThroughput = addDatabasePaneStartMessage.offerThroughput; + } + createDatabase(createDatabaseParams).then( (database: DataModels.Database) => { this._onCreateDatabaseSuccess(offerThroughput, startKey); diff --git a/src/Utils/arm/request.ts b/src/Utils/arm/request.ts index e40e38b8f..443ec9c44 100644 --- a/src/Utils/arm/request.ts +++ b/src/Utils/arm/request.ts @@ -93,6 +93,10 @@ async function getOperationStatus(operationStatusUrl: string) { throw new AbortError(error); } + if (response.status === 204) { + return; + } + const body = await response.json(); const status = body.status; if (!status && response.status === 200) {