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
Show file tree
Hide file tree
Changes from 58 commits
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
6 changes: 4 additions & 2 deletions packages/kbn-es-query/src/filters/lib/meta_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ export interface FilterMeta {
}

export interface Filter {
$state: FilterState;
$state?: FilterState;
meta: FilterMeta;
query?: object;
}

export type Filters = Filter[];
lizozom marked this conversation as resolved.
Show resolved Hide resolved

export interface LatLon {
lat: number;
lon: number;
Expand All @@ -62,7 +64,7 @@ export function buildEmptyFilter(isPinned: boolean, index?: string): Filter {
}

export function isFilterPinned(filter: Filter) {
return filter.$state.store === FilterStateStore.GLOBAL_STATE;
return filter.$state && filter.$state.store === FilterStateStore.GLOBAL_STATE;
}

export function toggleFilterDisabled(filter: Filter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'ngreact';
import { uiModules } from 'ui/modules';
import template from './directive.html';
import { ApplyFiltersPopover } from './apply_filters_popover';
import { mapAndFlattenFilters } from 'ui/filter_manager/lib/map_and_flatten_filters';
import { mapAndFlattenFilters } from '../filter_manager/lib/map_and_flatten_filters';
import { wrapInI18nContext } from 'ui/i18n';

const app = uiModules.get('app/data', ['react']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,17 +441,20 @@ class FilterEditorUI extends Component<Props, State> {
queryDsl,
} = this.state;

const { store } = this.props.filter.$state;
const { $state } = this.props.filter;
if (!$state || !$state.store) {
lizozom marked this conversation as resolved.
Show resolved Hide resolved
return; // typescript validation
}
const alias = useCustomLabel ? customLabel : null;

if (isCustomEditorOpen) {
const { index, disabled, negate } = this.props.filter.meta;
const newIndex = index || this.props.indexPatterns[0].id;
const body = JSON.parse(queryDsl);
const filter = buildCustomFilter(newIndex, body, disabled, negate, alias, store);
const filter = buildCustomFilter(newIndex, body, disabled, negate, alias, $state.store);
this.props.onSubmit(filter);
} else if (indexPattern && field && operator) {
const filter = buildFilter(indexPattern, field, operator, params, alias, store);
const filter = buildFilter(indexPattern, field, operator, params, alias, $state.store);
this.props.onSubmit(filter);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ describe('Filter editor utils', () => {
const filter = buildFilter(mockIndexPattern, mockFields[0], isOperator, params, alias, state);
expect(filter.meta.negate).toBe(isOperator.negate);
expect(filter.meta.alias).toBe(alias);
expect(filter.$state.store).toBe(state);

expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
}
});

it('should build phrases filters', () => {
Expand All @@ -257,7 +261,10 @@ describe('Filter editor utils', () => {
expect(filter.meta.type).toBe(isOneOfOperator.type);
expect(filter.meta.negate).toBe(isOneOfOperator.negate);
expect(filter.meta.alias).toBe(alias);
expect(filter.$state.store).toBe(state);
expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
}
});

it('should build range filters', () => {
Expand All @@ -274,7 +281,10 @@ describe('Filter editor utils', () => {
);
expect(filter.meta.negate).toBe(isBetweenOperator.negate);
expect(filter.meta.alias).toBe(alias);
expect(filter.$state.store).toBe(state);
expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
lizozom marked this conversation as resolved.
Show resolved Hide resolved
}
});

it('should build exists filters', () => {
Expand All @@ -291,7 +301,10 @@ describe('Filter editor utils', () => {
);
expect(filter.meta.negate).toBe(existsOperator.negate);
expect(filter.meta.alias).toBe(alias);
expect(filter.$state.store).toBe(state);
expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
}
});

it('should negate based on operator', () => {
Expand All @@ -308,7 +321,10 @@ describe('Filter editor utils', () => {
);
expect(filter.meta.negate).toBe(doesNotExistOperator.negate);
expect(filter.meta.alias).toBe(alias);
expect(filter.$state.store).toBe(state);
expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
}
});
});
});
Loading