From 281592fa974150ef8b32815cc57b25b6c36f7390 Mon Sep 17 00:00:00 2001 From: nasc17 <69922333+nasc17@users.noreply.github.com> Date: Wed, 28 Oct 2020 13:36:52 -0700 Subject: [PATCH] Cores and memory had needed request/limit commands switched, Workers needs to be checked for undefined (#13116) * Vores and memory had needed request/limit commands switched * If saving returns an error, leave discard button enable * Check if workers is undefined --- .../postgres/postgresComputeAndStoragePage.ts | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresComputeAndStoragePage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresComputeAndStoragePage.ts index 434cc3aa70..13ab79de93 100644 --- a/extensions/arc/src/ui/dashboards/postgres/postgresComputeAndStoragePage.ts +++ b/extensions/arc/src/ui/dashboards/postgres/postgresComputeAndStoragePage.ts @@ -160,10 +160,10 @@ export class PostgresComputeAndStoragePage extends DashboardPage { vscode.window.showInformationMessage(loc.instanceUpdated(this._postgresModel.info.name)); + this.discardButton!.enabled = false; + } catch (error) { vscode.window.showErrorMessage(loc.instanceUpdateFailed(this._postgresModel.info.name, error)); - } finally { - this.discardButton!.enabled = false; } })); @@ -223,9 +223,9 @@ export class PostgresComputeAndStoragePage extends DashboardPage { this.disposables.push( this.coresLimitBox!.onTextChanged(() => { if (!(this.handleOnTextChanged(this.coresLimitBox!))) { - this.saveArgs.coresRequest = undefined; + this.saveArgs.coresLimit = undefined; } else { - this.saveArgs.coresRequest = this.coresLimitBox!.value; + this.saveArgs.coresLimit = this.coresLimitBox!.value; } }) ); @@ -241,9 +241,9 @@ export class PostgresComputeAndStoragePage extends DashboardPage { this.disposables.push( this.coresRequestBox!.onTextChanged(() => { if (!(this.handleOnTextChanged(this.coresRequestBox!))) { - this.saveArgs.coresLimit = undefined; + this.saveArgs.coresRequest = undefined; } else { - this.saveArgs.coresLimit = this.coresRequestBox!.value; + this.saveArgs.coresRequest = this.coresRequestBox!.value; } }) ); @@ -259,9 +259,9 @@ export class PostgresComputeAndStoragePage extends DashboardPage { this.disposables.push( this.memoryLimitBox!.onTextChanged(() => { if (!(this.handleOnTextChanged(this.memoryLimitBox!))) { - this.saveArgs.memoryRequest = undefined; + this.saveArgs.memoryLimit = undefined; } else { - this.saveArgs.memoryRequest = this.memoryLimitBox!.value + 'Gi'; + this.saveArgs.memoryLimit = this.memoryLimitBox!.value + 'Gi'; } }) ); @@ -277,9 +277,9 @@ export class PostgresComputeAndStoragePage extends DashboardPage { this.disposables.push( this.memoryRequestBox!.onTextChanged(() => { if (!(this.handleOnTextChanged(this.memoryRequestBox!))) { - this.saveArgs.memoryLimit = undefined; + this.saveArgs.memoryRequest = undefined; } else { - this.saveArgs.memoryLimit = this.memoryRequestBox!.value + 'Gi'; + this.saveArgs.memoryRequest = this.memoryRequestBox!.value + 'Gi'; } }) ); @@ -389,10 +389,15 @@ export class PostgresComputeAndStoragePage extends DashboardPage { private editWorkerNodeCount() { let currentShards = this._postgresModel.config?.spec.scale.shards; - this.workerBox!.min = currentShards; - this.workerBox!.placeHolder = currentShards!.toString(); - this.workerBox!.value = ''; + if (!currentShards) { + this.workerBox!.min = 0; + this.workerBox!.placeHolder = ''; + } else { + this.workerBox!.min = currentShards; + this.workerBox!.placeHolder = currentShards!.toString(); + } + this.workerBox!.value = ''; this.saveArgs.workers = undefined; }