opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.69k stars 894 forks source link

[BUG] Missing error check in vis_augmenter results in broken config menu for data tables #8020

Open dvas0004 opened 2 months ago

dvas0004 commented 2 months ago

Describe the bug

If a dashboard contains a visual of type "Table", which in turn contains a "Date Histogram" column, then the "config" menu accessed via the cogwheel icon on the top right will be empty

image

To Reproduce Steps to reproduce the behavior:

  1. Create a table visual

  2. Ensure that at least one column is a Date Historgram by splitting rows appropriately image

  3. Save and create a dashbaord

  4. Add the table to your dashbaord

  5. Attempt to click on the config icon

  6. Note the menu does not appear

The same behavior is NOT observed if your table does NOT have a Date Histogram column

Expected behavior the menu should appear as shown below

image

OpenSearch Version 2.9.0

Dashboards Version 2.9.0

Host/Environment (please complete the following information):

Potential Fix For version 2.9.0, modify this line:

https://github.com/opensearch-project/OpenSearch-Dashboards/blob/1f82eda3935dc5b648cb31587662c84cb43f3801/src/plugins/vis_augmenter/public/utils/utils.ts#L32

From this:

//...
 vis.params.categoryAxes.length === 1 &&
//...

to this:

//...
 vis.params.categoryAxes!==undefined && vis.params.categoryAxes.length === 1 &&
//...

Additional context Looking at the code for the "main" branch indicates the bug may be present there as well but I have not verified this

PS credit to @timothetoulain and @dagfinnur for highlighting this bug

dvas0004 commented 2 months ago

proposed potential fix confirmed working on 2.9.0

andrross commented 1 month ago

[Catch All Triage - 1, 2, 3]

@dvas0004 Would you like to attempt a PR to fix this?

dvas0004 commented 1 month ago

sure! which branch should the PR be made on?