a couple more fixes for table filter (#15121)

* a few fixes

* add comments and fix for non-ideal scenario
This commit is contained in:
Alan Ren
2021-04-14 10:20:29 -07:00
committed by GitHub
parent 5922047f6b
commit 842a33e318
9 changed files with 131 additions and 106 deletions

View File

@@ -15,7 +15,7 @@ import { ComponentBase } from 'sql/workbench/browser/modelComponents/componentBa
import { Table } from 'sql/base/browser/ui/table/table';
import { TableDataView } from 'sql/base/browser/ui/table/tableDataView';
import { attachTableStyler } from 'sql/platform/theme/common/styler';
import { attachTableFilterStyler, attachTableStyler } from 'sql/platform/theme/common/styler';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { getContentHeight, getContentWidth, Dimension, isAncestor } from 'vs/base/browser/dom';
import { RowSelectionModel } from 'sql/base/browser/ui/table/plugins/rowSelectionModel.plugin';
@@ -34,7 +34,6 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import { ILogService } from 'vs/platform/log/common/log';
import { TableCellClickEventArgs } from 'sql/base/browser/ui/table/plugins/tableColumn';
import { HyperlinkCellValue, HyperlinkColumn } from 'sql/base/browser/ui/table/plugins/hyperlinkColumn.plugin';
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
export enum ColumnSizingMode {
@@ -503,7 +502,7 @@ export default class TableComponent extends ComponentBase<azdata.TableComponentP
private registerFilterPlugin() {
const filterPlugin = new HeaderFilter<Slick.SlickData>(this.contextViewService);
this._register(attachButtonStyler(filterPlugin, this.themeService));
this._register(attachTableFilterStyler(filterPlugin, this.themeService));
this._filterPlugin = filterPlugin;
this._filterPlugin.onFilterApplied.subscribe((e, args) => {
let filterValues = (<any>args).column.filterValues;

View File

@@ -45,8 +45,8 @@ import { ITableStyles } from 'sql/base/browser/ui/table/interfaces';
import { TelemetryView } from 'sql/platform/telemetry/common/telemetryKeys';
import { LocalizedStrings } from 'sql/workbench/contrib/assessment/common/strings';
import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo';
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { attachTableFilterStyler } from 'sql/platform/theme/common/styler';
export const ASMTRESULTSVIEW_SELECTOR: string = 'asmt-results-view-component';
export const ROW_HEIGHT: number = 25;
@@ -319,7 +319,7 @@ export class AsmtResultsViewComponent extends TabChild implements IAssessmentCom
columns.unshift(columnDef);
let filterPlugin = new HeaderFilter<Slick.SlickData>(this._contextViewService);
this._register(attachButtonStyler(filterPlugin, this._themeService));
this._register(attachTableFilterStyler(filterPlugin, this._themeService));
this.filterPlugin = filterPlugin;
this.filterPlugin.onFilterApplied.subscribe((e, args) => {
let filterValues = args.column.filterValues;
@@ -588,10 +588,8 @@ export class AsmtResultsViewComponent extends TabChild implements IAssessmentCom
return seen.sort((v) => { return v; });
}
private async getFilterValuesByInput($input: JQuery<HTMLElement>): Promise<Array<string>> {
const column = $input.data('column'),
filter = $input.val() as string,
dataView = this['grid'].getData() as Slick.DataProvider<Slick.SlickData>,
private async getFilterValuesByInput(column: Slick.Column<any>, filter: string): Promise<Array<string>> {
const dataView = this['grid'].getData() as Slick.DataProvider<Slick.SlickData>,
seen: Array<any> = [];
for (let i = 0; i < dataView.getLength(); i++) {

View File

@@ -33,7 +33,7 @@ import { TelemetryView } from 'sql/platform/telemetry/common/telemetryKeys';
import { IColorTheme } from 'vs/platform/theme/common/themeService';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { attachTableFilterStyler } from 'sql/platform/theme/common/styler';
export const JOBSVIEW_SELECTOR: string = 'jobsview-component';
export const ROW_HEIGHT: number = 45;
@@ -183,7 +183,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
this.rowDetail = rowDetail;
columns.unshift(this.rowDetail.getColumnDefinition());
let filterPlugin = new HeaderFilter<IItem>(this._contextViewService);
this._register(attachButtonStyler(filterPlugin, this._themeService));
this._register(attachTableFilterStyler(filterPlugin, this._themeService));
this.filterPlugin = filterPlugin;
jQuery(this._gridEl.nativeElement).empty();
jQuery(this.actionBarContainer.nativeElement).empty();

View File

@@ -34,7 +34,7 @@ import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IColorTheme } from 'vs/platform/theme/common/themeService';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { attachTableFilterStyler } from 'sql/platform/theme/common/styler';
export const NOTEBOOKSVIEW_SELECTOR: string = 'notebooksview-component';
@@ -183,7 +183,7 @@ export class NotebooksViewComponent extends JobManagementView implements OnInit,
this.rowDetail = rowDetail;
columns.unshift(this.rowDetail.getColumnDefinition());
let filterPlugin = new HeaderFilter<IItem>(this._contextViewService);
this._register(attachButtonStyler(filterPlugin, this._themeService));
this._register(attachTableFilterStyler(filterPlugin, this._themeService));
this.filterPlugin = filterPlugin;
jQuery(this._gridEl.nativeElement).empty();
jQuery(this.actionBarContainer.nativeElement).empty();

View File

@@ -6,7 +6,7 @@
import 'vs/css!./media/gridPanel';
import { ITableStyles, ITableMouseEvent, FilterableColumn } from 'sql/base/browser/ui/table/interfaces';
import { attachTableStyler } from 'sql/platform/theme/common/styler';
import { attachTableFilterStyler, attachTableStyler } from 'sql/platform/theme/common/styler';
import QueryRunner, { QueryGridDataProvider } from 'sql/workbench/services/query/common/queryRunner';
import { ResultSetSummary, IColumn, ICellValue } from 'sql/workbench/services/query/common/query';
import { VirtualizedCollection } from 'sql/base/browser/ui/table/asyncDataView';
@@ -50,7 +50,6 @@ import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
import { Orientation } from 'vs/base/browser/ui/splitview/splitview';
import { IQueryModelService } from 'sql/workbench/services/query/common/queryModel';
import { HeaderFilter } from 'sql/base/browser/ui/table/plugins/headerFilter.plugin';
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { HybridDataProvider } from 'sql/base/browser/ui/table/hybridDataProvider';
const ROW_HEIGHT = 29;
@@ -529,7 +528,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
}));
if (this.enableFilteringFeature) {
this.filterPlugin = new HeaderFilter(this.contextViewService);
attachButtonStyler(this.filterPlugin, this.themeService);
attachTableFilterStyler(this.filterPlugin, this.themeService);
this.table.registerPlugin(this.filterPlugin);
}
if (this.styles) {

View File

@@ -6,7 +6,7 @@
import 'vs/css!./media/resourceViewerTable';
import * as azdata from 'azdata';
import { Table } from 'sql/base/browser/ui/table/table';
import { attachTableStyler } from 'sql/platform/theme/common/styler';
import { attachTableFilterStyler, attachTableStyler } from 'sql/platform/theme/common/styler';
import { RowSelectionModel } from 'sql/base/browser/ui/table/plugins/rowSelectionModel.plugin';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
@@ -24,7 +24,6 @@ import { ColumnDefinition } from 'sql/workbench/browser/editor/resourceViewer/re
import { Emitter } from 'vs/base/common/event';
import { ContextMenuAnchor } from 'sql/workbench/contrib/resourceViewer/browser/resourceViewerEditor';
import { LoadingSpinnerPlugin } from 'sql/base/browser/ui/table/plugins/loadingSpinner.plugin';
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
export class ResourceViewerTable extends Disposable {
@@ -57,7 +56,7 @@ export class ResourceViewerTable extends Disposable {
this._resourceViewerTable.setSelectionModel(new RowSelectionModel());
let filterPlugin = new HeaderFilter<azdata.DataGridItem>(this._contextViewService);
this._register(attachButtonStyler(filterPlugin, this._themeService));
this._register(attachTableFilterStyler(filterPlugin, this._themeService));
this._register(attachTableStyler(this._resourceViewerTable, this._themeService));
this._register(this._resourceViewerTable.onClick(this.onTableClick, this));
this._register(this._resourceViewerTable.onContextMenu((e: ITableMouseEvent) => {