Archived
Tenant selction bug (#23349)
This commit is contained in:
@@ -327,6 +327,8 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
} else {
|
||||
this.migrationStateModel._sqlMigrationServiceSubscription = undefined!;
|
||||
}
|
||||
|
||||
utils.clearDropDown(this._resourceGroupDropdown);
|
||||
await this.loadResourceGroupDropdown();
|
||||
}));
|
||||
|
||||
@@ -370,6 +372,7 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
else {
|
||||
this.migrationStateModel._sqlMigrationServiceResourceGroup = undefined!;
|
||||
}
|
||||
utils.clearDropDown(this._dmsDropdown);
|
||||
this.loadDmsDropdown();
|
||||
}));
|
||||
|
||||
@@ -523,7 +526,8 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
try {
|
||||
this._subscriptionDropdown.loading = true;
|
||||
this.migrationStateModel._subscriptions = await utils.getAzureSubscriptions(
|
||||
this.migrationStateModel._azureAccount);
|
||||
this.migrationStateModel._azureAccount,
|
||||
this.migrationStateModel._azureTenant?.id);
|
||||
|
||||
const sub = this.migrationStateModel._sqlMigrationServiceSubscription
|
||||
?? this.migrationStateModel._targetSubscription;
|
||||
|
||||
@@ -374,10 +374,11 @@ export class LoginMigrationTargetSelectionPage extends MigrationWizardPage {
|
||||
this._azureAccountsDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== 'undefined') {
|
||||
const selectedAccount = this.migrationStateModel._azureAccounts.find(account => account.displayInfo.displayName === value);
|
||||
this.migrationStateModel._azureAccount = (selectedAccount)
|
||||
this.migrationStateModel._azureAccount = selectedAccount
|
||||
? utils.deepClone(selectedAccount)!
|
||||
: undefined!;
|
||||
}
|
||||
utils.clearDropDown(this._accountTenantDropdown);
|
||||
await this.populateTenantsDropdown();
|
||||
}));
|
||||
|
||||
@@ -425,16 +426,12 @@ export class LoginMigrationTargetSelectionPage extends MigrationWizardPage {
|
||||
this._disposables.push(
|
||||
this._accountTenantDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== 'undefined') {
|
||||
/**
|
||||
* Replacing all the tenants in azure account with the tenant user has selected.
|
||||
* All azure requests will only run on this tenant from now on
|
||||
*/
|
||||
const selectedTenant = this.migrationStateModel._accountTenants.find(tenant => tenant.displayName === value);
|
||||
if (selectedTenant) {
|
||||
this.migrationStateModel._azureTenant = utils.deepClone(selectedTenant)!;
|
||||
this.migrationStateModel._azureAccount.properties.tenants = [this.migrationStateModel._azureTenant];
|
||||
}
|
||||
const selectedTenant = this.migrationStateModel._accountTenants?.find(tenant => tenant.displayName === value);
|
||||
this.migrationStateModel._azureTenant = selectedTenant
|
||||
? utils.deepClone(selectedTenant)
|
||||
: undefined!;
|
||||
}
|
||||
utils.clearDropDown(this._azureSubscriptionDropdown);
|
||||
await this.populateSubscriptionDropdown();
|
||||
}));
|
||||
|
||||
@@ -470,12 +467,14 @@ export class LoginMigrationTargetSelectionPage extends MigrationWizardPage {
|
||||
this._disposables.push(
|
||||
this._azureSubscriptionDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== 'undefined' && value !== constants.NO_SUBSCRIPTIONS_FOUND) {
|
||||
const selectedSubscription = this.migrationStateModel._subscriptions.find(subscription => `${subscription.name} - ${subscription.id}` === value);
|
||||
const selectedSubscription = this.migrationStateModel._subscriptions?.find(
|
||||
subscription => `${subscription.name} - ${subscription.id}` === value);
|
||||
this.migrationStateModel._targetSubscription = (selectedSubscription)
|
||||
? utils.deepClone(selectedSubscription)!
|
||||
: undefined!;
|
||||
this.migrationStateModel.refreshDatabaseBackupPage = true;
|
||||
}
|
||||
this.migrationStateModel.refreshDatabaseBackupPage = true;
|
||||
utils.clearDropDown(this._azureLocationDropdown);
|
||||
await this.populateLocationDropdown();
|
||||
}));
|
||||
|
||||
@@ -506,6 +505,7 @@ export class LoginMigrationTargetSelectionPage extends MigrationWizardPage {
|
||||
: undefined!;
|
||||
}
|
||||
this.migrationStateModel.refreshDatabaseBackupPage = true;
|
||||
utils.clearDropDown(this._azureResourceGroupDropdown);
|
||||
await this.populateResourceGroupDropdown();
|
||||
}));
|
||||
|
||||
@@ -733,6 +733,7 @@ export class LoginMigrationTargetSelectionPage extends MigrationWizardPage {
|
||||
? utils.deepClone(selectedResourceGroup)!
|
||||
: undefined!;
|
||||
}
|
||||
utils.clearDropDown(this._azureResourceDropdown);
|
||||
await this.populateResourceInstanceDropdown();
|
||||
}));
|
||||
|
||||
@@ -778,7 +779,7 @@ export class LoginMigrationTargetSelectionPage extends MigrationWizardPage {
|
||||
this.wizard.message = { text: '' };
|
||||
|
||||
// validate power state from VM instance view
|
||||
const runningState = 'PowerState/running'.toLowerCase();
|
||||
const runningState = 'powerstate/running';
|
||||
if (!this.migrationStateModel._vmInstanceView.statuses.some(status => status.code.toLowerCase() === runningState)) {
|
||||
this.wizard.message = {
|
||||
text: constants.VM_NOT_READY_POWER_STATE_ERROR(this.migrationStateModel._targetServerInstance.name),
|
||||
@@ -787,7 +788,7 @@ export class LoginMigrationTargetSelectionPage extends MigrationWizardPage {
|
||||
}
|
||||
|
||||
// validate IaaS extension mode
|
||||
const fullMode = 'Full'.toLowerCase();
|
||||
const fullMode = 'full';
|
||||
if (this.migrationStateModel._targetServerInstance.properties.sqlManagement.toLowerCase() !== fullMode) {
|
||||
this.wizard.message = {
|
||||
text: constants.VM_NOT_READY_IAAS_EXTENSION_ERROR(this.migrationStateModel._targetServerInstance.name, this.migrationStateModel._targetServerInstance.properties.sqlManagement),
|
||||
@@ -910,7 +911,10 @@ export class LoginMigrationTargetSelectionPage extends MigrationWizardPage {
|
||||
private async populateSubscriptionDropdown(): Promise<void> {
|
||||
try {
|
||||
this._azureSubscriptionDropdown.loading = true;
|
||||
this.migrationStateModel._subscriptions = await utils.getAzureSubscriptions(this.migrationStateModel._azureAccount);
|
||||
this.migrationStateModel._subscriptions = await utils.getAzureSubscriptions(
|
||||
this.migrationStateModel._azureAccount,
|
||||
this.migrationStateModel._azureTenant?.id);
|
||||
|
||||
this._azureSubscriptionDropdown.values = await utils.getAzureSubscriptionsDropdownValues(this.migrationStateModel._subscriptions);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
||||
@@ -267,12 +267,12 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
this.migrationStateModel._resourceGroup = undefined!;
|
||||
this.migrationStateModel._targetServerInstance = undefined!;
|
||||
|
||||
this._clearDropDown(this._azureAccountsDropdown);
|
||||
this._clearDropDown(this._accountTenantDropdown);
|
||||
this._clearDropDown(this._azureSubscriptionDropdown);
|
||||
this._clearDropDown(this._azureLocationDropdown);
|
||||
this._clearDropDown(this._azureResourceGroupDropdown);
|
||||
this._clearDropDown(this._azureResourceDropdown);
|
||||
utils.clearDropDown(this._azureAccountsDropdown);
|
||||
utils.clearDropDown(this._accountTenantDropdown);
|
||||
utils.clearDropDown(this._azureSubscriptionDropdown);
|
||||
utils.clearDropDown(this._azureLocationDropdown);
|
||||
utils.clearDropDown(this._azureResourceGroupDropdown);
|
||||
utils.clearDropDown(this._azureResourceDropdown);
|
||||
}
|
||||
|
||||
await this.populateAzureAccountsDropdown();
|
||||
@@ -314,6 +314,7 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
? utils.deepClone(selectedAccount)!
|
||||
: undefined!;
|
||||
}
|
||||
utils.clearDropDown(this._accountTenantDropdown);
|
||||
await this.populateTenantsDropdown();
|
||||
}));
|
||||
|
||||
@@ -361,16 +362,12 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
this._disposables.push(
|
||||
this._accountTenantDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== 'undefined') {
|
||||
/**
|
||||
* Replacing all the tenants in azure account with the tenant user has selected.
|
||||
* All azure requests will only run on this tenant from now on
|
||||
*/
|
||||
const selectedTenant = this.migrationStateModel._accountTenants?.find(tenant => tenant.displayName === value);
|
||||
if (selectedTenant) {
|
||||
this.migrationStateModel._azureTenant = utils.deepClone(selectedTenant)!;
|
||||
this.migrationStateModel._azureAccount.properties.tenants = [this.migrationStateModel._azureTenant];
|
||||
}
|
||||
this.migrationStateModel._azureTenant = selectedTenant
|
||||
? utils.deepClone(selectedTenant)
|
||||
: undefined!;
|
||||
}
|
||||
utils.clearDropDown(this._azureSubscriptionDropdown);
|
||||
await this.populateSubscriptionDropdown();
|
||||
}));
|
||||
|
||||
@@ -411,9 +408,9 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
this.migrationStateModel._targetSubscription = (selectedSubscription)
|
||||
? utils.deepClone(selectedSubscription)!
|
||||
: undefined!;
|
||||
this.migrationStateModel.refreshDatabaseBackupPage = true;
|
||||
}
|
||||
this._clearDropDown(this._azureLocationDropdown);
|
||||
this.migrationStateModel.refreshDatabaseBackupPage = true;
|
||||
utils.clearDropDown(this._azureLocationDropdown);
|
||||
await this.populateLocationDropdown();
|
||||
}));
|
||||
|
||||
@@ -444,7 +441,7 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
: undefined!;
|
||||
}
|
||||
this.migrationStateModel.refreshDatabaseBackupPage = true;
|
||||
this._clearDropDown(this._azureResourceGroupDropdown);
|
||||
utils.clearDropDown(this._azureResourceGroupDropdown);
|
||||
await this.populateResourceGroupDropdown();
|
||||
}));
|
||||
|
||||
@@ -671,7 +668,7 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
? utils.deepClone(selectedResourceGroup)!
|
||||
: undefined!;
|
||||
}
|
||||
this._clearDropDown(this._azureResourceDropdown);
|
||||
utils.clearDropDown(this._azureResourceDropdown);
|
||||
await this.populateResourceInstanceDropdown();
|
||||
}));
|
||||
|
||||
@@ -890,20 +887,21 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
private async populateTenantsDropdown(): Promise<void> {
|
||||
try {
|
||||
this._accountTenantDropdown.loading = true;
|
||||
const tenantId =
|
||||
this.migrationStateModel._azureTenant?.id ??
|
||||
this._serviceContext?.tenant?.id;
|
||||
|
||||
if (!utils.isAccountTokenStale(this.migrationStateModel._azureAccount) &&
|
||||
this.migrationStateModel._azureAccount?.properties?.tenants?.length > 0) {
|
||||
this.migrationStateModel._accountTenants = utils.getAzureTenants(this.migrationStateModel._azureAccount);
|
||||
this._accountTenantDropdown.values = utils.getAzureTenantsDropdownValues(this.migrationStateModel._accountTenants);
|
||||
}
|
||||
this.migrationStateModel._accountTenants = utils.getAzureTenants(
|
||||
this.migrationStateModel._azureAccount);
|
||||
|
||||
utils.selectDefaultDropdownValue(
|
||||
this._accountTenantDropdown,
|
||||
tenantId,
|
||||
true);
|
||||
const tenantId = this.migrationStateModel._azureTenant?.id;
|
||||
|
||||
this._accountTenantDropdown.values = utils.getAzureTenantsDropdownValues(this.migrationStateModel._accountTenants);
|
||||
|
||||
utils.selectDefaultDropdownValue(
|
||||
this._accountTenantDropdown,
|
||||
tenantId,
|
||||
true);
|
||||
}
|
||||
await this._azureAccountsDropdown.validate();
|
||||
} finally {
|
||||
this._accountTenantDropdown.loading = false;
|
||||
@@ -918,7 +916,9 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
private async populateSubscriptionDropdown(): Promise<void> {
|
||||
try {
|
||||
this._azureSubscriptionDropdown.loading = true;
|
||||
this.migrationStateModel._subscriptions = await utils.getAzureSubscriptions(this.migrationStateModel._azureAccount);
|
||||
this.migrationStateModel._subscriptions = await utils.getAzureSubscriptions(
|
||||
this.migrationStateModel._azureAccount,
|
||||
this.migrationStateModel._azureTenant?.id);
|
||||
const subscriptionId =
|
||||
this.migrationStateModel._targetSubscription?.id ??
|
||||
this._serviceContext?.subscription?.id;
|
||||
@@ -1206,9 +1206,4 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
targetDatabaseCollation.length > 0 &&
|
||||
sourceDatabaseCollation.toLocaleLowerCase() === targetDatabaseCollation.toLocaleLowerCase();
|
||||
}
|
||||
|
||||
private _clearDropDown(dropDown: azdata.DropDownComponent): void {
|
||||
dropDown.values = [];
|
||||
dropDown.value = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user