mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 01:25:36 -05:00
Changes to avoid flickering and ensuring the target DB is always selected correctly even if corresponding source is not present (#14295)
This commit is contained in:
@@ -634,9 +634,12 @@ export class RestoreDialog extends Modal {
|
||||
}
|
||||
|
||||
private onSourceDatabaseChanged(selectedDatabase: string) {
|
||||
this.viewModel.sourceDatabaseName = selectedDatabase;
|
||||
this.viewModel.selectedBackupSets = undefined;
|
||||
this.validateRestore(true);
|
||||
// This check is to avoid any unnecessary even firing (to remove flickering)
|
||||
if (this.viewModel.sourceDatabaseName !== selectedDatabase) {
|
||||
this.viewModel.sourceDatabaseName = selectedDatabase;
|
||||
this.viewModel.selectedBackupSets = undefined;
|
||||
this.validateRestore(true);
|
||||
}
|
||||
}
|
||||
|
||||
private onRestoreFromChanged(selectedRestoreFrom: string) {
|
||||
|
||||
@@ -319,8 +319,9 @@ export class RestoreDialogController implements IRestoreDialogController {
|
||||
|
||||
if (this._currentProvider === ConnectionConstants.mssqlProviderName) {
|
||||
let restoreDialog = this._restoreDialogs[this._currentProvider] as RestoreDialog;
|
||||
restoreDialog.viewModel.resetRestoreOptions(connection.databaseName!);
|
||||
this.getMssqlRestoreConfigInfo().then(() => {
|
||||
// database list is filled only after getMssqlRestoreConfigInfo() calling before will always set to empty value
|
||||
restoreDialog.viewModel.resetRestoreOptions(connection.databaseName!, restoreDialog.viewModel.databaseList);
|
||||
restoreDialog.open(connection.serverName, this._ownerUri!);
|
||||
restoreDialog.validateRestore();
|
||||
}, restoreConfigError => {
|
||||
|
||||
@@ -245,13 +245,13 @@ export class RestoreViewModel {
|
||||
/**
|
||||
* Reset restore options to the default value
|
||||
*/
|
||||
public resetRestoreOptions(databaseName: string): void {
|
||||
public resetRestoreOptions(databaseName: string, databaseList: string[] = []): void {
|
||||
this.sourceDatabaseName = databaseName ? databaseName : '';
|
||||
this.updateTargetDatabaseName(databaseName);
|
||||
this.updateSourceDatabaseNames([], this.sourceDatabaseName);
|
||||
this.databaseList = databaseList;
|
||||
this.updateSourceDatabaseNames(this.databaseList, this.sourceDatabaseName);
|
||||
this.updateFilePath('');
|
||||
this.updateLastBackupTaken('');
|
||||
this.databaseList = [];
|
||||
this.selectedBackupSets = undefined;
|
||||
for (let key in this._optionsMap) {
|
||||
this._optionsMap[key].defaultValue = this.getDisplayValue(this._optionsMap[key].optionMetadata, this._optionsMap[key].optionMetadata.defaultValue);
|
||||
|
||||
Reference in New Issue
Block a user