-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Discover] Add support for unmapped fields using the fields API #89074
Merged
Merged
Changes from 86 commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
a232550
Add search source to example plugin.
lukeelmers ba796e0
Add uiSetting for fields API.
lukeelmers 9fbcc82
Update SearchSource to support fields API.
lukeelmers 5afd264
[PoC] reading from the fields API in Discover
ac1e273
Add N fields as a default column
e6f2a22
Make fields column non-removeable
c420e96
Merge master
8ad5f99
Do not add 'fields' to state
64f0868
Remove fields from app state and read from source when needed
b843d33
Remove fields column if a new column is added
1a3196d
Add search source to example plugin.
lukeelmers 0cf84e4
Add uiSetting for fields API.
lukeelmers ad23b7f
Update SearchSource to support fields API.
lukeelmers 3681311
Improve error handling in search examples plugin.
lukeelmers 5ac33bb
Add unit tests for legacy behavior.
lukeelmers 9e6c89f
Remove uiSettings feature flag; add fieldsFromSource config.
lukeelmers d34ab66
Rewrite flatten() based on final API design.
lukeelmers 4773949
Update example app based on final API design.
lukeelmers d272609
Update maps app to use legacy fieldsFromSource.
lukeelmers 30c7c5f
Update Discover to use legacy fieldsFromSource.
lukeelmers 24a5f9d
Rename source filters to field filters.
lukeelmers 9c7a967
Address feedback.
lukeelmers 5c124f8
Update generated docs.
lukeelmers 79e59a8
Update maps functional test.
lukeelmers f7d304b
Formatting fields column similar to _source
4053bf1
Merge upstream
ee33143
Moving logic for using search API to updating search source
e3ace69
Fix small merge error
84136f6
Merge branch 'master' into feat/ssource-fields
kibanamachine 804c5f8
Merge branch 'feat/ssource-fields' of https://github.com/lukeelmers/k…
29fe624
Move useSource switch to Discover section of advanced settings
900637b
Do not use fields and source at the same time
9fc9517
Remove unmapped fields switch
92253eb
Add basic support for grouping multifields
00d6c68
Merge master
5e6162c
Remove output.txt
e16cdcb
Fix some merge leftovers
5e0f998
Fix some merge leftovers
9791498
Merge branch 'master' into discover-ssource-fields
63e49d4
Fix merge errors
a80d44d
Fix typescript errors and update nested fields logic
60119b9
Add a unit test
8583723
Fixing field formats
e21e478
Merge master
5108654
Fix multifield selection logic
448bc7a
Request all fields from source
dc5f148
Fix eslint
f260376
Fix default columns when switching between _source and fields
a2273f7
Merge branch 'master' into discover-ssource-fields
c8c4f47
More unit tests
57319da
Update API changes
d07b676
Add unit test for discover field details footer
50f57ef
Remove unused file
6990015
Remove fields formatting from index pattern
0965f30
Remove unnecessary check
ab4edb4
Addressing design comments
be9b9f4
Merge branch 'master' into discover-ssource-fields
1a6c620
Fixing fields column display and renaming it to Document
95ea135
Adding more unit tests
fc12250
Adding a missing check for useNewFieldsAPI; minor fixes
eb309ee
Fixing typescript error
b7a79d6
Remove unnecessary console statement
2b63157
Add missing prop
0f65832
Merge branch 'master' into discover-ssource-fields
kibanamachine fad95e7
Fixing import order
d3d38ef
Merge branch 'master' into discover-ssource-fields
kibanamachine e374d6f
Adding functional test to test fields API
5efe636
[Functional test] Clean up in after
24ab2ae
Fixing context app
88e81f0
Addressing PR comments
711c757
Merge branch 'master' into discover-ssource-fields
aed98ee
Add support for unmapped fields
f8e2485
Merge master
a6aef4f
Add data migration
c41a1b3
Add toggle unmapped fields logic
1e3ef3c
Adding more unit tests
487da4b
Some cleanup
1dc16bd
More unit tests
929fba9
Fixing failing snapshot
275a916
Add tooltip next to unmapped switch
f3b025e
Add functional test for the feature
0f4aa58
Fixing a typo in a functional test
933891d
Merge branch 'master' into unmapped-fields
kibanamachine 51badf7
Merge master
fb0f381
Refetch data when unmapped fields value changes
fda7725
Merge branch 'master' into unmapped-fields
kibanamachine c2de87d
Merge branch 'master' into unmapped-fields
6e12b58
Updating mapping
b51c0be
Support for fields API in search embeddable
abecb21
Addressing PR comments
d7b2fdf
Fix failing unit test
b16e3fd
Merge branch 'master' into unmapped-fields
kibanamachine 0b8102b
Merge branch 'master' into unmapped-fields
kibanamachine 64282c8
Updating the text
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
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
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 |
---|---|---|
|
@@ -104,6 +104,27 @@ export interface DiscoverSidebarProps { | |
* Shows index pattern and a button that displays the sidebar in a flyout | ||
*/ | ||
useFlyout?: boolean; | ||
|
||
/** | ||
* an object containing properties for proper handling of unmapped fields in the UI | ||
*/ | ||
unmappedFieldsConfig?: { | ||
/** | ||
* callback funtction to change the value of `showUnmappedFields` flag | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: funtction -> function |
||
* @param value new value to set | ||
*/ | ||
onChangeUnmappedFields: (value: boolean) => void; | ||
/** | ||
* determines whether to display unmapped fields | ||
* configurable through the switch in the UI | ||
*/ | ||
showUnmappedFields: boolean; | ||
/** | ||
* determines if we should display an option to toggle showUnmappedFields value in the first place | ||
* this value is not configurable through the UI | ||
*/ | ||
showUnmappedFieldsDefaultValue: boolean; | ||
}; | ||
} | ||
|
||
export function DiscoverSidebar({ | ||
|
@@ -123,6 +144,7 @@ export function DiscoverSidebar({ | |
trackUiMetric, | ||
useNewFieldsApi = false, | ||
useFlyout = false, | ||
unmappedFieldsConfig, | ||
}: DiscoverSidebarProps) { | ||
const [fields, setFields] = useState<IndexPatternField[] | null>(null); | ||
|
||
|
@@ -145,14 +167,30 @@ export function DiscoverSidebar({ | |
); | ||
|
||
const popularLimit = services.uiSettings.get(FIELDS_LIMIT_SETTING); | ||
|
||
const { | ||
selected: selectedFields, | ||
popular: popularFields, | ||
unpopular: unpopularFields, | ||
} = useMemo( | ||
() => groupFields(fields, columns, popularLimit, fieldCounts, fieldFilter, useNewFieldsApi), | ||
[fields, columns, popularLimit, fieldCounts, fieldFilter, useNewFieldsApi] | ||
() => | ||
groupFields( | ||
fields, | ||
columns, | ||
popularLimit, | ||
fieldCounts, | ||
fieldFilter, | ||
useNewFieldsApi, | ||
!!unmappedFieldsConfig?.showUnmappedFields | ||
), | ||
[ | ||
fields, | ||
columns, | ||
popularLimit, | ||
fieldCounts, | ||
fieldFilter, | ||
useNewFieldsApi, | ||
unmappedFieldsConfig?.showUnmappedFields, | ||
] | ||
); | ||
|
||
const fieldTypes = useMemo(() => { | ||
|
@@ -239,6 +277,9 @@ export function DiscoverSidebar({ | |
onChange={onChangeFieldSearch} | ||
value={fieldFilter.name} | ||
types={fieldTypes} | ||
useNewFieldsApi={useNewFieldsApi} | ||
onChangeUnmappedFields={unmappedFieldsConfig?.onChangeUnmappedFields} | ||
showUnmappedFields={unmappedFieldsConfig?.showUnmappedFieldsDefaultValue} | ||
/> | ||
</form> | ||
</EuiFlexItem> | ||
|
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
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.
dear @gchaps & @andreadelrio FYI just to have a look at layout and wording
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.
Typically, we use wording like this. (Also, I'm suggesting to remove the second line).
If unmapped fields aren't yet deprecated, you can use this instead: