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
This commit is contained in:
nasc17
2020-10-28 13:36:52 -07:00
committed by GitHub
parent dccccd0110
commit 281592fa97

View File

@@ -160,10 +160,10 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
vscode.window.showInformationMessage(loc.instanceUpdated(this._postgresModel.info.name)); vscode.window.showInformationMessage(loc.instanceUpdated(this._postgresModel.info.name));
this.discardButton!.enabled = false;
} catch (error) { } catch (error) {
vscode.window.showErrorMessage(loc.instanceUpdateFailed(this._postgresModel.info.name, 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.disposables.push(
this.coresLimitBox!.onTextChanged(() => { this.coresLimitBox!.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.coresLimitBox!))) { if (!(this.handleOnTextChanged(this.coresLimitBox!))) {
this.saveArgs.coresRequest = undefined; this.saveArgs.coresLimit = undefined;
} else { } 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.disposables.push(
this.coresRequestBox!.onTextChanged(() => { this.coresRequestBox!.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.coresRequestBox!))) { if (!(this.handleOnTextChanged(this.coresRequestBox!))) {
this.saveArgs.coresLimit = undefined; this.saveArgs.coresRequest = undefined;
} else { } 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.disposables.push(
this.memoryLimitBox!.onTextChanged(() => { this.memoryLimitBox!.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.memoryLimitBox!))) { if (!(this.handleOnTextChanged(this.memoryLimitBox!))) {
this.saveArgs.memoryRequest = undefined; this.saveArgs.memoryLimit = undefined;
} else { } 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.disposables.push(
this.memoryRequestBox!.onTextChanged(() => { this.memoryRequestBox!.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.memoryRequestBox!))) { if (!(this.handleOnTextChanged(this.memoryRequestBox!))) {
this.saveArgs.memoryLimit = undefined; this.saveArgs.memoryRequest = undefined;
} else { } 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() { private editWorkerNodeCount() {
let currentShards = this._postgresModel.config?.spec.scale.shards; let currentShards = this._postgresModel.config?.spec.scale.shards;
this.workerBox!.min = currentShards; if (!currentShards) {
this.workerBox!.placeHolder = currentShards!.toString(); this.workerBox!.min = 0;
this.workerBox!.value = ''; this.workerBox!.placeHolder = '';
} else {
this.workerBox!.min = currentShards;
this.workerBox!.placeHolder = currentShards!.toString();
}
this.workerBox!.value = '';
this.saveArgs.workers = undefined; this.saveArgs.workers = undefined;
} }