Adding reset for options (#5483)

Adding reset for schema compare options (fix for bug #5483)
This commit is contained in:
udeeshagautam
2019-05-15 10:43:13 -07:00
committed by GitHub
parent 8c05c6e122
commit 5470702c16

View File

@@ -13,6 +13,7 @@ const localize = nls.loadMessageBundle();
export class SchemaCompareOptionsDialog {
private static readonly OkButtonText: string = localize('SchemaCompareOptionsDialog.Ok', 'Ok');
private static readonly CancelButtonText: string = localize('SchemaCompareOptionsDialog.Cancel', 'Cancel');
private static readonly ResetButtonText: string = localize('SchemaCompareOptionsDialog.Reset', 'Reset');
private static readonly OptionsLabel: string = localize('SchemaCompare.SchemaCompareOptionsDialogLabel', 'Schema Compare Options');
private static readonly GeneralOptionsLabel: string = localize('SchemaCompare.GeneralOptionsLabel', 'General Options');
private static readonly ObjectTypesOptionsLabel: string = localize('SchemaCompare.ObjectTypesOptionsLabel', 'Include Object Types');
@@ -424,6 +425,11 @@ export class SchemaCompareOptionsDialog {
this.dialog.cancelButton.label = SchemaCompareOptionsDialog.CancelButtonText;
this.dialog.cancelButton.onClick(async () => await this.cancel());
let resetButton = azdata.window.createButton(SchemaCompareOptionsDialog.ResetButtonText);
resetButton.onClick(async () => await this.reset());
this.dialog.customButtons = [];
this.dialog.customButtons.push(resetButton);
azdata.window.openDialog(this.dialog);
}
@@ -435,6 +441,19 @@ export class SchemaCompareOptionsDialog {
protected async cancel() {
}
private async reset() {
let service = await azdata.dataprotocol.getProvider<azdata.SchemaCompareServicesProvider>('MSSQL', azdata.DataProviderType.SchemaCompareServicesProvider);
let result = await service.schemaCompareGetDefaultOptions();
this.deploymentOptions = result.defaultDeploymentOptions;
this.generaloptionsCheckBoxes.forEach(option => {
option.checked = this.GetSchemaCompareOptionUtil(option.label);
});
this.objectTypesCheckBoxes.forEach(obj => {
obj.checked = this.GetSchemaCompareIncludedObjectsUtil(obj.label);
});
}
private async initializeSchemaCompareOptionsDialogTab() {
this.generalOptionsTab.registerContent(async view => {