mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 01:28:26 -05:00
fix bugs in navigation validation (#20844)
* fix bugs in navigation validation * fix sql db tutorial link, convert doc links
This commit is contained in:
@@ -558,10 +558,6 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
}
|
||||
|
||||
public async onPageEnter(pageChangeInfo: azdata.window.WizardPageChangeInfo): Promise<void> {
|
||||
if (pageChangeInfo.newPage < pageChangeInfo.lastPage) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.wizard.registerNavigationValidator((pageChangeInfo) => {
|
||||
this.wizard.message = { text: '' };
|
||||
if (pageChangeInfo.newPage < pageChangeInfo.lastPage) {
|
||||
@@ -585,20 +581,14 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
}
|
||||
return true;
|
||||
});
|
||||
this.wizard.nextButton.enabled = false;
|
||||
await this.constructDetails();
|
||||
this.wizard.nextButton.enabled = this.migrationStateModel._assessmentResults !== undefined;
|
||||
}
|
||||
|
||||
public async onPageLeave(pageChangeInfo: azdata.window.WizardPageChangeInfo): Promise<void> {
|
||||
this.wizard.message = { text: '' };
|
||||
this.wizard.registerNavigationValidator((pageChangeInfo) => true);
|
||||
this.eventListener?.dispose();
|
||||
this.wizard.message = {
|
||||
text: '',
|
||||
level: azdata.window.MessageLevel.Error
|
||||
};
|
||||
this.wizard.registerNavigationValidator((pageChangeInfo) => {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
protected async handleStateChange(e: StateChangeEvent): Promise<void> {
|
||||
|
||||
@@ -152,7 +152,7 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
if (!targetMi || resourceDropdownValue === constants.NO_MANAGED_INSTANCE_FOUND) {
|
||||
errors.push(constants.INVALID_MANAGED_INSTANCE_ERROR);
|
||||
}
|
||||
if (targetMi.properties.state !== 'Ready') {
|
||||
if (targetMi?.properties?.state !== 'Ready') {
|
||||
errors.push(constants.MI_NOT_READY_ERROR(targetMi.name, targetMi.properties.state));
|
||||
}
|
||||
break;
|
||||
@@ -168,7 +168,7 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
errors.push(constants.INVALID_SQL_DATABASE_ERROR);
|
||||
}
|
||||
// TODO: verify what state check is needed/possible?
|
||||
if (targetSqlDB.properties.state !== 'Ready') {
|
||||
if (targetSqlDB?.properties?.state !== 'Ready') {
|
||||
errors.push(constants.SQLDB_NOT_READY_ERROR(targetSqlDB.name, targetSqlDB.properties.state));
|
||||
}
|
||||
|
||||
@@ -666,6 +666,8 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
await this._validateFields();
|
||||
} else {
|
||||
this.migrationStateModel._targetServerInstance = undefined!;
|
||||
if (isSqlDbTarget) {
|
||||
@@ -751,7 +753,10 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
},
|
||||
],
|
||||
})
|
||||
.withValidation(table => table.dataValues !== undefined && table.dataValues.length > 0)
|
||||
.withValidation(
|
||||
table =>
|
||||
this.migrationStateModel._targetType !== MigrationTargetType.SQLDB
|
||||
|| (table.dataValues !== undefined && table.dataValues.length > 0))
|
||||
.component();
|
||||
}
|
||||
|
||||
@@ -1012,4 +1017,16 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
private async _validateFields(): Promise<void> {
|
||||
await this._azureAccountsDropdown.validate();
|
||||
await this._accountTenantDropdown.validate();
|
||||
await this._azureSubscriptionDropdown.validate();
|
||||
await this._azureLocationDropdown.validate();
|
||||
await this._azureResourceGroupDropdown.validate();
|
||||
await this._azureResourceDropdown.validate();
|
||||
await this._targetPasswordInputBox.validate();
|
||||
await this._targetUserNameInputBox.validate();
|
||||
await this._azureResourceTable.validate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user