Skip to content

[8.x] [Lens] Do not break when the table has no data (#217937)#218254

Merged
kibanamachine merged 3 commits intoelastic:8.xfrom
kibanamachine:backport/8.x/pr-217937
Apr 16, 2025
Merged

[8.x] [Lens] Do not break when the table has no data (#217937)#218254
kibanamachine merged 3 commits intoelastic:8.xfrom
kibanamachine:backport/8.x/pr-217937

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

## Summary

When the datatable comes with empty results the visualization fails with
bad way

<img width="396" alt="image"
src="https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db"
/>

With the fix
<img width="756" alt="image"
src="https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7"
/>

How to replicate:

- Create a field ES|QL control with 2 values (extension and geo.dest).
You can do it with multiple ways. I created with typing `FROM
kibana_sample_data_logs | STATS count = COUNT(*) BY` and then `Create
control`.
- Use the variable in another panel with query: `FROM
kibana_sample_data_logs | WHERE ??field == "css" | KEEP extension` (The
control value should be in the extension). This will work
- Select the second field (geo.dest). This will return an empty query
and will break the table viz.

### 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

(cherry picked from commit fa2d391)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Apr 15, 2025
@kibanamachine kibanamachine enabled auto-merge (squash) April 15, 2025 12:09
@kibanamachine kibanamachine merged commit d35ae39 into elastic:8.x Apr 16, 2025
8 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #4 / When on the blocklist page And no data exists should show the Empty message

Metrics [docs]

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.4MB 1.4MB +29.0B

History

cc @stratoula

stratoula added a commit that referenced this pull request Jun 11, 2025
# Backport

This will backport the following commits from `main` to `9.0`:
- [[Lens] Do not break when the table has no data
(#217937)](#217937)

<!--- Backport version: 10.0.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Stratoula
Kalafateli","email":"efstratia.kalafateli@elastic.co"},"sourceCommit":{"committedDate":"2025-04-15T12:03:09Z","message":"[Lens]
Do not break when the table has no data (#217937)\n\n## Summary\n\nWhen
the datatable comes with empty results the visualization fails with\nbad
way\n\n<img width=\"396\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db\"\n/>\n\n\nWith
the fix\n<img width=\"756\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7\"\n/>\n\n\n\nHow
to replicate:\n\n- Create a field ES|QL control with 2 values (extension
and geo.dest).\nYou can do it with multiple ways. I created with typing
`FROM\nkibana_sample_data_logs | STATS count = COUNT(*) BY` and then
`Create\ncontrol`.\n- Use the variable in another panel with query:
`FROM\nkibana_sample_data_logs | WHERE ??field == \"css\" | KEEP
extension` (The\ncontrol value should be in the extension). This will
work\n- Select the second field (geo.dest). This will return an empty
query\nand will break the table viz.\n\n### Checklist\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"fa2d3912f408326980241df394c51bd87074e21c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Lens","Feature:ES|QL","backport:version","v9.1.0","v8.19.0"],"title":"[Lens]
Do not break when the table has no
data","number":217937,"url":"https://github.com/elastic/kibana/pull/217937","mergeCommit":{"message":"[Lens]
Do not break when the table has no data (#217937)\n\n## Summary\n\nWhen
the datatable comes with empty results the visualization fails with\nbad
way\n\n<img width=\"396\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db\"\n/>\n\n\nWith
the fix\n<img width=\"756\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7\"\n/>\n\n\n\nHow
to replicate:\n\n- Create a field ES|QL control with 2 values (extension
and geo.dest).\nYou can do it with multiple ways. I created with typing
`FROM\nkibana_sample_data_logs | STATS count = COUNT(*) BY` and then
`Create\ncontrol`.\n- Use the variable in another panel with query:
`FROM\nkibana_sample_data_logs | WHERE ??field == \"css\" | KEEP
extension` (The\ncontrol value should be in the extension). This will
work\n- Select the second field (geo.dest). This will return an empty
query\nand will break the table viz.\n\n### Checklist\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"fa2d3912f408326980241df394c51bd87074e21c"}},"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/217937","number":217937,"mergeCommit":{"message":"[Lens]
Do not break when the table has no data (#217937)\n\n## Summary\n\nWhen
the datatable comes with empty results the visualization fails with\nbad
way\n\n<img width=\"396\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b4e266d7-edbd-452b-9192-84c957fe98db\"\n/>\n\n\nWith
the fix\n<img width=\"756\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/d061d29e-9246-432a-944b-308b88d161e7\"\n/>\n\n\n\nHow
to replicate:\n\n- Create a field ES|QL control with 2 values (extension
and geo.dest).\nYou can do it with multiple ways. I created with typing
`FROM\nkibana_sample_data_logs | STATS count = COUNT(*) BY` and then
`Create\ncontrol`.\n- Use the variable in another panel with query:
`FROM\nkibana_sample_data_logs | WHERE ??field == \"css\" | KEEP
extension` (The\ncontrol value should be in the extension). This will
work\n- Select the second field (geo.dest). This will return an empty
query\nand will break the table viz.\n\n### Checklist\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"fa2d3912f408326980241df394c51bd87074e21c"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/218254","number":218254,"state":"MERGED","mergeCommit":{"sha":"d35ae396a663a340f859f5fb29ef98fff52fb8ca","message":"[8.x]
[Lens] Do not break when the table has no data (#217937) (#218254)\n\n#
Backport\n\nThis will backport the following commits from `main` to
`8.x`:\n- [[Lens] Do not break when the table has no
data\n(#217937)](https://github.com/elastic/kibana/pull/217937)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Stratoula Kalafateli <efstratia.kalafateli@elastic.co>"}}]}] BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

3 participants