Fix schema compare include/exclude behavior (#8042)

* don't uncheck difference if unsuccessful

* changes after rebasing to get schema compare fix

* First cut of column checkbox checking reactive to include opteration

* handle blocking dependencies and affected dependencies

* Changing the checked property of table to be list

* Addressing comments

* add map to keep row number of diff entries

* remove findDifferenceRow() since it isn't needed anymore

* fix scrolling to the top when checking/unchecking and add info message

* change checked to updateCells

* improve warning cannot include/exclude message
This commit is contained in:
Kim Santiago
2019-10-29 11:55:31 -07:00
committed by GitHub
parent 5629356c66
commit ce5eb00177
9 changed files with 135 additions and 8 deletions

6
src/sql/azdata.d.ts vendored
View File

@@ -3089,9 +3089,15 @@ declare module 'azdata' {
ariaColumnCount?: number;
ariaRole?: string;
focused?: boolean;
updateCells?: TableCell[];
moveFocusOutWithTab?: boolean; //accessibility requirement for tables with no actionable cells
}
export interface CheckBoxCell extends TableCell {
checked: boolean;
columnName: string;
}
export interface FileBrowserTreeProperties extends ComponentProperties {
ownerUri: string;
}

View File

@@ -189,7 +189,24 @@ export class CheckboxSelectColumn<T extends Slick.SlickData> implements Slick.Pl
}
//Ensure that the focus stays correct
this._grid.getActiveCellNode().focus();
if(this._grid.getActiveCellNode()) {
this._grid.getActiveCellNode().focus();
}
// set selected row to the row of this checkbox
this._grid.setSelectedRows([row]);
}
// This call is to handle reactive changes in check box UI
// This DOES NOT fire UI change Events
reactiveCheckboxCheck(row: number, value: boolean) {
value ? this._selectedCheckBoxLookup[row] = true : delete this._selectedCheckBoxLookup[row];
// update row to call formatter
this._grid.updateRow(row);
// ensure that grid reflects the change
this._grid.scrollRowIntoView(row);
}
private handleHeaderClick(e: Event, args: Slick.OnHeaderClickEventArgs<T>): void {

View File

@@ -1281,6 +1281,14 @@ class TableComponentWrapper extends ComponentWrapper implements azdata.TableComp
this.setProperty('focused', v);
}
public get updateCells(): azdata.TableCell[] {
return this.properties['updateCells'];
}
public set updateCells(v: azdata.TableCell[]) {
this.setProperty('updateCells', v);
}
public get onRowSelected(): vscode.Event<any> {
let emitter = this._emitterMap.get(ComponentEventType.onSelectedRowChanged);
return emitter && emitter.event;

View File

@@ -203,6 +203,12 @@ export enum ExtensionNodeType {
Database = 'Database'
}
export interface CheckBoxInfo {
row: number;
columnName: string;
checked: boolean;
}
export interface IComponentShape {
type: ModelComponentTypes;
id: string;

View File

@@ -26,6 +26,7 @@ import { Emitter, Event as vsEvent } from 'vs/base/common/event';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { slickGridDataItemColumnValueWithNoData, textFormatter } from 'sql/base/browser/ui/table/formatters';
import { isNullOrUndefined } from 'util';
@Component({
selector: 'modelview-table',
@@ -255,10 +256,27 @@ export default class TableComponent extends ComponentBase implements IComponent,
this._table.focus();
}
if (this.updateCells !== undefined) {
this.updateTableCells(this.updateCells);
}
this.layoutTable();
this.validate();
}
private updateTableCells(cellInfos): void {
cellInfos.forEach((cellInfo) => {
if (isNullOrUndefined(cellInfo.column) || isNullOrUndefined(cellInfo.row) || cellInfo.row < 0 || cellInfo.row > this.data.length) {
return;
}
const checkInfo: azdata.CheckBoxCell = cellInfo as azdata.CheckBoxCell;
if (checkInfo) {
this._checkboxColumns[checkInfo.columnName].reactiveCheckboxCheck(checkInfo.row, checkInfo.checked);
}
});
}
private createCheckBoxPlugin(col: any, index: number) {
let name = col.value;
if (!this._checkboxColumns[col.value]) {
@@ -357,4 +375,12 @@ export default class TableComponent extends ComponentBase implements IComponent,
public set focused(newValue: boolean) {
this.setPropertyFromUI<azdata.RadioButtonProperties, boolean>((properties, value) => { properties.focused = value; }, newValue);
}
public get updateCells(): azdata.TableCell[] {
return this.getPropertyOrDefault<azdata.TableComponentProperties, azdata.TableCell[]>((props) => props.updateCells, undefined);
}
public set updateCells(newValue: azdata.TableCell[]) {
this.setPropertyFromUI<azdata.TableComponentProperties, azdata.TableCell[]>((properties, value) => { properties.updateCells = value; }, newValue);
}
}