Fixing bugs for migration extension private preview 1. (#14872)

* Fixing Database backup page target layout

* Filtering out Azure sql db issues from assessment results
Correcting the database count for issued databases in sku rec page.

* Adding copy migration details button to migration status

* Adding start migration button to toolbar

* Fixing a syntax error in package.json

* Adding rg and location to target selection page
Filtering storage account by target location.

* Fixing dashboard title to azure sql migration

* Not making assessment targets selected by default.

* Adding tooltip for database and instance table items.

* Fixing duplicate task widget

* Some fixes mentioned in the PR
Localizing button text
renaming  a var
changing null to undefined.

* Adding enum for Migration target types

* Fixing a critical multi db migration bug because of unhandled race condition

* Adding Azure location api to azure core

* Adding source database info in status
This commit is contained in:
Aasim Khan
2021-03-26 10:32:28 -07:00
committed by GitHub
parent e0f24cc268
commit 4d78aefe57
15 changed files with 336 additions and 198 deletions

View File

@@ -166,14 +166,14 @@ export class SqlDatabaseTree {
{
displayName: constants.INSTANCE,
valueType: azdata.DeclarativeDataType.component,
width: 150,
width: 130,
isReadOnly: true,
headerCssStyles: headerLeft
},
{
displayName: constants.WARNINGS,
valueType: azdata.DeclarativeDataType.string,
width: 50,
width: 30,
isReadOnly: true,
headerCssStyles: headerRight
}
@@ -595,9 +595,9 @@ export class SqlDatabaseTree {
public selectedDbs(): string[] {
let result: string[] = [];
this._databaseTable.dataValues?.forEach((arr) => {
this._databaseTable.dataValues?.forEach((arr, index) => {
if (arr[0].value === true) {
result.push(arr[1].value.toString());
result.push(this._dbNames[index]);
}
});
return result;
@@ -615,8 +615,6 @@ export class SqlDatabaseTree {
);
});
this._assessmentResultsTable.dataValues = assessmentResults;
this._selectedIssue = this._activeIssues[0];
this.refreshAssessmentDetails();
}
public refreshAssessmentDetails(): void {
@@ -734,14 +732,8 @@ export class SqlDatabaseTree {
);
});
}
this._dbName.value = this._serverName;
this._instanceTable.dataValues = instanceTableValues;
this._databaseTable.dataValues = databaseTableValues;
if (this._targetType === MigrationTargetType.SQLMI) {
this._activeIssues = this._model._assessmentResults.issues;
this._selectedIssue = this._model._assessmentResults?.issues[0];
this.refreshResults();
}
}
private createIconTextCell(icon: IconPath, text: string): azdata.FlexContainer {
@@ -755,8 +747,10 @@ export class SqlDatabaseTree {
}).component();
const textComponent = this._view.modelBuilder.text().withProps({
value: text,
title: text,
CSSStyles: {
'margin': '0px'
'margin': '0px',
'width': '110px'
}
}).component();

View File

@@ -10,6 +10,8 @@ import { MigrationCutoverDialogModel } from './migrationCutoverDialogModel';
import * as loc from '../../constants/strings';
import { getSqlServerName } from '../../api/utils';
import { EOL } from 'os';
import * as vscode from 'vscode';
export class MigrationCutoverDialog {
private _dialogObject!: azdata.window.Dialog;
private _view!: azdata.ModelView;
@@ -20,9 +22,11 @@ export class MigrationCutoverDialog {
private _refreshButton!: azdata.ButtonComponent;
private _cancelButton!: azdata.ButtonComponent;
private _refreshLoader!: azdata.LoadingComponent;
private _copyDatabaseMigrationDetails!: azdata.ButtonComponent;
private _serverName!: azdata.TextComponent;
private _serverVersion!: azdata.TextComponent;
private _sourceDatabase!: azdata.TextComponent;
private _targetServer!: azdata.TextComponent;
private _targetVersion!: azdata.TextComponent;
private _migrationStatus!: azdata.TextComponent;
@@ -46,9 +50,11 @@ export class MigrationCutoverDialog {
let tab = azdata.window.createTab('');
tab.registerContent(async (view: azdata.ModelView) => {
this._view = view;
const sourceDatabase = this.createInfoField(loc.SOURCE_DATABASE, '');
const sourceDetails = this.createInfoField(loc.SOURCE_SERVER, '');
const sourceVersion = this.createInfoField(loc.SOURCE_VERSION, '');
this._sourceDatabase = sourceDatabase.text;
this._serverName = sourceDetails.text;
this._serverVersion = sourceVersion.text;
@@ -56,6 +62,11 @@ export class MigrationCutoverDialog {
flexFlow: 'column'
}).component();
flexServer.addItem(sourceDatabase.flexContainer, {
CSSStyles: {
'width': '150px'
}
});
flexServer.addItem(sourceDetails.flexContainer, {
CSSStyles: {
'width': '150px'
@@ -336,6 +347,27 @@ export class MigrationCutoverDialog {
}
});
this._copyDatabaseMigrationDetails = this._view.modelBuilder.button().withProps({
iconPath: IconPathHelper.copy,
iconHeight: '16px',
iconWidth: '16px',
label: loc.COPY_MIGRATION_DETAILS,
height: '55px',
width: '100px'
}).component();
this._copyDatabaseMigrationDetails.onDidClick(async (e) => {
await this.refreshStatus();
vscode.env.clipboard.writeText(JSON.stringify(this._model.migrationStatus, undefined, 2));
});
header.addItem(this._copyDatabaseMigrationDetails, {
flex: '0',
CSSStyles: {
'width': '100px'
}
});
this._refreshLoader = this._view.modelBuilder.loadingComponent().withProps({
loading: false,
height: '55px'
@@ -344,6 +376,7 @@ export class MigrationCutoverDialog {
header.addItem(this._refreshLoader, {
flex: '0'
});
return header;
}
@@ -363,6 +396,7 @@ export class MigrationCutoverDialog {
};
const sqlServerInfo = await azdata.connection.getServerInfo(this._model._migration.sourceConnectionProfile.connectionId);
const sqlServerName = this._model._migration.sourceConnectionProfile.serverName;
const sourceDatabaseName = this._model._migration.migrationContext.properties.sourceDatabaseName;
const versionName = getSqlServerName(sqlServerInfo.serverMajorVersion!);
const sqlServerVersion = versionName ? versionName : sqlServerInfo.serverVersion;
const targetServerName = this._model._migration.targetManagedInstance.name;
@@ -402,6 +436,7 @@ export class MigrationCutoverDialog {
}
});
this._sourceDatabase.value = sourceDatabaseName;
this._serverName.value = sqlServerName;
this._serverVersion.value = `${sqlServerVersion}
${sqlServerInfo.serverVersion}`;
@@ -414,7 +449,7 @@ export class MigrationCutoverDialog {
this._lastAppliedLSN.value = lastAppliedSSN!;
this._lastAppliedBackupFile.value = this._model.migrationStatus.properties.migrationStatusDetails?.lastRestoredFilename;
this._lastAppliedBackupTakenOn.value = new Date(lastAppliedBackupFileTakenOn!).toLocaleString();
this._lastAppliedBackupTakenOn.value = lastAppliedBackupFileTakenOn! ? new Date(lastAppliedBackupFileTakenOn).toLocaleString() : '';
this._fileCount.value = loc.ACTIVE_BACKUP_FILES_ITEMS(tableData.length);