mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-06 01:25:38 -05:00
Reverting the checkboxes because of scrollbar issue 5230 (#5271)
This commit is contained in:
@@ -13,11 +13,6 @@ const localize = nls.loadMessageBundle();
|
||||
|
||||
export class SchemaCompareResult {
|
||||
private differencesTable: azdata.TableComponent;
|
||||
private diffViewTopPane: azdata.FlexContainer;
|
||||
private includeComponent: azdata.TableComponent;
|
||||
private checkboxList: azdata.FlexContainer;
|
||||
private checkBoxes: azdata.CheckBoxComponent[] = [];
|
||||
private lastCheckBoxes: azdata.CheckBoxComponent[] = [];
|
||||
private loader: azdata.LoadingComponent;
|
||||
private editor: azdata.workspace.ModelViewEditor;
|
||||
private diffEditor: azdata.DiffEditorComponent;
|
||||
@@ -32,12 +27,10 @@ export class SchemaCompareResult {
|
||||
private applyButton: azdata.ButtonComponent;
|
||||
private SchemaCompareActionMap: Map<Number, string>;
|
||||
private comparisonResult: azdata.SchemaCompareResult;
|
||||
private lastComparisonResult: azdata.SchemaCompareResult;
|
||||
private sourceNameComponent: azdata.TableComponent;
|
||||
private targetNameComponent: azdata.TableComponent;
|
||||
private deploymentOptions: azdata.DeploymentOptions;
|
||||
private schemaCompareOptionDialog: SchemaCompareOptionsDialog;
|
||||
private viewModel: azdata.ModelView;
|
||||
|
||||
constructor(private sourceName: string, private targetName: string, private sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, private targetEndpointInfo: azdata.SchemaCompareEndpointInfo) {
|
||||
this.SchemaCompareActionMap = new Map<Number, string>();
|
||||
@@ -50,28 +43,11 @@ export class SchemaCompareResult {
|
||||
|
||||
this.editor.registerContent(async view => {
|
||||
|
||||
this.viewModel = view;
|
||||
this.differencesTable = view.modelBuilder.table().withProperties({
|
||||
data: [],
|
||||
height: 300
|
||||
}).component();
|
||||
|
||||
this.diffViewTopPane = view.modelBuilder.flexContainer().withLayout({
|
||||
flexFlow: 'row'
|
||||
}).withProperties({
|
||||
alignItems: 'stretch',
|
||||
horizontal: true
|
||||
}).component();
|
||||
|
||||
this.checkboxList = view.modelBuilder.flexContainer().withLayout({
|
||||
flexFlow: 'column'
|
||||
}).component();
|
||||
|
||||
this.includeComponent = view.modelBuilder.table().withProperties({
|
||||
data: [],
|
||||
height: 28,
|
||||
}).component();
|
||||
|
||||
this.diffEditor = view.modelBuilder.diffeditor().withProperties({
|
||||
contentLeft: os.EOL,
|
||||
contentRight: os.EOL,
|
||||
@@ -216,24 +192,7 @@ export class SchemaCompareResult {
|
||||
}]
|
||||
});
|
||||
|
||||
this.includeComponent.updateProperties({
|
||||
data: [],
|
||||
columns: [
|
||||
{
|
||||
value: localize('schemaCompare.Include', 'Include'),
|
||||
cssClass: 'center-align',
|
||||
width: 25
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.checkboxList.clearItems();
|
||||
this.checkboxList.addItem(this.includeComponent);
|
||||
this.checkBoxes.forEach(box => this.checkboxList.addItem(box, { CSSStyles: { 'height': '24px', 'border-bottom': '1px #BDBDBD solid', 'border-right': '1px #BDBDBD dotted' } }));
|
||||
this.diffViewTopPane.addItem(this.checkboxList, { CSSStyles: { 'margin-left': '10px', 'width': '4%' } });
|
||||
this.diffViewTopPane.addItem(this.differencesTable, { CSSStyles: { 'width': '96%' } });
|
||||
|
||||
this.splitView.addItem(this.diffViewTopPane);
|
||||
this.splitView.addItem(this.differencesTable);
|
||||
this.splitView.addItem(this.diffEditor);
|
||||
this.splitView.setLayout({
|
||||
orientation: 'vertical',
|
||||
@@ -279,34 +238,10 @@ export class SchemaCompareResult {
|
||||
|
||||
private getAllDifferences(differences: azdata.DiffEntry[]): string[][] {
|
||||
let data = [];
|
||||
this.checkBoxes = [];
|
||||
if (differences) {
|
||||
differences.forEach(difference => {
|
||||
if (difference.differenceType === azdata.SchemaDifferenceType.Object) {
|
||||
if (difference.sourceValue !== null || difference.targetValue !== null) {
|
||||
let checkbox: azdata.CheckBoxComponent = this.viewModel.modelBuilder.checkBox().withProperties({
|
||||
checked: this.populateFromState(difference)
|
||||
}).component();
|
||||
|
||||
checkbox.onChanged(async () => {
|
||||
if (checkbox.checked) {
|
||||
let service = await SchemaCompareResult.getService('MSSQL');
|
||||
let result = await service.schemaCompareIncludeExcludeNode(this.comparisonResult.operationId, difference, true, azdata.TaskExecutionMode.execute);
|
||||
if (!result || !result.success) {
|
||||
vscode.window.showErrorMessage(
|
||||
localize('schemaCompare.includeNodeErrorMessage', "Include Node failed. Reason: '{0}'", (result && result.errorMessage) ? result.errorMessage : 'Unknown'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
let service = await SchemaCompareResult.getService('MSSQL');
|
||||
let result = await service.schemaCompareIncludeExcludeNode(this.comparisonResult.operationId, difference, false, azdata.TaskExecutionMode.execute);
|
||||
if (!result || !result.success) {
|
||||
vscode.window.showErrorMessage(
|
||||
localize('schemaCompare.excludeNodeErrorMessage', "Exclude Node failed. Reason: '{0}'", (result && result.errorMessage) ? result.errorMessage : 'Unknown'));
|
||||
}
|
||||
}
|
||||
});
|
||||
this.checkBoxes.push(checkbox);
|
||||
data.push([difference.name, difference.sourceValue, this.SchemaCompareActionMap[difference.updateAction], difference.targetValue]);
|
||||
}
|
||||
}
|
||||
@@ -330,18 +265,6 @@ export class SchemaCompareResult {
|
||||
return script;
|
||||
}
|
||||
|
||||
private populateFromState(diffEntry: azdata.DiffEntry): boolean {
|
||||
if (!this.lastComparisonResult || !this.lastCheckBoxes) {
|
||||
return true;
|
||||
}
|
||||
let lastIndex = this.lastComparisonResult.differences.findIndex(x => x.sourceValue === diffEntry.sourceValue && x.targetValue === diffEntry.targetValue && x.name === diffEntry.name);
|
||||
if (lastIndex === -1 || lastIndex >= this.lastCheckBoxes.length) {
|
||||
// couldnt find the change or the check box corresponsing to it
|
||||
return true;
|
||||
}
|
||||
return this.lastCheckBoxes[lastIndex].checked;
|
||||
}
|
||||
|
||||
private reExecute(): void {
|
||||
this.flexModel.removeItem(this.splitView);
|
||||
this.flexModel.removeItem(this.noDifferencesLabel);
|
||||
@@ -352,10 +275,6 @@ export class SchemaCompareResult {
|
||||
});
|
||||
this.differencesTable.selectedRows = null;
|
||||
this.resetButtons();
|
||||
|
||||
this.lastCheckBoxes = this.checkBoxes;
|
||||
this.lastComparisonResult = this.comparisonResult; //To populate state related UX
|
||||
|
||||
this.execute();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user