mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Show message to recompare when schema compare options change (#5690)
* add message to recompare if options changed * changes after rebasing * Add compare button to notification * remove async * change to yes and no button
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
import { SchemaCompareResult } from '../schemaCompareResult';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
@@ -14,6 +15,9 @@ export class SchemaCompareOptionsDialog {
|
|||||||
private static readonly OkButtonText: string = localize('SchemaCompareOptionsDialog.Ok', 'Ok');
|
private static readonly OkButtonText: string = localize('SchemaCompareOptionsDialog.Ok', 'Ok');
|
||||||
private static readonly CancelButtonText: string = localize('SchemaCompareOptionsDialog.Cancel', 'Cancel');
|
private static readonly CancelButtonText: string = localize('SchemaCompareOptionsDialog.Cancel', 'Cancel');
|
||||||
private static readonly ResetButtonText: string = localize('SchemaCompareOptionsDialog.Reset', 'Reset');
|
private static readonly ResetButtonText: string = localize('SchemaCompareOptionsDialog.Reset', 'Reset');
|
||||||
|
private static readonly YesButtonText: string = localize('SchemaCompareOptionsDialog.Yes', 'Yes');
|
||||||
|
private static readonly NoButtonText: string = localize('SchemaCompareOptionsDialog.No', 'No');
|
||||||
|
private static readonly OptionsChangedMessage: string = localize('schemaCompareOptions.RecompareMessage', 'Options have changed. Recompare to see the comparison?');
|
||||||
private static readonly OptionsLabel: string = localize('SchemaCompare.SchemaCompareOptionsDialogLabel', 'Schema Compare Options');
|
private static readonly OptionsLabel: string = localize('SchemaCompare.SchemaCompareOptionsDialogLabel', 'Schema Compare Options');
|
||||||
private static readonly GeneralOptionsLabel: string = localize('SchemaCompare.GeneralOptionsLabel', 'General Options');
|
private static readonly GeneralOptionsLabel: string = localize('SchemaCompare.GeneralOptionsLabel', 'General Options');
|
||||||
private static readonly ObjectTypesOptionsLabel: string = localize('SchemaCompare.ObjectTypesOptionsLabel', 'Include Object Types');
|
private static readonly ObjectTypesOptionsLabel: string = localize('SchemaCompare.ObjectTypesOptionsLabel', 'Include Object Types');
|
||||||
@@ -256,6 +260,7 @@ export class SchemaCompareOptionsDialog {
|
|||||||
private disposableListeners: vscode.Disposable[] = [];
|
private disposableListeners: vscode.Disposable[] = [];
|
||||||
|
|
||||||
private excludedObjectTypes: azdata.SchemaObjectType[] = [];
|
private excludedObjectTypes: azdata.SchemaObjectType[] = [];
|
||||||
|
private optionsChanged: boolean = false;
|
||||||
|
|
||||||
private optionsLabels: string[] = [
|
private optionsLabels: string[] = [
|
||||||
SchemaCompareOptionsDialog.IgnoreTableOptions,
|
SchemaCompareOptionsDialog.IgnoreTableOptions,
|
||||||
@@ -405,7 +410,7 @@ export class SchemaCompareOptionsDialog {
|
|||||||
SchemaCompareOptionsDialog.ServerTriggers
|
SchemaCompareOptionsDialog.ServerTriggers
|
||||||
].sort();
|
].sort();
|
||||||
|
|
||||||
constructor(defaultOptions: azdata.DeploymentOptions) {
|
constructor(defaultOptions: azdata.DeploymentOptions, private schemaComparison: SchemaCompareResult) {
|
||||||
this.deploymentOptions = defaultOptions;
|
this.deploymentOptions = defaultOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,6 +445,13 @@ export class SchemaCompareOptionsDialog {
|
|||||||
protected async execute() {
|
protected async execute() {
|
||||||
this.SetDeploymentOptions();
|
this.SetDeploymentOptions();
|
||||||
this.SetObjectTypeOptions();
|
this.SetObjectTypeOptions();
|
||||||
|
if (this.optionsChanged) {
|
||||||
|
vscode.window.showWarningMessage(SchemaCompareOptionsDialog.OptionsChangedMessage, SchemaCompareOptionsDialog.YesButtonText, SchemaCompareOptionsDialog.NoButtonText).then((result) => {
|
||||||
|
if (result === SchemaCompareOptionsDialog.YesButtonText) {
|
||||||
|
this.schemaComparison.startCompare();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this.disposeListeners();
|
this.disposeListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,6 +463,7 @@ export class SchemaCompareOptionsDialog {
|
|||||||
let service = await azdata.dataprotocol.getProvider<azdata.SchemaCompareServicesProvider>('MSSQL', azdata.DataProviderType.SchemaCompareServicesProvider);
|
let service = await azdata.dataprotocol.getProvider<azdata.SchemaCompareServicesProvider>('MSSQL', azdata.DataProviderType.SchemaCompareServicesProvider);
|
||||||
let result = await service.schemaCompareGetDefaultOptions();
|
let result = await service.schemaCompareGetDefaultOptions();
|
||||||
this.deploymentOptions = result.defaultDeploymentOptions;
|
this.deploymentOptions = result.defaultDeploymentOptions;
|
||||||
|
this.optionsChanged = true;
|
||||||
|
|
||||||
this.updateOptionsTable();
|
this.updateOptionsTable();
|
||||||
this.optionsFlexBuilder.removeItem(this.optionsTable);
|
this.optionsFlexBuilder.removeItem(this.optionsTable);
|
||||||
@@ -495,6 +508,7 @@ export class SchemaCompareOptionsDialog {
|
|||||||
if (checkboxState && checkboxState.row !== undefined) {
|
if (checkboxState && checkboxState.row !== undefined) {
|
||||||
let label = this.optionsLabels[checkboxState.row];
|
let label = this.optionsLabels[checkboxState.row];
|
||||||
this.optionsLookup[label] = checkboxState.checked;
|
this.optionsLookup[label] = checkboxState.checked;
|
||||||
|
this.optionsChanged = true;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -526,6 +540,7 @@ export class SchemaCompareOptionsDialog {
|
|||||||
if (checkboxState && checkboxState.row !== undefined) {
|
if (checkboxState && checkboxState.row !== undefined) {
|
||||||
let label = this.objectTypeLabels[checkboxState.row];
|
let label = this.objectTypeLabels[checkboxState.row];
|
||||||
this.objectsLookup[label] = checkboxState.checked;
|
this.objectsLookup[label] = checkboxState.checked;
|
||||||
|
this.optionsChanged = true;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ export class SchemaCompareResult {
|
|||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
private startCompare(): void {
|
public startCompare(): void {
|
||||||
this.flexModel.removeItem(this.splitView);
|
this.flexModel.removeItem(this.splitView);
|
||||||
this.flexModel.removeItem(this.noDifferencesLabel);
|
this.flexModel.removeItem(this.noDifferencesLabel);
|
||||||
this.flexModel.removeItem(this.startText);
|
this.flexModel.removeItem(this.startText);
|
||||||
@@ -467,7 +467,7 @@ export class SchemaCompareResult {
|
|||||||
this.deploymentOptions = this.schemaCompareOptionDialog.deploymentOptions;
|
this.deploymentOptions = this.schemaCompareOptionDialog.deploymentOptions;
|
||||||
}
|
}
|
||||||
// create fresh every time
|
// create fresh every time
|
||||||
this.schemaCompareOptionDialog = new SchemaCompareOptionsDialog(this.deploymentOptions);
|
this.schemaCompareOptionDialog = new SchemaCompareOptionsDialog(this.deploymentOptions, this);
|
||||||
await this.schemaCompareOptionDialog.openDialog();
|
await this.schemaCompareOptionDialog.openDialog();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user