[Lens][Datatable] Fix color mapping of transposed datatables#208623
[Lens][Datatable] Fix color mapping of transposed datatables#208623nickofthyme merged 6 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
…lastic#208623 - only handle untransposed data to collate categories - use untransposed data in lens datatable renderer - updates usages of getColorCategories
dej611
left a comment
There was a problem hiding this comment.
Left a minor performance comment inline.
Tested locally and it solves the issue for the split by scenario.
src/platform/packages/shared/chart-expressions-common/color_categories.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
|
Starting backport for target branches: 8.16, 8.17, 8.18, 8.x https://github.com/elastic/kibana/actions/runs/13151299994 |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
|
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
…#208623) ## Summary In elastic#189895 we added logic to the `getColorCategories` util function to handle transpose columns. This mistakenly assumed the first row of the datatable would include all transposed column ids (i.e. `${value}---${columnId}`). After closer analysis this case is only present the in datatable rendering (i.e. `table_basic.tsx`), but in this context we also have the original non-transposed datatable. So to simplify this we revert this logic to not care about transposed datatables. Now the color mappings are correctly assigned across **split by** columns. <img width="720" alt="image" src="https://github.com/user-attachments/assets/c588930e-53b9-409f-a257-2c5be35aaa38" /> Fixes elastic#208555 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ## Release note Fixes an issue in Lens (elastic#208555) Table where a split-by metric on a terms rendered incorrect colors in table cells. --------- Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com> Co-authored-by: Marco Liberati <dej611@users.noreply.github.com> (cherry picked from commit a93aaee)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…#208623) ## Summary In elastic#189895 we added logic to the `getColorCategories` util function to handle transpose columns. This mistakenly assumed the first row of the datatable would include all transposed column ids (i.e. `${value}---${columnId}`). After closer analysis this case is only present the in datatable rendering (i.e. `table_basic.tsx`), but in this context we also have the original non-transposed datatable. So to simplify this we revert this logic to not care about transposed datatables. Now the color mappings are correctly assigned across **split by** columns. <img width="720" alt="image" src="https://github.com/user-attachments/assets/c588930e-53b9-409f-a257-2c5be35aaa38" /> Fixes elastic#208555 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ## Release note Fixes an issue in Lens (elastic#208555) Table where a split-by metric on a terms rendered incorrect colors in table cells. --------- Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com> Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…208623) (#209927) # Backport This will backport the following commits from `main` to `8.x`: - [[Lens][Datatable] Fix color mapping of transposed datatables (#208623)](#208623) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2025-02-05T06:07:26Z","message":"[Lens][Datatable] Fix color mapping of transposed datatables (#208623)\n\n## Summary\r\n\r\nIn #189895 we added logic to the `getColorCategories` util function to\r\nhandle transpose columns. This mistakenly assumed the first row of the\r\ndatatable would include all transposed column ids (i.e.\r\n`${value}---${columnId}`). After closer analysis this case is only\r\npresent the in datatable rendering (i.e. `table_basic.tsx`), but in this\r\ncontext we also have the original non-transposed datatable.\r\n\r\nSo to simplify this we revert this logic to not care about transposed\r\ndatatables. Now the color mappings are correctly assigned across **split\r\nby** columns.\r\n\r\n<img width=\"720\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/c588930e-53b9-409f-a257-2c5be35aaa38\"\r\n/>\r\n\r\nFixes #208555\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n## Release note\r\n\r\nFixes an issue in Lens (#208555) Table where a split-by metric on a\r\nterms rendered incorrect colors in table cells.\r\n\r\n---------\r\n\r\nCo-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>\r\nCo-authored-by: Marco Liberati <dej611@users.noreply.github.com>","sha":"a93aaeee97d018c3e20c9cd1e26b8bc596986a58","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:prev-major","v9.1.0"],"title":"[Lens][Datatable] Fix color mapping of transposed datatables","number":208623,"url":"https://github.com/elastic/kibana/pull/208623","mergeCommit":{"message":"[Lens][Datatable] Fix color mapping of transposed datatables (#208623)\n\n## Summary\r\n\r\nIn #189895 we added logic to the `getColorCategories` util function to\r\nhandle transpose columns. This mistakenly assumed the first row of the\r\ndatatable would include all transposed column ids (i.e.\r\n`${value}---${columnId}`). After closer analysis this case is only\r\npresent the in datatable rendering (i.e. `table_basic.tsx`), but in this\r\ncontext we also have the original non-transposed datatable.\r\n\r\nSo to simplify this we revert this logic to not care about transposed\r\ndatatables. Now the color mappings are correctly assigned across **split\r\nby** columns.\r\n\r\n<img width=\"720\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/c588930e-53b9-409f-a257-2c5be35aaa38\"\r\n/>\r\n\r\nFixes #208555\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n## Release note\r\n\r\nFixes an issue in Lens (#208555) Table where a split-by metric on a\r\nterms rendered incorrect colors in table cells.\r\n\r\n---------\r\n\r\nCo-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>\r\nCo-authored-by: Marco Liberati <dej611@users.noreply.github.com>","sha":"a93aaeee97d018c3e20c9cd1e26b8bc596986a58"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208623","number":208623,"mergeCommit":{"message":"[Lens][Datatable] Fix color mapping of transposed datatables (#208623)\n\n## Summary\r\n\r\nIn #189895 we added logic to the `getColorCategories` util function to\r\nhandle transpose columns. This mistakenly assumed the first row of the\r\ndatatable would include all transposed column ids (i.e.\r\n`${value}---${columnId}`). After closer analysis this case is only\r\npresent the in datatable rendering (i.e. `table_basic.tsx`), but in this\r\ncontext we also have the original non-transposed datatable.\r\n\r\nSo to simplify this we revert this logic to not care about transposed\r\ndatatables. Now the color mappings are correctly assigned across **split\r\nby** columns.\r\n\r\n<img width=\"720\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/c588930e-53b9-409f-a257-2c5be35aaa38\"\r\n/>\r\n\r\nFixes #208555\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n## Release note\r\n\r\nFixes an issue in Lens (#208555) Table where a split-by metric on a\r\nterms rendered incorrect colors in table cells.\r\n\r\n---------\r\n\r\nCo-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>\r\nCo-authored-by: Marco Liberati <dej611@users.noreply.github.com>","sha":"a93aaeee97d018c3e20c9cd1e26b8bc596986a58"}}]}] BACKPORT--> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…208623) (#209924) # Backport This will backport the following commits from `main` to `9.0`: - [[Lens][Datatable] Fix color mapping of transposed datatables (#208623)](#208623) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2025-02-05T06:07:26Z","message":"[Lens][Datatable] Fix color mapping of transposed datatables (#208623)\n\n## Summary\r\n\r\nIn #189895 we added logic to the `getColorCategories` util function to\r\nhandle transpose columns. This mistakenly assumed the first row of the\r\ndatatable would include all transposed column ids (i.e.\r\n`${value}---${columnId}`). After closer analysis this case is only\r\npresent the in datatable rendering (i.e. `table_basic.tsx`), but in this\r\ncontext we also have the original non-transposed datatable.\r\n\r\nSo to simplify this we revert this logic to not care about transposed\r\ndatatables. Now the color mappings are correctly assigned across **split\r\nby** columns.\r\n\r\n<img width=\"720\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/c588930e-53b9-409f-a257-2c5be35aaa38\"\r\n/>\r\n\r\nFixes #208555\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n## Release note\r\n\r\nFixes an issue in Lens (#208555) Table where a split-by metric on a\r\nterms rendered incorrect colors in table cells.\r\n\r\n---------\r\n\r\nCo-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>\r\nCo-authored-by: Marco Liberati <dej611@users.noreply.github.com>","sha":"a93aaeee97d018c3e20c9cd1e26b8bc596986a58","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:prev-major","v9.1.0"],"title":"[Lens][Datatable] Fix color mapping of transposed datatables","number":208623,"url":"https://github.com/elastic/kibana/pull/208623","mergeCommit":{"message":"[Lens][Datatable] Fix color mapping of transposed datatables (#208623)\n\n## Summary\r\n\r\nIn #189895 we added logic to the `getColorCategories` util function to\r\nhandle transpose columns. This mistakenly assumed the first row of the\r\ndatatable would include all transposed column ids (i.e.\r\n`${value}---${columnId}`). After closer analysis this case is only\r\npresent the in datatable rendering (i.e. `table_basic.tsx`), but in this\r\ncontext we also have the original non-transposed datatable.\r\n\r\nSo to simplify this we revert this logic to not care about transposed\r\ndatatables. Now the color mappings are correctly assigned across **split\r\nby** columns.\r\n\r\n<img width=\"720\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/c588930e-53b9-409f-a257-2c5be35aaa38\"\r\n/>\r\n\r\nFixes #208555\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n## Release note\r\n\r\nFixes an issue in Lens (#208555) Table where a split-by metric on a\r\nterms rendered incorrect colors in table cells.\r\n\r\n---------\r\n\r\nCo-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>\r\nCo-authored-by: Marco Liberati <dej611@users.noreply.github.com>","sha":"a93aaeee97d018c3e20c9cd1e26b8bc596986a58"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208623","number":208623,"mergeCommit":{"message":"[Lens][Datatable] Fix color mapping of transposed datatables (#208623)\n\n## Summary\r\n\r\nIn #189895 we added logic to the `getColorCategories` util function to\r\nhandle transpose columns. This mistakenly assumed the first row of the\r\ndatatable would include all transposed column ids (i.e.\r\n`${value}---${columnId}`). After closer analysis this case is only\r\npresent the in datatable rendering (i.e. `table_basic.tsx`), but in this\r\ncontext we also have the original non-transposed datatable.\r\n\r\nSo to simplify this we revert this logic to not care about transposed\r\ndatatables. Now the color mappings are correctly assigned across **split\r\nby** columns.\r\n\r\n<img width=\"720\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/c588930e-53b9-409f-a257-2c5be35aaa38\"\r\n/>\r\n\r\nFixes #208555\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n## Release note\r\n\r\nFixes an issue in Lens (#208555) Table where a split-by metric on a\r\nterms rendered incorrect colors in table cells.\r\n\r\n---------\r\n\r\nCo-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>\r\nCo-authored-by: Marco Liberati <dej611@users.noreply.github.com>","sha":"a93aaeee97d018c3e20c9cd1e26b8bc596986a58"}}]}] BACKPORT--> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
In #189895 we added logic to the
getColorCategoriesutil function to handle transpose columns. This mistakenly assumed the first row of the datatable would include all transposed column ids (i.e.${value}---${columnId}). After closer analysis the need to handle transpose a datatable is only in the table rendering (i.e.table_basic.tsx), but in this context we also have the original non-transposed datatable.So to simplify this we revert this logic to not care about transposed datatables. Now the color mappings are correctly assigned across split by columns.
Fixes #208555
Checklist
release_note:*label is applied per the guidelinesRelease note
Fixes an issue in Lens (#208555) Table where a split-by metric on a terms rendered incorrect colors in table cells.