-
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
[Lens] Improved range formatter #80132
[Lens] Improved range formatter #80132
Conversation
…ernative-formatter
…ernative-formatter
cc @AlonaNadler I've used the dash format here, is that ok? |
Yes looks good thanks @dej611 |
I definitely ok with removing those symbols. I would go a bit further to and reduce the width of the inputs a bit. They're quite large for a number input. I'd say like half the size would suffice. |
…ernative-formatter
…and custom scenario
Pinging @elastic/kibana-app-arch (Team:AppArch) |
@elasticmachine merge upstream |
This is the only thing I'm seeing in Lens (installed the logs sample data, no other index patterns around): It seems like the logic we put in place to remap the field formats to a serialized format don't always work and need a safeguard ( |
I'm working to add more tests on that side to detect changes of this kind in the future 👍 |
Apparently formatters into indexPatterns can be either instanciated or already serialized. I've added a serialized version of one formatter in the test to always keep it tracked in the future, and also handle both scenarios. |
Played around with this and I think it's working fine. Would really appreciate another look from @wylieconlon though (as I'm only superficially familiar with that part of Lens). I did notice a weird behavior, but I'm not sure whether it's related to this PR, so it's fine fixing it separately (noting it here to make sure it isn't): When switching from explicit ranges to auto histogram, the local formatting is reset (in this example it's jumping from bytes to default) - maybe there is a good reason, but it seemed surprising to me: The code would benefit from moving some logic into the datasource, but as discussed we can handle this separately. |
I see your point. |
I see, let’s discuss this separately as it’s not related to the changes made here |
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.
Instead of leaving a review with a lot of comments, can you check out my PR against this branch? dej611#2
Basically I've made several change that I think are nicer:
- Move the format_column function into the datasource
- Simplified the formatting arguments
- Renamed the formatted arguments to consistently use
format
to refer to the number formatter andparentFormat
to refer to the ranges formatter
That looks good. I had a check on it and it seems to better encapsulate the logic with streamlined flow for complex format scenarios. |
Organize the formatting differently
@elasticmachine merge upstream |
@@ -35,6 +36,7 @@ export class IndexPatternDatasource { | |||
editorFrame.registerDatasource(async () => { | |||
const { getIndexPatternDatasource, renameColumns } = await import('../async_services'); |
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.
I like the new setup of making this an implementation detail of the datasource - can we move the formatColumn
import into the async_services
so it's loaded async?
💚 Build SucceededMetrics [docs]async chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
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.
Looks like the bundle limit increase was removed 👍 I dig it!
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.
Tested and works as expected, LGTM 👍
* master: (87 commits) [Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81778) [i18n] add get_kibana_translation_paths tests (elastic#81624) [UX] Fix search term reset from url (elastic#81654) [Lens] Improved range formatter (elastic#80132) [Resolver] `SideEffectContext` changes, remove `@testing-library` uses (elastic#81077) [Time to Visualize] Update Library Text with Call to Action (elastic#81667) [docs] Resolving failed Kibana upgrade migrations (elastic#80999) [ftr/menuToggle] provide helper for enhanced menu toggle handling (elastic#81709) [Task Manager] adds basic observability into Task Manager's runtime operations (elastic#77868) Doc changes for stack management and grouped feature privileges (elastic#80486) Added functional test for alerts list filters by status, alert type and action type. Did a code refactoring and splitting for alerts tests. (elastic#81422) [Security Solution][Endpoint][Admin] Malware Protections Notify User Version (elastic#81415) Revert "[Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390)" [Maps] Use default format when proxying EMS-files (elastic#79760) [Discover] Deangularize context.html (elastic#81442) Use the displayName property in default editor (elastic#73311) adds bug label to Bug report for Security Solution template (elastic#81643) [ML] Transforms: Remove index field limitation for custom query. (elastic#81467) [Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390) [Task Manager] Mark task as failed if maxAttempts has been met. (elastic#80681) ...
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
Summary
This PR is a proposal for a new range formatter format.
params
property in the setup payload.arrow_right
template has been addedInfinity
scenariosformat
information propagationrange
sI would also propose to clean a bit the popover style and remove the mathematical notation from it, just to keep it clean and consistent with the new label format (not implemented yet):
Fixes: #77881
Checklist
Delete any items that are not applicable to this PR.