mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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) {
|
private onSourceDatabaseChanged(selectedDatabase: string) {
|
||||||
this.viewModel.sourceDatabaseName = selectedDatabase;
|
// This check is to avoid any unnecessary even firing (to remove flickering)
|
||||||
this.viewModel.selectedBackupSets = undefined;
|
if (this.viewModel.sourceDatabaseName !== selectedDatabase) {
|
||||||
this.validateRestore(true);
|
this.viewModel.sourceDatabaseName = selectedDatabase;
|
||||||
|
this.viewModel.selectedBackupSets = undefined;
|
||||||
|
this.validateRestore(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onRestoreFromChanged(selectedRestoreFrom: string) {
|
private onRestoreFromChanged(selectedRestoreFrom: string) {
|
||||||
|
|||||||
@@ -319,8 +319,9 @@ export class RestoreDialogController implements IRestoreDialogController {
|
|||||||
|
|
||||||
if (this._currentProvider === ConnectionConstants.mssqlProviderName) {
|
if (this._currentProvider === ConnectionConstants.mssqlProviderName) {
|
||||||
let restoreDialog = this._restoreDialogs[this._currentProvider] as RestoreDialog;
|
let restoreDialog = this._restoreDialogs[this._currentProvider] as RestoreDialog;
|
||||||
restoreDialog.viewModel.resetRestoreOptions(connection.databaseName!);
|
|
||||||
this.getMssqlRestoreConfigInfo().then(() => {
|
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.open(connection.serverName, this._ownerUri!);
|
||||||
restoreDialog.validateRestore();
|
restoreDialog.validateRestore();
|
||||||
}, restoreConfigError => {
|
}, restoreConfigError => {
|
||||||
|
|||||||
@@ -245,13 +245,13 @@ export class RestoreViewModel {
|
|||||||
/**
|
/**
|
||||||
* Reset restore options to the default value
|
* Reset restore options to the default value
|
||||||
*/
|
*/
|
||||||
public resetRestoreOptions(databaseName: string): void {
|
public resetRestoreOptions(databaseName: string, databaseList: string[] = []): void {
|
||||||
this.sourceDatabaseName = databaseName ? databaseName : '';
|
this.sourceDatabaseName = databaseName ? databaseName : '';
|
||||||
this.updateTargetDatabaseName(databaseName);
|
this.updateTargetDatabaseName(databaseName);
|
||||||
this.updateSourceDatabaseNames([], this.sourceDatabaseName);
|
this.databaseList = databaseList;
|
||||||
|
this.updateSourceDatabaseNames(this.databaseList, this.sourceDatabaseName);
|
||||||
this.updateFilePath('');
|
this.updateFilePath('');
|
||||||
this.updateLastBackupTaken('');
|
this.updateLastBackupTaken('');
|
||||||
this.databaseList = [];
|
|
||||||
this.selectedBackupSets = undefined;
|
this.selectedBackupSets = undefined;
|
||||||
for (let key in this._optionsMap) {
|
for (let key in this._optionsMap) {
|
||||||
this._optionsMap[key].defaultValue = this.getDisplayValue(this._optionsMap[key].optionMetadata, this._optionsMap[key].optionMetadata.defaultValue);
|
this._optionsMap[key].defaultValue = this.getDisplayValue(this._optionsMap[key].optionMetadata, this._optionsMap[key].optionMetadata.defaultValue);
|
||||||
|
|||||||
Reference in New Issue
Block a user