Skip to content
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
merged 11 commits into from
Oct 10, 2024

Conversation

nickofthyme
Copy link
Contributor

@nickofthyme nickofthyme commented Sep 24, 2024

Summary

Fix #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.
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 the column.meta.type property on the DatatableColumn. In other places we use the datasource.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

@nickofthyme nickofthyme added Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Sep 24, 2024
@nickofthyme nickofthyme requested a review from a team as a code owner September 24, 2024 14:58
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@nickofthyme 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
@nickofthyme nickofthyme requested a review from dej611 September 27, 2024 17:16
@nickofthyme nickofthyme requested a review from markov00 October 2, 2024 16:51
@elastic elastic deleted a comment from kibana-ci Oct 8, 2024
@nickofthyme nickofthyme enabled auto-merge (squash) October 8, 2024 17:51
@nickofthyme nickofthyme changed the title [Lens][Datatable] Fix range default cell text alignment [Lens][Datatable] Fix non-numeric default cell text alignment Oct 8, 2024
@nickofthyme nickofthyme merged commit db54cb1 into elastic:main Oct 10, 2024
20 checks passed
@nickofthyme nickofthyme deleted the fix-range-alignment branch October 10, 2024 22:23
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11282892493

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lens 1464 1465 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 1.5MB 1.5MB +1.0KB

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)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Text alignment for custom ranges is set to left by default while the content is right aligned
5 participants