sql-migration: update migration status page latest design (#16099)

* add migrations status context menu and commands

* add migration status images

* remove test code, add account validation

* fix command registration to occure once

* fix typo
This commit is contained in:
brian-harris
2021-07-16 12:20:19 -07:00
committed by GitHub
parent 3f047ae15a
commit 78a144b5ca
6 changed files with 684 additions and 380 deletions

View File

@@ -10,6 +10,7 @@ import { MigrationStateModel, StateChangeEvent } from '../models/stateMachine';
import * as constants from '../constants/strings';
import { WIZARD_INPUT_COMPONENT_WIDTH } from './wizardController';
import { deepClone, findDropDownItemIndex, selectDropDownIndex } from '../api/utils';
import { getSubscriptions } from '../api/azure';
export class AccountsSelectionPage extends MigrationWizardPage {
private _azureAccountsDropdown!: azdata.DropDownComponent;
@@ -198,14 +199,21 @@ export class AccountsSelectionPage extends MigrationWizardPage {
}
public async onPageEnter(): Promise<void> {
this.wizard.registerNavigationValidator(pageChangeInfo => {
if (this.migrationStateModel._azureAccount?.isStale === true) {
this.wizard.message = {
text: constants.ACCOUNT_STALE_ERROR(this.migrationStateModel._azureAccount)
};
return false;
this.wizard.registerNavigationValidator(async pageChangeInfo => {
try {
if (!this.migrationStateModel._azureAccount?.isStale) {
const subscriptions = await getSubscriptions(this.migrationStateModel._azureAccount);
if (subscriptions?.length > 0) {
return true;
}
}
this.wizard.message = { text: constants.ACCOUNT_STALE_ERROR(this.migrationStateModel._azureAccount) };
} catch (error) {
this.wizard.message = { text: constants.ACCOUNT_ACCESS_ERROR(this.migrationStateModel._azureAccount, error) };
}
return true;
return false;
});
}