Fixing the update issue with backup default name (#15082)

* Fixing the update issue with backup default name

* Avoiding to call select again since that fires an event

* Fixing comment and backup name
This commit is contained in:
Udeesha Gautam
2021-04-30 10:50:26 -07:00
committed by GitHub
parent adbbe7e6b0
commit f2ee8b11b4
2 changed files with 11 additions and 2 deletions

View File

@@ -216,6 +216,14 @@ export class SelectBox extends vsSelectBox {
let selectOptions: SelectOptionItemSQL[] = SelectBox.createOptions(options); let selectOptions: SelectOptionItemSQL[] = SelectBox.createOptions(options);
this.populateOptionsDictionary(selectOptions); this.populateOptionsDictionary(selectOptions);
super.setOptions(selectOptions, selected); super.setOptions(selectOptions, selected);
// Adding following since setOptions from super alone is not setting this._selectedOption
let selectedOptionIndex = this._optionsDictionary.get(this._selectedOption);
if (selectedOptionIndex === selected) {
return;
}
if (this._dialogOptions !== undefined) {
this._selectedOption = this._dialogOptions[selected]?.value;
}
} }
public get value(): string { public get value(): string {

View File

@@ -740,9 +740,10 @@ export class BackupComponent extends AngularDisposable {
} }
private setDefaultBackupName(): void { private setDefaultBackupName(): void {
if (this.backupNameBox && (!this.backupNameBox.value || this.backupNameBox.value.trim().length === 0)) { const suggestedNamePrefix = this.databaseName + '-' + this.getSelectedBackupType().replace(' ', '-');
if (this.backupNameBox && (!this.backupNameBox.value || this.backupNameBox.value.trim().length === 0 || !this.backupNameBox.value.startsWith(suggestedNamePrefix))) {
let utc = new Date().toJSON().slice(0, 19); let utc = new Date().toJSON().slice(0, 19);
this.backupNameBox.value = this.databaseName + '-' + this.getSelectedBackupType() + '-' + utc; this.backupNameBox.value = suggestedNamePrefix + '-' + utc;
} }
} }