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

@@ -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);