From 9b841f4a4921561cd3356373da40ab1b8d8c14d3 Mon Sep 17 00:00:00 2001 From: brian-harris <61598682+brian-harris@users.noreply.github.com> Date: Fri, 17 Feb 2023 12:06:16 -0800 Subject: [PATCH] fix bug in dropdown auto-selection (#21977) --- .../src/wizard/targetSelectionPage.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/extensions/sql-migration/src/wizard/targetSelectionPage.ts b/extensions/sql-migration/src/wizard/targetSelectionPage.ts index 9ac75c2803..3f89fdf00a 100644 --- a/extensions/sql-migration/src/wizard/targetSelectionPage.ts +++ b/extensions/sql-migration/src/wizard/targetSelectionPage.ts @@ -266,16 +266,12 @@ export class TargetSelectionPage extends MigrationWizardPage { this.migrationStateModel._resourceGroup = undefined!; this.migrationStateModel._targetServerInstance = undefined!; - const clearDropDown = async (dropDown: azdata.DropDownComponent): Promise => { - dropDown.values = []; - dropDown.value = undefined; - }; - await clearDropDown(this._azureAccountsDropdown); - await clearDropDown(this._accountTenantDropdown); - await clearDropDown(this._azureSubscriptionDropdown); - await clearDropDown(this._azureLocationDropdown); - await clearDropDown(this._azureResourceGroupDropdown); - await clearDropDown(this._azureResourceDropdown); + this._clearDropDown(this._azureAccountsDropdown); + this._clearDropDown(this._accountTenantDropdown); + this._clearDropDown(this._azureSubscriptionDropdown); + this._clearDropDown(this._azureLocationDropdown); + this._clearDropDown(this._azureResourceGroupDropdown); + this._clearDropDown(this._azureResourceDropdown); } await this.populateAzureAccountsDropdown(); @@ -416,6 +412,7 @@ export class TargetSelectionPage extends MigrationWizardPage { : undefined!; this.migrationStateModel.refreshDatabaseBackupPage = true; } + this._clearDropDown(this._azureLocationDropdown); await this.populateLocationDropdown(); })); @@ -446,6 +443,7 @@ export class TargetSelectionPage extends MigrationWizardPage { : undefined!; } this.migrationStateModel.refreshDatabaseBackupPage = true; + this._clearDropDown(this._azureResourceGroupDropdown); await this.populateResourceGroupDropdown(); })); @@ -672,6 +670,7 @@ export class TargetSelectionPage extends MigrationWizardPage { ? utils.deepClone(selectedResourceGroup)! : undefined!; } + this._clearDropDown(this._azureResourceDropdown); await this.populateResourceInstanceDropdown(); })); @@ -1208,4 +1207,9 @@ export class TargetSelectionPage extends MigrationWizardPage { targetDatabaseCollation.length > 0 && sourceDatabaseCollation.toLocaleLowerCase() === targetDatabaseCollation.toLocaleLowerCase(); } + + private _clearDropDown(dropDown: azdata.DropDownComponent): void { + dropDown.values = []; + dropDown.value = undefined; + } }