forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove redux tools from presentation_utils plugin (elastic#197891)
Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
f9a6be1
commit e7ed964
Showing
17 changed files
with
59 additions
and
694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/plugins/dashboard/public/utils/clean_filters_for_serialize.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { Filter } from '@kbn/es-query'; | ||
import { cleanFiltersForSerialize } from './clean_filters_for_serialize'; | ||
|
||
describe('cleanFiltersForSerialize', () => { | ||
test('should return an empty array if filters is not provided', () => { | ||
expect(cleanFiltersForSerialize()).toEqual([]); | ||
}); | ||
|
||
test('should remove "meta.value" property from each filter', () => { | ||
const filters: Filter[] = [ | ||
{ query: { a: 'a' }, meta: { value: 'value1' } }, | ||
{ query: { b: 'b' }, meta: { value: 'value2' } }, | ||
]; | ||
|
||
const cleanedFilters = cleanFiltersForSerialize(filters); | ||
|
||
expect(cleanedFilters[0]).toEqual({ query: { a: 'a' }, meta: {} }); | ||
expect(cleanedFilters[1]).toEqual({ query: { b: 'b' }, meta: {} }); | ||
}); | ||
|
||
test('should not fail if meta is missing from filters', () => { | ||
const filters: Filter[] = [{ query: { a: 'a' } }, { query: { b: 'b' } }] as unknown as Filter[]; | ||
|
||
const cleanedFilters = cleanFiltersForSerialize(filters as unknown as Filter[]); | ||
|
||
expect(cleanedFilters[0]).toEqual({ query: { a: 'a' } }); | ||
expect(cleanedFilters[1]).toEqual({ query: { b: 'b' } }); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
src/plugins/dashboard/public/utils/clean_filters_for_serialize.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { Filter } from '@kbn/es-query'; | ||
|
||
export function cleanFiltersForSerialize(filters?: Filter[]): Filter[] { | ||
if (!filters) return []; | ||
return filters.map((filter) => { | ||
if (filter.meta?.value) delete filter.meta.value; | ||
return filter; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 0 additions & 84 deletions
84
src/plugins/presentation_util/public/redux_tools/create_redux_tools.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.