Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Filter \ Filter Manager: de-angularize and move to data plugin #37311

Merged
Merged
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
fb72077
Embeddable and Visualize to use type definitions from kbn-es-query pa…
May 22, 2019
33e3684
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
May 29, 2019
f243294
moved state watching to new filter manager and removed query filter d…
May 29, 2019
4b70360
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
May 30, 2019
fe60536
Deleted unused pinFilter
May 30, 2019
6231d85
Extracted merge fitlers function
May 30, 2019
cff30fc
Changed mappedFilters name
May 30, 2019
ec4ae2f
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 3, 2019
ebf7dbd
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 4, 2019
e87524e
Move state management to new filter management as well. query filter …
Jun 4, 2019
6cde2a7
Code works correctly with new setup of query filter
Jun 5, 2019
08ef0cd
improved typing
Jun 5, 2019
a26489f
Moved mapping into new filter manager
Jun 5, 2019
1178338
removed promise dependency from query filter
Jun 5, 2019
9f0c490
Extracted filter state manager from query filter
Jun 5, 2019
313edcc
Moved addFiltersAndChangeTimeFilter logic into new filter manager
Jun 5, 2019
348461a
Fixed addFiltersAndChangeTimeFilter implementation
Jun 6, 2019
efc85d9
Moved all logic to new filter manager - query filter is just a wrappe…
Jun 6, 2019
ced4d16
Connected query_filter observable management to new filter manager as…
Jun 6, 2019
f1e142e
Usage example in discover
Jun 6, 2019
4bb875b
filter state management tests + fire less events from filter state ma…
Jun 6, 2019
a54b7a3
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 10, 2019
cba1b04
Tests for filter manager and filter state manager
Jun 10, 2019
2ad98e5
Moved new filter manager to data plugin
Jun 10, 2019
d5d09d8
Got rid of FilterManagerProvider and turned it into a getFilterGenera…
Jun 10, 2019
f4d8a3b
Added tests that make sure that filter manager listens to filter stat…
Jun 10, 2019
ad329be
fix typo
Jun 10, 2019
0d1beca
Fixed action add filter test
Jun 10, 2019
1354b6c
Fixed increasePredecessorCount test
Jun 10, 2019
557ff85
Fixed increaseSuccessorCount test
Jun 10, 2019
0be0d02
Fixed setPredecessorCount test
Jun 10, 2019
1166bef
Fixed setQueryParameters test
Jun 10, 2019
b0be03a
Fixed setSuccessorCount test
Jun 10, 2019
23fd40c
Fixed doc table filter actions test
Jun 10, 2019
78822c1
Fixed filter generator tests
Jun 10, 2019
f112acb
rename argument
Jun 10, 2019
bc7b11b
Moved push filters into vis filters (only place where its used)
Jun 10, 2019
1c40426
Filter type fix, test fix
Jun 10, 2019
cf82adf
Removed irrelevant filter tests (for deleted methods)
Jun 11, 2019
c3d52c3
Fixed most of get filters errors by sleeping (TODO!)
Jun 11, 2019
f4c472a
Added destroy methods
Jun 11, 2019
0230a80
Fixed discover functional tests
Jun 12, 2019
6bec62e
Allow filter $state to be empty
Jun 12, 2019
4cf4654
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 12, 2019
1392346
Fixed types
Jun 12, 2019
194dc6a
Code review with @splager
Jun 12, 2019
1f75907
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 13, 2019
91a88e5
Separate class\type defenitions from plugin instance setup in shim pl…
Jun 13, 2019
0b87154
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 13, 2019
3dfa64c
Merge branch 'newplatform/data-plugin/plugin-export-strategy' into ne…
Jun 13, 2019
e800662
typescript fun
Jun 13, 2019
25123c8
Merge branch 'newplatform/data-plugin/plugin-export-strategy' into ne…
Jun 13, 2019
c329970
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 13, 2019
d4a34d3
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 16, 2019
b883443
Fixed merge
Jun 16, 2019
8cd7b39
updated some get filter tests to work with add filter, and therefore …
Jun 16, 2019
1913be0
Remove shouldFetch and add comment explaning the observable.
Jun 16, 2019
01498a1
Minor code style fixes
Jun 16, 2019
266cce5
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 20, 2019
6358545
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 23, 2019
cffb259
Code review fixes and changes
Jun 24, 2019
cd5cf08
Moved Karma tests to jest
Jun 24, 2019
faabd68
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 24, 2019
2a5ed37
Fixed merge
Jun 24, 2019
4134965
Fixed some type errors
Jun 24, 2019
378799f
Improved watchFilterState logic
Jun 25, 2019
04ae2ed
Removed addFiltersAndChangeTimeFilter test for now, as I'm having TS …
Jun 25, 2019
72a188c
filters can also be null
Jun 25, 2019
8ec3936
Further watch state fine tuning
Jun 25, 2019
a64ed11
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 26, 2019
3cd053d
Get data instance inside provider to avoid circular deps
Jun 26, 2019
c349177
mock chrome
Jun 26, 2019
0dbc4fc
Removed change to range filter
Jun 26, 2019
87c3e10
Deleted unnecessary injects
Jun 26, 2019
93360c7
dedup setFilters as well
Jun 27, 2019
abc9506
deleted unused subscription
Jun 27, 2019
cf7173b
Added tests for setFilters de-dupe
Jun 27, 2019
dabaa1b
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 27, 2019
496d976
Update src/legacy/core_plugins/data/public/filter/filter_manager/filt…
lizozom Jun 27, 2019
b43256f
Update src/legacy/core_plugins/data/public/filter/filter_manager/filt…
lizozom Jun 27, 2019
399bfc5
Merge remote-tracking branch 'upstream/master' into newplatform/data-…
Jun 30, 2019
273e64d
Merge branch 'newplatform/data-plugin/filter-manager-1' of github.com…
Jun 30, 2019
4376e3e
Code review minor fixes
Jun 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improved typing
Liza Katz committed Jun 5, 2019
commit 08ef0cd1237c63d32a6f50d1256f6b15c1379d49
28 changes: 12 additions & 16 deletions src/legacy/ui/public/filter_manager/new_filter_manager.ts
Original file line number Diff line number Diff line change
@@ -32,20 +32,20 @@ import { mapAndFlattenFilters } from './lib/map_and_flatten_filters';
import { uniqFilters } from './lib/uniq_filters';

interface PartitionedFilters {
globalFilters: any[];
appFilters: any[];
globalFilters: Filter[];
appFilters: Filter[];
}

interface DelayedChangeNotification {
callback: (() => void) | undefined;
}

export class FilterManager {
filters: any[] = [];
filters: Filter[] = [];
updated$: Subject<any> = new Subject();

constructor(filters: any[]);
constructor(filters: any[], globalFilters?: []) {
constructor(filters: Filter[]);
constructor(filters: Filter[], globalFilters?: Filter[]) {
if (globalFilters) {
filters = this.mergeFilters(filters, globalFilters);
}
@@ -63,22 +63,22 @@ export class FilterManager {
};
}

private filtersUpdated(newFilters: any[]): boolean {
private filtersUpdated(newFilters: Filter[]): boolean {
return !_.isEqual(this.filters, newFilters);
}

private shouldFetch(newFilters: any[]) {
private shouldFetch(newFilters: Filter[]) {
return !onlyDisabled(newFilters, this.filters) && !onlyStateChanged(newFilters, this.filters);
}

private mergeFilters(newFilters: any[], oldFilters: any[]): any[] {
private mergeFilters(newFilters: Filter[], oldFilters: Filter[]): Filter[] {
// Order matters!
// uniqFilters will throw out duplicates from the back of the array,
// but we want newer filters to overwrite previously created filters.
return uniqFilters(newFilters.concat(oldFilters));
}

private emitUpdateIfChanged(newFilters: any[]) {
private emitUpdateIfChanged(newFilters: Filter[]) {
// This is an optimization
const shouldFetch = this.shouldFetch(newFilters);
if (this.filtersUpdated(newFilters)) {
@@ -106,7 +106,7 @@ export class FilterManager {
return this.updated$.asObservable();
}

public addFilters(filters: any, emitChanged?: boolean): DelayedChangeNotification {
public addFilters(filters: Filter[], emitChanged?: boolean): DelayedChangeNotification {
if (!Array.isArray(filters)) {
filters = [filters];
}
@@ -158,11 +158,7 @@ export class FilterManager {
return delayChangeNotification;
}

public updateFilter(filter: any): void {
return;
}

public removeFilter(filter: any, emitChanged?: boolean): DelayedChangeNotification {
public removeFilter(filter: Filter, emitChanged?: boolean): DelayedChangeNotification {
let delayChangeNotification: DelayedChangeNotification = {
callback: undefined,
};
@@ -192,7 +188,7 @@ export class FilterManager {
return delayChangeNotification;
}

public invertFilter(filter: any) {
public invertFilter(filter: Filter) {
return toggleFilterNegated(filter);
}