-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Migrate filter bar to React, EUI, and Typescript #25563
Merged
Merged
Changes from 97 commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
a61269e
basic groundwork for filter bar euification
Bargs 9c293bf
filter item placeholder
Bargs 812407a
filter item placeholder file I missed
Bargs 7255785
create initial filter class
Bargs fceda5f
refine usage of Filter class in FilterBar
Bargs 648081e
wire up the callbacks for the FilterItem
Bargs 95a8d09
forgot filter deletion
Bargs 0dce26d
clean up filter refactorings
Bargs cebe76e
hook up delete button
Bargs 79ed162
fix callbacks, try Object.create
Bargs f76a0ee
move filter_bar_filter.js up a directory
Bargs f302424
enable easy changes to the underlying metafilter filter
Bargs fe3c0ad
establishing pattern for creating views of filters
Bargs 6baeb40
further filter view refinements
Bargs a7abc70
use interface to ensure a filter type supports all required views
Bargs fcd2d6e
add some style 😎
Bargs 6e15773
create search bar component to wrap query bar and filter bar together
Bargs 0ca4911
add filter total and visibility toggle button to the search bar
Bargs 4dad850
add "all filters" actions
Bargs 9436a01
foundation for filter editor
Bargs 967f97f
recreated filter editor mockup in TS as a starting point
Bargs cc68d0e
Fix import path
lukasolson e360cce
Fix unresolved merge conflict
lukasolson ebbde92
Fix injecting i18n provider
lukasolson 692604d
Hook up search bar to actual filters
lukasolson 5ea40de
Watch by reference so pin/unpin triggers changes
lukasolson bd0f10c
Add phrase filter editor
lukasolson f0e2525
Update index pattern type def
lukasolson 80732b7
Add filter dialog
lukasolson 31a2988
Add phrases editor
lukasolson e6f0604
Partially implemented the type specific input component. Still need to
Bargs 71a4975
Add query DSL editor
lukasolson 6eb75a1
Merge remote-tracking branch 'Bargs/euifyFilterBar' into euifyFilterBar
lukasolson 190ec9e
Adds in value suggestions for phrase and phrases filter editors
lukasolson 9def223
Add new filter bar to visualize/dashboard
lukasolson 4991692
Account for fields that are mapped as numbers but have string values in
Bargs ecd0b85
validate date math expressions
Bargs 25910b5
validate IP inputs
Bargs 63e2e6d
make user pick the value they want. This is more in line with how the…
Bargs 92a9402
Add apply filter popover
lukasolson 1893e75
Remove old filter bar from dashboard
lukasolson 969c08c
range filter editor
Bargs 3b77a29
better form validation for filter params input
Bargs 7268bd7
fix date validation
Bargs 1de48fe
add index pattern input
Bargs 9e5cb18
Internationalize all of the text
lukasolson 518e103
Fix angular digest stuff
lukasolson 703f664
auto tab in filter editor
Bargs aa842f4
Fix empty index patterns list
lukasolson 84c7e18
Hide index pattern selection when there is only one, clean up filter …
lukasolson 4c55087
Merge branch 'master' into euifyFilterBar
Bargs 685f3bf
Use new filter bar in context view
lukasolson 03c7177
Remove old filter bar and move filters to kbn-es-query package
lukasolson 7eb1539
Better validation that doesn't rely on state
lukasolson 90fc2d3
Use default index pattern if there are no panels with index patterns
Bargs ba1fd31
Remove autofocus and create generic combobox
lukasolson 9901aa1
Remove implemented todo
lukasolson e238034
Add date formats link and clean up
lukasolson 9694b10
Design Edits (#6)
cchaos e59523f
Fix bug with creating phrase filters on boolean scripted fields
lukasolson a7067e9
Fix spacing in phrases filter view
lukasolson fdf6605
update autocomplete_provider tests
Bargs 4b267c0
Add ownFocus to popover so the focus starts inside the popover when it
Bargs 120fb38
fix TS error
Bargs 05b9d1a
Rename MetaFilter to Filter and add readme to kbn-es-query
lukasolson 61ea52d
Merge branch 'master' into euifyFilterBar
lukasolson 6ffb4d6
fix type errors
Bargs 52aa91f
Merge remote-tracking branch 'origin/euifyFilterBar' into euifyFilterBar
Bargs abe90c4
fix type errors
Bargs 5c77e6b
fix incorrect formatMessage usage
Bargs 85fc1ab
update phrases filter view to use new internationalized message on the
Bargs d255901
update jest snapshots for query bar tests
Bargs 330b722
try adding a specific target to TS build
Bargs a1a0e62
try the default target instead, since 'esnext' is already the value in
Bargs 0b58100
extend tsconfig.browser.json instead of setting our own target
Bargs 99c04e3
Add filter editor tests and fix issue with field autocomplete
lukasolson 5e63f7e
Remove ID from filter operators
lukasolson 964b447
Fixes some of the context tests
Bargs fd6058b
Fixes all context functional tests
Bargs 459f52b
Merge remote-tracking branch 'origin/euifyFilterBar' into euifyFilterBar
Bargs 483edbd
fixes combobox input focus issue
Bargs 51b17b5
Update removeAllFilters service method and move it to the filterbar s…
Bargs aa51593
Fixes some dashboard tests that weren't using the filterBar service
Bargs f1fb66a
fix filter toggle by using service
Bargs dd7a9d4
Fix discover filter tests
Bargs c19bdba
Add tests for value suggestions and fix operator suggestions
lukasolson 42a11ef
Put filter editor in a form and fix actions popup position
lukasolson 4fdc79c
Fix ML filter bar
lukasolson 8b85a06
Add filter bar back to embed mode, fixes some vis tests
Bargs 4c5f303
Merge branch 'master' into euifyFilterBar
Bargs eb2ae32
fix isFilterable method
Bargs 2d171b5
check for undefined which can occur in ng-mock environment
Bargs e444f16
filter bar should not respect `vis.type.requiresSearch`, only
Bargs 84138ed
Update isFilterable tests
Bargs 65b44c9
localize string we missed
Bargs 5421f92
export all Operators for ease of use and update exists filter view to
Bargs 1cb9e90
Update filter editor tests
lukasolson bc31a95
Merge branch 'master' into euifyFilterBar
Bargs 26ffc5c
Add title attribute to filter badges
Bargs 58505d6
Merge remote-tracking branch 'origin/euifyFilterBar' into euifyFilterBar
Bargs 312a98f
remove unused import
Bargs 54a515c
add ID to EuiSwitch so that the label element can be correctly connected
Bargs 99af617
translate string I missed
Bargs 303060c
Switch from react components to a function that returns simple display
Bargs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# kbn-es-query | ||
|
||
This module is responsible for generating Elasticsearch queries for Kibana. See explanations below for each of the subdirectories. | ||
|
||
## es_query | ||
|
||
This folder contains the code that combines Lucene/KQL queries and filters into an Elasticsearch query. | ||
|
||
```javascript | ||
buildEsQuery(indexPattern, queries, filters, config) | ||
``` | ||
|
||
Generates the Elasticsearch query DSL from combining the queries and filters provided. | ||
|
||
```javascript | ||
buildQueryFromFilters(filters, indexPattern) | ||
``` | ||
|
||
Generates the Elasticsearch query DSL from the given filters. | ||
|
||
```javascript | ||
luceneStringToDsl(query) | ||
``` | ||
|
||
Generates the Elasticsearch query DSL from the given Lucene query. | ||
|
||
```javascript | ||
migrateFilter(filter, indexPattern) | ||
``` | ||
|
||
Migrates a filter from a previous version of Elasticsearch to the current version. | ||
|
||
```javascript | ||
decorateQuery(query, queryStringOptions) | ||
``` | ||
|
||
Decorates an Elasticsearch query_string query with the given options. | ||
|
||
## filters | ||
|
||
This folder contains the code related to Kibana Filter objects, including their definitions, and helper functions to create them. Filters in Kibana always contain a `meta` property which describes which `index` the filter corresponds to, as well as additional data about the specific filter. | ||
|
||
The object that is created by each of the following functions corresponds to a Filter object in the `lib` directory (e.g. `PhraseFilter`, `RangeFilter`, etc.) | ||
|
||
```javascript | ||
buildExistsFilter(field, indexPattern) | ||
``` | ||
|
||
Creates a filter (`ExistsFilter`) where the given field exists. | ||
|
||
```javascript | ||
buildPhraseFilter(field, value, indexPattern) | ||
``` | ||
|
||
Creates an filter (`PhraseFilter`) where the given field matches the given value. | ||
|
||
```javascript | ||
buildPhrasesFilter(field, params, indexPattern) | ||
``` | ||
|
||
Creates a filter (`PhrasesFilter`) where the given field matches one or more of the given values. `params` should be an array of values. | ||
|
||
```javascript | ||
buildQueryFilter(query, index) | ||
``` | ||
|
||
Creates a filter (`CustomFilter`) corresponding to a raw Elasticsearch query DSL object. | ||
|
||
```javascript | ||
buildRangeFilter(field, params, indexPattern) | ||
``` | ||
|
||
Creates a filter (`RangeFilter`) where the value for the given field is in the given range. `params` should contain `lt`, `lte`, `gt`, and/or `gte`. | ||
|
||
## kuery | ||
|
||
This folder contains the code corresponding to generating Elasticsearch queries using the Kibana query language. | ||
|
||
It also contains code corresponding to the original implementation of Kuery (released in 6.0) which should be removed at some point (see legacy_kuery.js, legacy_kuery.peg). | ||
|
||
In general, you will only need to worry about the following functions from the `ast` folder: | ||
|
||
```javascript | ||
fromExpression(expression) | ||
``` | ||
|
||
Generates an abstract syntax tree corresponding to the raw Kibana query `expression`. | ||
|
||
```javascript | ||
toElasticsearchQuery(node, indexPattern) | ||
``` | ||
|
||
Takes an abstract syntax tree (generated from the previous method) and generates the Elasticsearch query DSL using the given `indexPattern`. Note that if no `indexPattern` is provided, then an Elasticsearch query DSL will still be generated, ignoring things like the index pattern scripted fields, field types, etc. | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { Filter, FilterMeta } from './meta_filter'; | ||
|
||
export type ExistsFilterMeta = FilterMeta; | ||
|
||
export type ExistsFilter = Filter & { | ||
meta: ExistsFilterMeta; | ||
}; |
31 changes: 31 additions & 0 deletions
31
packages/kbn-es-query/src/filters/lib/geo_bounding_box_filter.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,31 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { Filter, FilterMeta, LatLon } from './meta_filter'; | ||
|
||
export type GeoBoundingBoxFilterMeta = FilterMeta & { | ||
params: { | ||
bottom_right: LatLon; | ||
top_left: LatLon; | ||
}; | ||
}; | ||
|
||
export type GeoBoundingBoxFilter = Filter & { | ||
meta: GeoBoundingBoxFilterMeta; | ||
}; |
30 changes: 30 additions & 0 deletions
30
packages/kbn-es-query/src/filters/lib/geo_polygon_filter.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,30 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { Filter, FilterMeta, LatLon } from './meta_filter'; | ||
|
||
export type GeoPolygonFilterMeta = FilterMeta & { | ||
params: { | ||
points: LatLon[]; | ||
}; | ||
}; | ||
|
||
export type GeoPolygonFilter = Filter & { | ||
meta: GeoPolygonFilterMeta; | ||
}; |
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,50 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
// The interface the other filters extend | ||
export * from './meta_filter'; | ||
|
||
// The actual filter types | ||
import { CustomFilter } from './custom_filter'; | ||
import { ExistsFilter } from './exists_filter'; | ||
import { GeoBoundingBoxFilter } from './geo_bounding_box_filter'; | ||
import { GeoPolygonFilter } from './geo_polygon_filter'; | ||
import { PhraseFilter } from './phrase_filter'; | ||
import { PhrasesFilter } from './phrases_filter'; | ||
import { QueryStringFilter } from './query_string_filter'; | ||
import { RangeFilter } from './range_filter'; | ||
export { | ||
CustomFilter, | ||
ExistsFilter, | ||
GeoBoundingBoxFilter, | ||
GeoPolygonFilter, | ||
PhraseFilter, | ||
PhrasesFilter, | ||
QueryStringFilter, | ||
RangeFilter, | ||
}; | ||
|
||
// Any filter associated with a field (used in the filter bar/editor) | ||
export type FieldFilter = | ||
| ExistsFilter | ||
| GeoBoundingBoxFilter | ||
| GeoPolygonFilter | ||
| PhraseFilter | ||
| PhrasesFilter | ||
| RangeFilter; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add some tsdocs/jsdocs around the apis ?