-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Lens] Field formatter support #38874
Merged
flash1293
merged 18 commits into
elastic:feature/lens
from
flash1293:lens/field-formatter-support
Aug 13, 2019
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3891bf3
pipe formatting informations through the expression
flash1293 0bd27b2
Merge branch 'feature/lens' into lens/field-formatter-support
flash1293 c7bda6d
Merge branch 'feature/lens' into lens/field-formatter-support
flash1293 8c91d6c
add robustness
flash1293 11cedf9
Merge branch 'feature/lens' into lens/field-formatter-support
flash1293 e692f9c
fix import path
flash1293 eeaa86d
fix references in tests
flash1293 b629264
Merge branch 'feature/lens' into lens/field-formatter-support
flash1293 eb31bd2
Merge remote-tracking branch 'upstream/feature/lens' into lens/field-…
flash1293 76b25ff
use same formats as in pipeline loader
flash1293 ef698ac
fix bugs and make formats optional
flash1293 9785f08
Merge remote-tracking branch 'upstream/feature/lens' into lens/field-…
flash1293 eaa93f6
clean up field formatters
flash1293 8a4ee58
Merge branch 'feature/lens' into lens/field-formatter-support
flash1293 b72a51b
Merge branch 'feature/lens' into lens/field-formatter-support
flash1293 5548579
fix type error
flash1293 498f836
clean up formatters
flash1293 1b761fb
code hygiene
flash1293 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,7 +99,7 @@ export const esaggs = (): ExpressionFunction<typeof name, Context, Arguments, Re | |
searchSource.setField('index', indexPattern); | ||
searchSource.setField('size', 0); | ||
|
||
const response: Pick<KibanaDatatable, 'columns' | 'rows'> = await courierRequestHandler({ | ||
const response = await courierRequestHandler({ | ||
searchSource, | ||
aggs, | ||
timeRange: get(context, 'timeRange', null), | ||
|
@@ -112,13 +112,18 @@ export const esaggs = (): ExpressionFunction<typeof name, Context, Arguments, Re | |
queryFilter, | ||
}); | ||
|
||
return { | ||
const table: KibanaDatatable = { | ||
type: 'kibana_datatable', | ||
rows: response.rows, | ||
columns: response.columns.map(column => ({ | ||
columns: response.columns.map((column: any) => ({ | ||
id: column.id, | ||
name: column.name, | ||
formatterMapping: column.aggConfig.params.field | ||
? column.aggConfig.params.field.format.toJSON() | ||
: column.aggConfig.type.getFormat().toJSON(), | ||
})), | ||
}; | ||
|
||
return table; | ||
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. Seems like the intermediate |
||
}, | ||
}); |
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
18 changes: 12 additions & 6 deletions
18
x-pack/plugins/lens/public/xy_visualization_plugin/__snapshots__/xy_expression.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.
This is not complete yet (there might be cases where this way of retrieving the formatters fails), but it works as a proof of concept for simple visualizations in Lens. As soon as we decide to follow this approach, I will clean up here