Add IR Migration configuration Validation to SQL Migration extension (#21386)

* re-factor and consolidate wizard pages

* validation WIP 11/10

* validate ir dialog

* navigation fixes

* bump version to 1.2.0

* add resource strings and fix navigatin issue

* map validation state to resource string clean up

* address review comments

* fix typos, address review comments

* address review feedback, readability

* fix res string, validation check, col width

* bug fixes, nav, sqldb migration

* fix nav/refresh/visibility issues

* fix nav issues, cancel pending validation items

* update error text / position

* fix localization bug
This commit is contained in:
brian-harris
2022-12-16 14:52:24 -08:00
committed by GitHub
parent 754d70d654
commit 2e240729af
29 changed files with 1993 additions and 692 deletions

View File

@@ -13,7 +13,6 @@ import { DatabaseBackupPage } from './databaseBackupPage';
import { TargetSelectionPage } from './targetSelectionPage';
import { IntergrationRuntimePage } from './integrationRuntimePage';
import { SummaryPage } from './summaryPage';
import { MigrationModePage } from './migrationModePage';
import { DatabaseSelectorPage } from './databaseSelectorPage';
import { sendSqlMigrationActionEvent, TelemetryAction, TelemetryViews, logError } from '../telemtery';
import * as styles from '../constants/styles';
@@ -48,23 +47,41 @@ export class WizardController {
this._wizardObject.generateScriptButton.enabled = false;
this._wizardObject.generateScriptButton.hidden = true;
const saveAndCloseButton = azdata.window.createButton(loc.SAVE_AND_CLOSE);
this._wizardObject.customButtons = [saveAndCloseButton];
this._wizardObject.nextButton.position = 'left';
this._wizardObject.nextButton.secondary = false;
this._wizardObject.doneButton.label = loc.START_MIGRATION_TEXT;
this._wizardObject.doneButton.position = 'left';
this._wizardObject.doneButton.secondary = false;
this._wizardObject.backButton.position = 'left';
this._wizardObject.backButton.secondary = true;
this._wizardObject.cancelButton.position = 'left';
this._wizardObject.cancelButton.secondary = true;
const saveAndCloseButton = azdata.window.createButton(
loc.SAVE_AND_CLOSE,
'right');
saveAndCloseButton.secondary = true;
const validateButton = azdata.window.createButton(
loc.RUN_VALIDATION,
'left');
validateButton.secondary = false;
validateButton.hidden = true;
this._wizardObject.customButtons = [validateButton, saveAndCloseButton];
const databaseSelectorPage = new DatabaseSelectorPage(this._wizardObject, stateModel);
const skuRecommendationPage = new SKURecommendationPage(this._wizardObject, stateModel);
const targetSelectionPage = new TargetSelectionPage(this._wizardObject, stateModel);
const migrationModePage = new MigrationModePage(this._wizardObject, stateModel);
const databaseBackupPage = new DatabaseBackupPage(this._wizardObject, stateModel);
const integrationRuntimePage = new IntergrationRuntimePage(this._wizardObject, stateModel);
const databaseBackupPage = new DatabaseBackupPage(this._wizardObject, stateModel);
const summaryPage = new SummaryPage(this._wizardObject, stateModel);
const pages: MigrationWizardPage[] = [
databaseSelectorPage,
skuRecommendationPage,
targetSelectionPage,
migrationModePage,
databaseBackupPage,
integrationRuntimePage,
databaseBackupPage,
summaryPage];
this._wizardObject.pages = pages.map(p => p.getwizardPage());
@@ -80,15 +97,15 @@ export class WizardController {
wizardSetupPromises.push(...pages.map(p => p.registerWizardContent()));
wizardSetupPromises.push(this._wizardObject.open());
if (this._model.retryMigration || this._model.resumeAssessment) {
if (this._model.savedInfo.closedPage >= Page.MigrationMode) {
if (this._model.savedInfo.closedPage >= Page.IntegrationRuntime) {
this._model.refreshDatabaseBackupPage = true;
}
// if the user selected network share and selected save & close afterwards, it should always return to the database backup page so that
// the user can input their password again
if (this._model.savedInfo.closedPage >= Page.DatabaseBackup &&
if (this._model.savedInfo.closedPage >= Page.IntegrationRuntime &&
this._model.savedInfo.networkContainerType === NetworkContainerType.NETWORK_SHARE) {
wizardSetupPromises.push(this._wizardObject.setCurrentPage(Page.DatabaseBackup));
wizardSetupPromises.push(this._wizardObject.setCurrentPage(Page.IntegrationRuntime));
} else {
wizardSetupPromises.push(this._wizardObject.setCurrentPage(this._model.savedInfo.closedPage));
}
@@ -107,15 +124,7 @@ export class WizardController {
await pages[newPage]?.onPageEnter(pageChangeInfo);
}));
this._wizardObject.registerNavigationValidator(async validator => {
// const lastPage = validator.lastPage;
// const canLeave = await pages[lastPage]?.canLeave() ?? true;
// const canEnter = await pages[lastPage]?.canEnter() ?? true;
// return canEnter && canLeave;
return true;
});
this._wizardObject.registerNavigationValidator(async validator => true);
await Promise.all(wizardSetupPromises);
this._model.extensionContext.subscriptions.push(
@@ -146,8 +155,6 @@ export class WizardController {
{});
}));
this._wizardObject.doneButton.label = loc.START_MIGRATION_TEXT;
this._disposables.push(
this._wizardObject.doneButton.onClick(async (e) => {
try {