From 63c461dca817480e353e098aaef2dd72fc766019 Mon Sep 17 00:00:00 2001 From: Aasim Khan Date: Fri, 6 Aug 2021 12:12:53 -0700 Subject: [PATCH] Fixed: (#16594) Summary label DMS creation retry times DMS dropdown resetting --- extensions/sql-migration/src/api/azure.ts | 4 ++-- .../createSqlMigrationServiceDialog.ts | 2 +- extensions/sql-migration/src/models/stateMachine.ts | 6 +++--- .../src/wizard/integrationRuntimePage.ts | 12 ++++++------ extensions/sql-migration/src/wizard/summaryPage.ts | 7 +++---- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/extensions/sql-migration/src/api/azure.ts b/extensions/sql-migration/src/api/azure.ts index be575494d0..8dc549080b 100644 --- a/extensions/sql-migration/src/api/azure.ts +++ b/extensions/sql-migration/src/api/azure.ts @@ -177,7 +177,7 @@ export async function createSqlMigrationService(account: azdata.Account, subscri throw new Error(response.errors.toString()); } const asyncUrl = response.response.headers['azure-asyncoperation']; - const maxRetry = 5; + const maxRetry = 24; let i = 0; for (i = 0; i < maxRetry; i++) { const asyncResponse = await api.makeAzureRestRequest(account, subscription, asyncUrl.replace('https://management.azure.com/', ''), azurecore.HttpRequestMethod.GET, undefined, true, undefined, getSessionIdHeader(sessionId)); @@ -187,7 +187,7 @@ export async function createSqlMigrationService(account: azdata.Account, subscri } else if (creationStatus === ProvisioningState.Failed) { throw new Error(asyncResponse.errors.toString()); } - await new Promise(resolve => setTimeout(resolve, 3000)); //adding 3 sec delay before getting creation status + await new Promise(resolve => setTimeout(resolve, 5000)); //adding 5 sec delay before getting creation status } if (i === maxRetry) { throw new Error(constants.DMS_PROVISIONING_FAILED); diff --git a/extensions/sql-migration/src/dialog/createSqlMigrationService/createSqlMigrationServiceDialog.ts b/extensions/sql-migration/src/dialog/createSqlMigrationService/createSqlMigrationServiceDialog.ts index 9de429fc4e..88213c17b5 100644 --- a/extensions/sql-migration/src/dialog/createSqlMigrationService/createSqlMigrationServiceDialog.ts +++ b/extensions/sql-migration/src/dialog/createSqlMigrationService/createSqlMigrationServiceDialog.ts @@ -76,7 +76,7 @@ export class CreateSqlMigrationServiceDialog { const subscription = this._model._targetSubscription; - const resourceGroup = (this.migrationServiceResourceGroupDropdown.value as azdata.CategoryValue).name; + const resourceGroup = (this.migrationServiceResourceGroupDropdown.value as azdata.CategoryValue)?.name; const location = this._model._targetServerInstance.location; const serviceName = this.migrationServiceNameText.value; diff --git a/extensions/sql-migration/src/models/stateMachine.ts b/extensions/sql-migration/src/models/stateMachine.ts index 0e5b7c40bd..200df1ce3c 100644 --- a/extensions/sql-migration/src/models/stateMachine.ts +++ b/extensions/sql-migration/src/models/stateMachine.ts @@ -128,7 +128,7 @@ export class MigrationStateModel implements Model, vscode.Disposable { public _targetDatabaseNames!: string[]; public _sqlMigrationServiceResourceGroup!: string; - public _sqlMigrationService!: SqlMigrationService; + public _sqlMigrationService!: SqlMigrationService | undefined; public _sqlMigrationServices!: SqlMigrationService[]; public _nodeNames!: string[]; @@ -924,7 +924,7 @@ export class MigrationStateModel implements Model, vscode.Disposable { 'serverName': this._targetServerInstance.name, 'tenantId': this._azureAccount.properties.tenants[0].id, 'location': this._targetServerInstance.location, - 'sqlMigrationServiceId': Buffer.from(this._sqlMigrationService.id).toString('base64'), + 'sqlMigrationServiceId': Buffer.from(this._sqlMigrationService?.id!).toString('base64'), 'irRegistered': (this._nodeNames.length > 0).toString() }, { @@ -937,7 +937,7 @@ export class MigrationStateModel implements Model, vscode.Disposable { this._targetServerInstance, this._azureAccount, this._targetSubscription, - this._sqlMigrationService, + this._sqlMigrationService!, response.asyncUrl, this._sessionId ); diff --git a/extensions/sql-migration/src/wizard/integrationRuntimePage.ts b/extensions/sql-migration/src/wizard/integrationRuntimePage.ts index 57a5482dfa..93ca8de763 100644 --- a/extensions/sql-migration/src/wizard/integrationRuntimePage.ts +++ b/extensions/sql-migration/src/wizard/integrationRuntimePage.ts @@ -105,8 +105,8 @@ export class IntergrationRuntimePage extends MigrationWizardPage { this._subscription.value = this.migrationStateModel._targetSubscription.name; this._location.value = await getLocationDisplayName(this.migrationStateModel._targetServerInstance.location); + this._dmsInfoContainer.display = (this.migrationStateModel._databaseBackup.networkContainerType === NetworkContainerType.NETWORK_SHARE && this.migrationStateModel._sqlMigrationService) ? 'inline' : 'none'; this.loadResourceGroupDropdown(); - this._dmsInfoContainer.display = (this.migrationStateModel._databaseBackup.networkContainerType === NetworkContainerType.NETWORK_SHARE) ? 'inline' : 'none'; this.wizard.registerNavigationValidator((pageChangeInfo) => { if (pageChangeInfo.newPage < pageChangeInfo.lastPage) { this.wizard.message = { @@ -114,7 +114,7 @@ export class IntergrationRuntimePage extends MigrationWizardPage { }; return true; } - const state = this.migrationStateModel._sqlMigrationService.properties.integrationRuntimeState; + const state = this.migrationStateModel._sqlMigrationService?.properties?.integrationRuntimeState; if (!this.migrationStateModel._sqlMigrationService) { this.wizard.message = { level: azdata.window.MessageLevel.Error, @@ -196,6 +196,7 @@ export class IntergrationRuntimePage extends MigrationWizardPage { this._disposables.push(this._resourceGroupDropdown.onValueChanged(async (value) => { const selectedIndex = findDropDownItemIndex(this._resourceGroupDropdown, value); + this.migrationStateModel._sqlMigrationServiceResourceGroup = this.migrationStateModel.getAzureResourceGroup(selectedIndex).name; if (selectedIndex > -1) { await this.populateDms(value); } @@ -225,11 +226,10 @@ export class IntergrationRuntimePage extends MigrationWizardPage { text: '' }; const selectedIndex = findDropDownItemIndex(this._dmsDropdown, value); - if (selectedIndex > -1) { - this.migrationStateModel._sqlMigrationService = this.migrationStateModel.getMigrationService(selectedIndex); - await this.loadMigrationServiceStatus(); - } + this.migrationStateModel._sqlMigrationService = this.migrationStateModel.getMigrationService(selectedIndex); + await this.loadMigrationServiceStatus(); } else { + this.migrationStateModel._sqlMigrationService = undefined; this._dmsInfoContainer.display = 'none'; } })); diff --git a/extensions/sql-migration/src/wizard/summaryPage.ts b/extensions/sql-migration/src/wizard/summaryPage.ts index 56572bc50a..7352ebdf59 100644 --- a/extensions/sql-migration/src/wizard/summaryPage.ts +++ b/extensions/sql-migration/src/wizard/summaryPage.ts @@ -108,10 +108,9 @@ export class SummaryPage extends MigrationWizardPage { createHeadingTextComponent(this._view, constants.IR_PAGE_TITLE), createInformationRow(this._view, constants.SUBSCRIPTION, this.migrationStateModel._targetSubscription.name), - createInformationRow(this._view, constants.LOCATION, this.migrationStateModel._sqlMigrationService.location), - createInformationRow(this._view, constants.SUBSCRIPTION, this.migrationStateModel._sqlMigrationService.properties.resourceGroup), - createInformationRow(this._view, constants.IR_PAGE_TITLE, this.migrationStateModel._targetSubscription.name), - createInformationRow(this._view, constants.SUBSCRIPTION, this.migrationStateModel._sqlMigrationService.name) + createInformationRow(this._view, constants.LOCATION, this.migrationStateModel._sqlMigrationService?.location!), + createInformationRow(this._view, constants.RESOURCE_GROUP, this.migrationStateModel._sqlMigrationService?.properties?.resourceGroup!), + createInformationRow(this._view, constants.IR_PAGE_TITLE, this.migrationStateModel._sqlMigrationService?.name!) ] );