-
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][Datatable] Fix non-numeric default cell text alignment #193886
Merged
Conversation
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
nickofthyme
added
Team:Visualizations
Visualization editors, elastic-charts and infrastructure
Feature:Lens
labels
Sep 24, 2024
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
nickofthyme
added
release_note:fix
backport:prev-minor
Backport to (8.x) the previous minor version (i.e. one version back from main)
labels
Sep 24, 2024
dej611
reviewed
Sep 25, 2024
x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx
Outdated
Show resolved
Hide resolved
markov00
requested changes
Oct 2, 2024
x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx
Outdated
Show resolved
Hide resolved
nickofthyme
changed the title
[Lens][Datatable] Fix range default cell text alignment
[Lens][Datatable] Fix non-numeric default cell text alignment
Oct 8, 2024
markov00
approved these changes
Oct 10, 2024
Starting backport for target branches: 8.x |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
|
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 10, 2024
…c#193886) Fixes elastic#191258 where the default alignment of the cell was different between the dimension editor and the table vis. - Assigns default alignment of `'right'` for all number values excluding `ranges`, `multi_terms`, `filters` and `filtered_metric`. Otherwise assigns `'left'`. - The default alignment is never save until the user changes it themselves. (cherry picked from commit db54cb1)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
kibanamachine
added a commit
that referenced
this pull request
Oct 11, 2024
…193886) (#195834) # Backport This will backport the following commits from `main` to `8.x`: - [[Lens][Datatable] Fix non-numeric default cell text alignment (#193886)](#193886) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-10T22:23:30Z","message":"[Lens][Datatable] Fix non-numeric default cell text alignment (#193886)\n\nFixes #191258 where the default alignment of the cell was different between the dimension editor and the table vis.\r\n- Assigns default alignment of `'right'` for all number values excluding `ranges`, `multi_terms`, `filters` and `filtered_metric`. Otherwise assigns `'left'`.\r\n- The default alignment is never save until the user changes it themselves.","sha":"db54cb1054cfb83f0efef6a2b087cc914c6694a0","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","v9.0.0","backport:prev-minor"],"title":"[Lens][Datatable] Fix non-numeric default cell text alignment","number":193886,"url":"https://github.com/elastic/kibana/pull/193886","mergeCommit":{"message":"[Lens][Datatable] Fix non-numeric default cell text alignment (#193886)\n\nFixes #191258 where the default alignment of the cell was different between the dimension editor and the table vis.\r\n- Assigns default alignment of `'right'` for all number values excluding `ranges`, `multi_terms`, `filters` and `filtered_metric`. Otherwise assigns `'left'`.\r\n- The default alignment is never save until the user changes it themselves.","sha":"db54cb1054cfb83f0efef6a2b087cc914c6694a0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193886","number":193886,"mergeCommit":{"message":"[Lens][Datatable] Fix non-numeric default cell text alignment (#193886)\n\nFixes #191258 where the default alignment of the cell was different between the dimension editor and the table vis.\r\n- Assigns default alignment of `'right'` for all number values excluding `ranges`, `multi_terms`, `filters` and `filtered_metric`. Otherwise assigns `'left'`.\r\n- The default alignment is never save until the user changes it themselves.","sha":"db54cb1054cfb83f0efef6a2b087cc914c6694a0"}}]}] BACKPORT--> Co-authored-by: Nick Partridge <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport:prev-minor
Backport to (8.x) the previous minor version (i.e. one version back from main)
Feature:Lens
release_note:fix
Team:Visualizations
Visualization editors, elastic-charts and infrastructure
v8.16.0
v9.0.0
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.
Summary
Fix #191258 where the default alignment of the cell was different between the dimension editor and the table vis.
'right'
for all number values excludingranges
,multi_terms
,filters
andfiltered_metric
. Otherwise assigns'left'
.Zight.Recording.2024-09-24.at.09.55.46.AM.mp4
Details
I believe this issue was created in #189895. The issue is how we determine if the column is numeric. In some places we use the
isNumericFieldForDatatable
helper function which looks to thecolumn.meta.type
property on theDatatableColumn
. In other places we use thedatasource.getOperationForColumnId(accessor)
util. In the case of intervals with custom ranges, the types between these 2 approaches are different.I don't know why we do both or how we fix this across Lens.
Additionally, we have a handful of default options that are applied downstream of the expressions which requires the same defaults to be applied in multiple places. For this PR I merged them in a helper function but maybe there is a better way.
Checklist