mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Bug/schema compare apply confirmation (#5698)
* Ask confirmation before apply * Adding PR comments
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||||
"version": "1.5.0-alpha.96",
|
"version": "1.5.0-alpha.98",
|
||||||
"downloadFileNames": {
|
"downloadFileNames": {
|
||||||
"Windows_86": "win-x86-netcoreapp2.2.zip",
|
"Windows_86": "win-x86-netcoreapp2.2.zip",
|
||||||
"Windows_64": "win-x64-netcoreapp2.2.zip",
|
"Windows_64": "win-x64-netcoreapp2.2.zip",
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { Telemetry } from './telemetry';
|
|||||||
import { getTelemetryErrorType } from './utils';
|
import { getTelemetryErrorType } from './utils';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
const diffEditorTitle = localize('schemaCompare.ObjectDefinitionsTitle', 'Object Definitions');
|
const diffEditorTitle = localize('schemaCompare.ObjectDefinitionsTitle', 'Object Definitions');
|
||||||
|
const applyConfirmation = localize('schemaCompare.ApplyConfirmation', 'Are you sure you want to update the target?');
|
||||||
|
|
||||||
export class SchemaCompareResult {
|
export class SchemaCompareResult {
|
||||||
private differencesTable: azdata.TableComponent;
|
private differencesTable: azdata.TableComponent;
|
||||||
@@ -182,7 +183,7 @@ export class SchemaCompareResult {
|
|||||||
this.deploymentOptions = this.schemaCompareOptionDialog.deploymentOptions;
|
this.deploymentOptions = this.schemaCompareOptionDialog.deploymentOptions;
|
||||||
}
|
}
|
||||||
Telemetry.sendTelemetryEvent('SchemaComparisonStarted');
|
Telemetry.sendTelemetryEvent('SchemaComparisonStarted');
|
||||||
let service = await SchemaCompareResult.getService('MSSQL');
|
const service = await SchemaCompareResult.getService('MSSQL');
|
||||||
this.comparisonResult = await service.schemaCompare(this.sourceEndpointInfo, this.targetEndpointInfo, azdata.TaskExecutionMode.execute, this.deploymentOptions);
|
this.comparisonResult = await service.schemaCompare(this.sourceEndpointInfo, this.targetEndpointInfo, azdata.TaskExecutionMode.execute, this.deploymentOptions);
|
||||||
if (!this.comparisonResult || !this.comparisonResult.success) {
|
if (!this.comparisonResult || !this.comparisonResult.success) {
|
||||||
Telemetry.sendTelemetryEventForError('SchemaComparisonFailed', {
|
Telemetry.sendTelemetryEventForError('SchemaComparisonFailed', {
|
||||||
@@ -431,8 +432,8 @@ export class SchemaCompareResult {
|
|||||||
'startTime:': Date.now().toString(),
|
'startTime:': Date.now().toString(),
|
||||||
'operationId': this.comparisonResult.operationId
|
'operationId': this.comparisonResult.operationId
|
||||||
});
|
});
|
||||||
let service = await SchemaCompareResult.getService('MSSQL');
|
const service = await SchemaCompareResult.getService('MSSQL');
|
||||||
let result = await service.schemaCompareGenerateScript(this.comparisonResult.operationId, this.targetEndpointInfo.serverName, this.targetEndpointInfo.databaseName, azdata.TaskExecutionMode.script);
|
const result = await service.schemaCompareGenerateScript(this.comparisonResult.operationId, this.targetEndpointInfo.serverName, this.targetEndpointInfo.databaseName, azdata.TaskExecutionMode.script);
|
||||||
if (!result || !result.success) {
|
if (!result || !result.success) {
|
||||||
Telemetry.sendTelemetryEvent('SchemaCompareGenerateScriptFailed', {
|
Telemetry.sendTelemetryEvent('SchemaCompareGenerateScriptFailed', {
|
||||||
'errorType': getTelemetryErrorType(result.errorMessage),
|
'errorType': getTelemetryErrorType(result.errorMessage),
|
||||||
@@ -482,13 +483,18 @@ export class SchemaCompareResult {
|
|||||||
},
|
},
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
|
// need only yes button - since the modal dialog has a default cancel
|
||||||
|
const yesString = localize('schemaCompare.ApplyYes', 'Yes');
|
||||||
this.applyButton.onDidClick(async (click) => {
|
this.applyButton.onDidClick(async (click) => {
|
||||||
|
|
||||||
|
vscode.window.showWarningMessage(applyConfirmation, { modal: true }, yesString).then(async (result) => {
|
||||||
|
if (result === yesString) {
|
||||||
Telemetry.sendTelemetryEvent('SchemaCompareApplyStarted', {
|
Telemetry.sendTelemetryEvent('SchemaCompareApplyStarted', {
|
||||||
'startTime': Date.now().toString(),
|
'startTime': Date.now().toString(),
|
||||||
'operationId': this.comparisonResult.operationId
|
'operationId': this.comparisonResult.operationId
|
||||||
});
|
});
|
||||||
let service = await SchemaCompareResult.getService('MSSQL');
|
const service = await SchemaCompareResult.getService('MSSQL');
|
||||||
let result = await service.schemaComparePublishChanges(this.comparisonResult.operationId, this.targetEndpointInfo.serverName, this.targetEndpointInfo.databaseName, azdata.TaskExecutionMode.execute);
|
const result = await service.schemaComparePublishChanges(this.comparisonResult.operationId, this.targetEndpointInfo.serverName, this.targetEndpointInfo.databaseName, azdata.TaskExecutionMode.execute);
|
||||||
if (!result || !result.success) {
|
if (!result || !result.success) {
|
||||||
Telemetry.sendTelemetryEvent('SchemaCompareApplyFailed', {
|
Telemetry.sendTelemetryEvent('SchemaCompareApplyFailed', {
|
||||||
'errorType': getTelemetryErrorType(result.errorMessage),
|
'errorType': getTelemetryErrorType(result.errorMessage),
|
||||||
@@ -501,6 +507,8 @@ export class SchemaCompareResult {
|
|||||||
'endTime': Date.now().toString(),
|
'endTime': Date.now().toString(),
|
||||||
'operationId': this.comparisonResult.operationId
|
'operationId': this.comparisonResult.operationId
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,7 +579,7 @@ export class SchemaCompareResult {
|
|||||||
|
|
||||||
private async GetDefaultDeploymentOptions(): Promise<void> {
|
private async GetDefaultDeploymentOptions(): Promise<void> {
|
||||||
// Same as dacfx default options
|
// Same as dacfx default options
|
||||||
let service = await SchemaCompareResult.getService('MSSQL');
|
const service = await SchemaCompareResult.getService('MSSQL');
|
||||||
let result = await service.schemaCompareGetDefaultOptions();
|
let result = await service.schemaCompareGetDefaultOptions();
|
||||||
this.deploymentOptions = result.defaultDeploymentOptions;
|
this.deploymentOptions = result.defaultDeploymentOptions;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user