Add error details to error banner in migration cutover dialog (#16494)

* Add error details to error banner in migration cutover dialog

* Adding method functionality to copy migration details
This commit is contained in:
goyal-anjali
2021-08-04 15:53:37 +05:30
committed by GitHub
parent e3d672cea1
commit 43158a60e3
2 changed files with 17 additions and 10 deletions

View File

@@ -111,7 +111,7 @@ export class IconPathHelper {
}; };
IconPathHelper.info = { IconPathHelper.info = {
light: context.asAbsolutePath('images/info.svg'), light: context.asAbsolutePath('images/info.svg'),
dark: context.asAbsolutePath('images/infoBox.svg') dark: context.asAbsolutePath('images/info.svg')
}; };
IconPathHelper.error = { IconPathHelper.error = {
light: context.asAbsolutePath('images/error.svg'), light: context.asAbsolutePath('images/error.svg'),

View File

@@ -307,14 +307,7 @@ export class MigrationCutoverDialog {
this._disposables.push(this._copyDatabaseMigrationDetails.onDidClick(async (e) => { this._disposables.push(this._copyDatabaseMigrationDetails.onDidClick(async (e) => {
await this.refreshStatus(); await this.refreshStatus();
if (this._model.migrationOpStatus) { vscode.env.clipboard.writeText(this.getMigrationDetails());
vscode.env.clipboard.writeText(JSON.stringify({
'async-operation-details': this._model.migrationOpStatus,
'details': this._model.migrationStatus
}, undefined, 2));
} else {
vscode.env.clipboard.writeText(JSON.stringify(this._model.migrationStatus, undefined, 2));
}
vscode.window.showInformationMessage(loc.DETAILS_COPIED); vscode.window.showInformationMessage(loc.DETAILS_COPIED);
})); }));
@@ -459,6 +452,19 @@ export class MigrationCutoverDialog {
} }
} }
private getMigrationDetails(): string {
if (this._model.migrationOpStatus) {
return (JSON.stringify(
{
'async-operation-details': this._model.migrationOpStatus,
'details': this._model.migrationStatus
}
, undefined, 2));
} else {
return (JSON.stringify(this._model.migrationStatus, undefined, 2));
}
}
private async refreshStatus(): Promise<void> { private async refreshStatus(): Promise<void> {
if (this.isRefreshing) { if (this.isRefreshing) {
return; return;
@@ -481,7 +487,8 @@ export class MigrationCutoverDialog {
errors.push(this._model.migrationStatus.properties.migrationStatusDetails?.restoreBlockingReason); errors.push(this._model.migrationStatus.properties.migrationStatusDetails?.restoreBlockingReason);
this._dialogObject.message = { this._dialogObject.message = {
text: errors.filter(e => e !== undefined).join(EOL), text: errors.filter(e => e !== undefined).join(EOL),
level: (this._model.migrationStatus.properties.migrationStatus === MigrationStatus.InProgress || this._model.migrationStatus.properties.migrationStatus === 'Completing') ? azdata.window.MessageLevel.Warning : azdata.window.MessageLevel.Error level: (this._model.migrationStatus.properties.migrationStatus === MigrationStatus.InProgress || this._model.migrationStatus.properties.migrationStatus === 'Completing') ? azdata.window.MessageLevel.Warning : azdata.window.MessageLevel.Error,
description: this.getMigrationDetails()
}; };
const sqlServerInfo = await azdata.connection.getServerInfo((await azdata.connection.getCurrentConnection()).connectionId); const sqlServerInfo = await azdata.connection.getServerInfo((await azdata.connection.getCurrentConnection()).connectionId);
const sqlServerName = this._model._migration.sourceConnectionProfile.serverName; const sqlServerName = this._model._migration.sourceConnectionProfile.serverName;