Tenant selction bug (#23349)
This commit is contained in:
Родитель
c5bc541090
Коммит
f9b4c52211
|
@ -2,7 +2,7 @@
|
|||
"name": "sql-migration",
|
||||
"displayName": "%displayName%",
|
||||
"description": "%description%",
|
||||
"version": "1.4.5",
|
||||
"version": "1.4.6",
|
||||
"publisher": "Microsoft",
|
||||
"preview": false,
|
||||
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",
|
||||
|
@ -10,7 +10,7 @@
|
|||
"aiKey": "29a207bb14f84905966a8f22524cb730-25407f35-11b6-4d4e-8114-ab9e843cb52f-7380",
|
||||
"engines": {
|
||||
"vscode": "*",
|
||||
"azdata": ">=1.41.0"
|
||||
"azdata": ">=1.44.1"
|
||||
},
|
||||
"activationEvents": [
|
||||
"onDashboardOpen",
|
||||
|
|
|
@ -468,7 +468,7 @@ export function getAzureTenants(account?: Account): Tenant[] {
|
|||
return account?.properties.tenants || [];
|
||||
}
|
||||
|
||||
export async function getAzureSubscriptions(account?: Account): Promise<azureResource.AzureResourceSubscription[]> {
|
||||
export async function getAzureSubscriptions(account?: Account, tenantId?: string): Promise<azureResource.AzureResourceSubscription[]> {
|
||||
let subscriptions: azureResource.AzureResourceSubscription[] = [];
|
||||
try {
|
||||
subscriptions = account && !isAccountTokenStale(account)
|
||||
|
@ -477,8 +477,9 @@ export async function getAzureSubscriptions(account?: Account): Promise<azureRes
|
|||
} catch (e) {
|
||||
logError(TelemetryViews.Utils, 'utils.getAzureSubscriptions', e);
|
||||
}
|
||||
subscriptions.sort((a, b) => a.name.localeCompare(b.name));
|
||||
return subscriptions;
|
||||
const filtered = subscriptions.filter(subscription => subscription.tenant === tenantId);
|
||||
filtered.sort((a, b) => a.name.localeCompare(b.name));
|
||||
return filtered;
|
||||
}
|
||||
|
||||
export async function getAzureSubscriptionsDropdownValues(subscriptions: azureResource.AzureResourceSubscription[]): Promise<CategoryValue[]> {
|
||||
|
@ -1167,3 +1168,8 @@ export function createRegistrationInstructions(view: ModelView, testConnectionBu
|
|||
flexFlow: 'column'
|
||||
}).component();
|
||||
}
|
||||
|
||||
export function clearDropDown(dropDown: DropDownComponent): void {
|
||||
dropDown.values = [];
|
||||
dropDown.value = undefined;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { AzureAccount } from 'azurecore';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { EOL } from 'os';
|
||||
import { MigrationSourceAuthenticationType } from '../models/stateMachine';
|
||||
|
@ -506,21 +505,6 @@ export function accountLinkedMessage(count: number): string {
|
|||
return count === 1 ? localize('sql.migration.wizard.account.count.single.message', '{0} account linked', count) : localize('sql.migration.wizard.account.count.multiple.message', '{0} accounts linked', count);
|
||||
}
|
||||
export const AZURE_TENANT = localize('sql.migration.azure.tenant', "Azure AD tenant");
|
||||
export function ACCOUNT_STALE_ERROR(account: AzureAccount) {
|
||||
return localize(
|
||||
'azure.accounts.accountStaleError',
|
||||
"The access token for selected account '{0}' and tenant '{1}' is no longer valid. Select 'Link account' and refresh the account, or select a different account.",
|
||||
`${account?.displayInfo?.displayName} (${account?.displayInfo?.userId})`,
|
||||
`${account?.properties?.tenants[0]?.displayName} (${account?.properties?.tenants[0]?.userId})`);
|
||||
}
|
||||
export function ACCOUNT_ACCESS_ERROR(account: AzureAccount, error: Error) {
|
||||
return localize(
|
||||
'azure.accounts.accountAccessError',
|
||||
"An error occurred while accessing the selected account '{0}' and tenant '{1}'. Select 'Link account' and refresh the account, or select a different account. Error '{2}'",
|
||||
`${account?.displayInfo?.displayName} (${account?.displayInfo?.userId})`,
|
||||
`${account?.properties?.tenants[0]?.displayName} (${account?.properties?.tenants[0]?.userId})`,
|
||||
error.message);
|
||||
}
|
||||
export function MI_NOT_READY_ERROR(miName: string, state: string): string {
|
||||
return localize('sql.migration.mi.not.ready', "The managed instance '{0}' is unavailable for migration because it is currently in the '{1}' state. To continue, select an available managed instance.", miName, state);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ export class RestartMigrationDialog {
|
|||
|
||||
// TargetSelection
|
||||
azureAccount: serviceContext.azureAccount!,
|
||||
azureTenant: serviceContext.azureAccount!.properties.tenants[0]!,
|
||||
azureTenant: serviceContext.tenant!,
|
||||
subscription: serviceContext.subscription!,
|
||||
location: location,
|
||||
resourceGroup: {
|
||||
|
|
|
@ -143,11 +143,12 @@ export class SelectMigrationServiceDialog {
|
|||
this._azureAccountsDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== 'undefined') {
|
||||
const selectedAccount = this._azureAccounts.find(account => account.displayInfo.displayName === value);
|
||||
this._serviceContext.azureAccount = (selectedAccount)
|
||||
this._serviceContext.azureAccount = selectedAccount
|
||||
? utils.deepClone(selectedAccount)
|
||||
: undefined!;
|
||||
await this._populateTentantsDropdown();
|
||||
}
|
||||
utils.clearDropDown(this._accountTenantDropdown);
|
||||
await this._populateTentantsDropdown();
|
||||
}));
|
||||
|
||||
const linkAccountButton = this._view.modelBuilder.hyperlink()
|
||||
|
@ -190,12 +191,12 @@ export class SelectMigrationServiceDialog {
|
|||
this._accountTenantDropdown.onValueChanged(async value => {
|
||||
if (value && value !== 'undefined') {
|
||||
const selectedTenant = this._accountTenants.find(tenant => tenant.displayName === value);
|
||||
if (selectedTenant) {
|
||||
this._serviceContext.tenant = utils.deepClone(selectedTenant);
|
||||
this._serviceContext.azureAccount!.properties.tenants = [selectedTenant];
|
||||
}
|
||||
await this._populateSubscriptionDropdown();
|
||||
this._serviceContext.tenant = selectedTenant
|
||||
? utils.deepClone(selectedTenant)
|
||||
: undefined!;
|
||||
}
|
||||
utils.clearDropDown(this._azureSubscriptionDropdown);
|
||||
await this._populateSubscriptionDropdown();
|
||||
}));
|
||||
|
||||
this._accountTenantFlexContainer = this._view.modelBuilder.flexContainer()
|
||||
|
@ -231,11 +232,12 @@ export class SelectMigrationServiceDialog {
|
|||
this._azureSubscriptionDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== 'undefined') {
|
||||
const selectedSubscription = this._subscriptions.find(subscription => `${subscription.name} - ${subscription.id}` === value);
|
||||
this._serviceContext.subscription = (selectedSubscription)
|
||||
this._serviceContext.subscription = selectedSubscription
|
||||
? utils.deepClone(selectedSubscription)
|
||||
: undefined!;
|
||||
await this._populateLocationDropdown();
|
||||
}
|
||||
utils.clearDropDown(this._azureLocationDropdown);
|
||||
await this._populateLocationDropdown();
|
||||
}));
|
||||
|
||||
const azureLocationLabel = this._view.modelBuilder.text()
|
||||
|
@ -259,12 +261,12 @@ export class SelectMigrationServiceDialog {
|
|||
this._azureLocationDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== 'undefined') {
|
||||
const selectedLocation = this._locations.find(location => location.displayName === value);
|
||||
this._serviceContext.location = (selectedLocation)
|
||||
this._serviceContext.location = selectedLocation
|
||||
? utils.deepClone(selectedLocation)
|
||||
: undefined!;
|
||||
await this._populateResourceGroupDropdown();
|
||||
this._populateMigrationServiceDropdown();
|
||||
}
|
||||
utils.clearDropDown(this._azureResourceGroupDropdown);
|
||||
await this._populateResourceGroupDropdown();
|
||||
}));
|
||||
|
||||
const azureResourceGroupLabel = this._view.modelBuilder.text()
|
||||
|
@ -288,11 +290,12 @@ export class SelectMigrationServiceDialog {
|
|||
this._azureResourceGroupDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== 'undefined') {
|
||||
const selectedResourceGroup = this._resourceGroups.find(rg => rg.name === value);
|
||||
this._serviceContext.resourceGroup = (selectedResourceGroup)
|
||||
this._serviceContext.resourceGroup = selectedResourceGroup
|
||||
? utils.deepClone(selectedResourceGroup)
|
||||
: undefined!;
|
||||
this._populateMigrationServiceDropdown();
|
||||
}
|
||||
utils.clearDropDown(this._azureServiceDropdown);
|
||||
this._populateMigrationServiceDropdown();
|
||||
}));
|
||||
|
||||
this._azureServiceDropdownLabel = this._view.modelBuilder.text()
|
||||
|
@ -316,11 +319,11 @@ export class SelectMigrationServiceDialog {
|
|||
this._azureServiceDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== 'undefined') {
|
||||
const selectedDms = this._sqlMigrationServices.find(dms => dms.name === value);
|
||||
this._serviceContext.migrationService = (selectedDms)
|
||||
this._serviceContext.migrationService = selectedDms
|
||||
? utils.deepClone(selectedDms)
|
||||
: undefined!;
|
||||
await this._updateButtonState();
|
||||
}
|
||||
await this._updateButtonState();
|
||||
}));
|
||||
|
||||
this._disposables.push(
|
||||
|
@ -390,6 +393,7 @@ export class SelectMigrationServiceDialog {
|
|||
error.message);
|
||||
} finally {
|
||||
this._accountTenantDropdown.loading = false;
|
||||
utils.clearDropDown(this._azureSubscriptionDropdown);
|
||||
await this._populateSubscriptionDropdown();
|
||||
}
|
||||
}
|
||||
|
@ -397,7 +401,9 @@ export class SelectMigrationServiceDialog {
|
|||
private async _populateSubscriptionDropdown(): Promise<void> {
|
||||
try {
|
||||
this._azureSubscriptionDropdown.loading = true;
|
||||
this._subscriptions = await utils.getAzureSubscriptions(this._serviceContext.azureAccount);
|
||||
this._subscriptions = await utils.getAzureSubscriptions(
|
||||
this._serviceContext.azureAccount,
|
||||
this._serviceContext.tenant?.id);
|
||||
this._azureSubscriptionDropdown.values = await utils.getAzureSubscriptionsDropdownValues(this._subscriptions);
|
||||
if (this._azureSubscriptionDropdown.values.length > 0) {
|
||||
utils.selectDefaultDropdownValue(
|
||||
|
|
|
@ -297,7 +297,7 @@ export class TdeMigrationDialog {
|
|||
this._updateProgressText();
|
||||
|
||||
//Get access token
|
||||
const accessToken = await azdata.accounts.getAccountSecurityToken(this._model._azureAccount, this._model._azureAccount.properties.tenants[0].id, azdata.AzureResource.ResourceManagement);
|
||||
const accessToken = await azdata.accounts.getAccountSecurityToken(this._model._azureAccount, this._model._azureTenant.id, azdata.AzureResource.ResourceManagement);
|
||||
|
||||
const operationResult = await this._model.startTdeMigration(accessToken!.token, this._updateTableResultRow.bind(this));
|
||||
|
||||
|
|
|
@ -1142,7 +1142,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
|||
TelemetryAction.StartMigration,
|
||||
{
|
||||
'sessionId': this._sessionId,
|
||||
'tenantId': this._azureAccount.properties.tenants[0].id,
|
||||
'tenantId': this._azureTenant?.id,
|
||||
'subscriptionId': this._sqlMigrationServiceSubscription?.id,
|
||||
'resourceGroup': this._sqlMigrationServiceResourceGroup?.name,
|
||||
'location': this._location.name,
|
||||
|
|
|
@ -98,7 +98,8 @@ export function sendSqlMigrationActionEvent(telemetryView: TelemetryViews, telem
|
|||
}
|
||||
|
||||
export function getTelemetryProps(migrationStateModel: MigrationStateModel): TelemetryEventProperties {
|
||||
const tenantId = migrationStateModel._azureAccount?.properties?.tenants?.length > 0
|
||||
const tenantId = migrationStateModel._azureTenant?.id ??
|
||||
migrationStateModel._azureAccount?.properties?.tenants?.length > 0
|
||||
? migrationStateModel._azureAccount?.properties?.tenants[0]?.id
|
||||
: '';
|
||||
return {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче