Fixed 'UI hanging on clearing dropdown error' for database backup page (#16541)

This PR fixes
ADS UI - Clear resource group drop down box and click Next on the Database Backup Wizard - Cannot read property 'displayName' ERROR
This commit is contained in:
goyal-anjali
2021-08-04 10:42:08 +05:30
committed by GitHub
parent e2dd257fa9
commit 6985d95300

View File

@@ -573,12 +573,14 @@ export class DatabaseBackupPage extends MigrationWizardPage {
'font-weight': 'bold' 'font-weight': 'bold'
} }
}).component(); }).component();
this._networkShareStorageAccountResourceGroupDropdown = this._view.modelBuilder.dropDown().withProps({ this._networkShareStorageAccountResourceGroupDropdown = this._view.modelBuilder.dropDown()
ariaLabel: constants.RESOURCE_GROUP, .withProps({
width: WIZARD_INPUT_COMPONENT_WIDTH, required: true,
editable: true, ariaLabel: constants.RESOURCE_GROUP,
fireOnTextChange: true, width: WIZARD_INPUT_COMPONENT_WIDTH,
}).component(); editable: true,
fireOnTextChange: true,
}).component();
this._disposables.push(this._networkShareStorageAccountResourceGroupDropdown.onValueChanged(async (value) => { this._disposables.push(this._networkShareStorageAccountResourceGroupDropdown.onValueChanged(async (value) => {
const selectedIndex = findDropDownItemIndex(this._networkShareStorageAccountResourceGroupDropdown, value); const selectedIndex = findDropDownItemIndex(this._networkShareStorageAccountResourceGroupDropdown, value);
if (selectedIndex > -1) { if (selectedIndex > -1) {
@@ -883,10 +885,10 @@ export class DatabaseBackupPage extends MigrationWizardPage {
switch (this.migrationStateModel._databaseBackup.networkContainerType) { switch (this.migrationStateModel._databaseBackup.networkContainerType) {
case NetworkContainerType.NETWORK_SHARE: case NetworkContainerType.NETWORK_SHARE:
if ((<azdata.CategoryValue>this._networkShareStorageAccountResourceGroupDropdown.value).displayName === constants.RESOURCE_GROUP_NOT_FOUND) { if ((<azdata.CategoryValue>this._networkShareStorageAccountResourceGroupDropdown.value)?.displayName === constants.RESOURCE_GROUP_NOT_FOUND) {
errors.push(constants.INVALID_RESOURCE_GROUP_ERROR); errors.push(constants.INVALID_RESOURCE_GROUP_ERROR);
} }
if ((<azdata.CategoryValue>this._networkShareContainerStorageAccountDropdown.value).displayName === constants.NO_STORAGE_ACCOUNT_FOUND) { if ((<azdata.CategoryValue>this._networkShareContainerStorageAccountDropdown.value)?.displayName === constants.NO_STORAGE_ACCOUNT_FOUND) {
errors.push(constants.INVALID_STORAGE_ACCOUNT_ERROR); errors.push(constants.INVALID_STORAGE_ACCOUNT_ERROR);
} }
break; break;