-
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
Conversation
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx
Outdated
Show resolved
Hide resolved
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11282892493 |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
|
…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 |
…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]>
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