Skip to content

Conversation

@ktx-vaidehi
Copy link
Collaborator

@ktx-vaidehi ktx-vaidehi commented Sep 12, 2025

PR Type

Bug fix


Description

  • Fix table chart no-data validation

  • Separate table logic from other charts

  • Ensure presence check on x/y aliases

  • Prevent false negatives with single row


Diagram Walkthrough

flowchart LR
  Renderer["PanelSchemaRenderer.vue"]
  Charts["Non-table charts validation"]
  Table["Table-specific validation"]
  Metric["Metric validation (unchanged)"]

  Renderer -- "refine validation" --> Charts
  Renderer -- "add distinct logic" --> Table
  Renderer -- "keep existing flow" --> Metric
Loading

File Walkthrough

Relevant files
Bug fix
PanelSchemaRenderer.vue
Refine table chart data validation logic                                 

web/src/components/dashboards/PanelSchemaRenderer.vue

  • Remove table from generic chart validation branch.
  • Add table-specific data presence checks.
  • Allow single-row tables with any x/y value.
  • Keep gauge and others using stricter alias checks.
+10/-2   

@github-actions
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Issue

The table branch accesses data.value[0][0] and aliases without guarding for empty arrays or nulls. If data.value[0] is empty or undefined, or xAlias/yAlias are empty, the OR chain can short-circuit unpredictably or throw. Add safe checks before indexing and handle empty alias arrays explicitly.

  // For tables, simply check if there's any data in the array
  return (
    data.value[0]?.length > 1 ||
    (data.value[0]?.length == 1 &&
      xAlias.some((x: any) => data.value[0][0][x] != null)) ||
    yAlias.some((y: any) => data.value[0][0][y] != null)
  );
}
Logic Consistency

In non-table charts, the yAlias check uses '!= null' inside every() but is parenthesized so that '!= null' may only apply to the last alias, potentially allowing false positives. Verify parentheses so both x and y null checks correctly apply, similar to intent described in PR.

return (
  data.value[0]?.length > 1 ||
  (xAlias.every((x: any) => data.value[0][0][x] != null) &&
    yAlias.every((y: any) => data.value[0][0][y]) != null)
);

@github-actions
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add safe indexing guards

Guard all data.value[0][0] accesses to avoid runtime errors when data.value[0] is
undefined or an empty array. Wrap the final yAlias.some(...) with the same length
checks used for xAlias to ensure short-circuiting before indexing.

web/src/components/dashboards/PanelSchemaRenderer.vue [819-824]

 return (
   data.value[0]?.length > 1 ||
-  (data.value[0]?.length == 1 &&
-    xAlias.some((x: any) => data.value[0][0][x] != null)) ||
-  yAlias.some((y: any) => data.value[0][0][y] != null)
+  (data.value[0]?.length === 1 &&
+    (xAlias.some((x: any) => data.value[0][0][x] != null) ||
+     yAlias.some((y: any) => data.value[0][0][y] != null)))
 );
Suggestion importance[1-10]: 7

__

Why: Correctly points out a potential runtime error by accessing data.value[0][0] without guarding when data.value[0] may be undefined or empty; the consolidated check is safer and keeps semantics close to intent.

Medium
General
Consolidate single-row condition

Ensure consistent null checks for both dimensions by combining xAlias and yAlias
conditions under the same single-row check. This avoids falsely returning true when
there is no row and simplifies the logic.

web/src/components/dashboards/PanelSchemaRenderer.vue [821-824]

-(data.value[0]?.length == 1 &&
-  xAlias.some((x: any) => data.value[0][0][x] != null)) ||
-yAlias.some((y: any) => data.value[0][0][y] != null)
+data.value[0]?.length === 1 &&
+(xAlias.some((x: any) => data.value[0][0][x] != null) ||
+ yAlias.some((y: any) => data.value[0][0][y] != null))
Suggestion importance[1-10]: 6

__

Why: The logic consolidation under the single-row guard is valid and prevents unsafe indexing; it's a readability and safety improvement but moderate in impact since earlier part already checks length > 1.

Low

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR fixes the no data validation logic for table charts in the dashboard PanelSchemaRenderer component. The change differentiates between table charts and other chart types (area, bar, line, scatter, gauge) by implementing more appropriate validation logic for each.

For table charts, the validation now uses some() instead of every() to check if there's any non-null data in either X or Y axis fields. This means tables will display data when at least one column has valid values, rather than requiring all columns to be non-null. The logic checks three conditions: if there's more than one row of data, or if there's a single row with at least one non-null X axis value, or at least one non-null Y axis value.

For other chart types (gauge is shown as an example), the validation continues to use every() which requires all specified axis fields to be non-null, as complete data points are necessary for meaningful chart visualizations.

This change addresses the fundamental difference in data requirements between tabular displays and graphical charts. Tables are designed to show structured data where empty cells are common and acceptable, while charts typically need complete coordinate pairs to render properly. The fix ensures that tables with partial data are displayed to users instead of showing an incorrect "No Data" message.

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it improves user experience without breaking existing functionality
  • Score reflects a logical and well-targeted fix that addresses a specific UI issue with clear reasoning and appropriate validation logic
  • Pay close attention to the validation logic in PanelSchemaRenderer.vue to ensure the conditions cover all expected data scenarios

1 file reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

data.value[0]?.length > 1 ||
(data.value[0]?.length == 1 &&
xAlias.some((x: any) => data.value[0][0][x] != null)) ||
yAlias.some((y: any) => data.value[0][0][y] != null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Missing closing parenthesis - the yAlias.some() call is outside the main return condition

Suggested change
yAlias.some((y: any) => data.value[0][0][y] != null)
yAlias.some((y: any) => data.value[0][0][y] != null)
);

@ktx-vaidehi ktx-vaidehi force-pushed the fix/dashboard/table-chart-no-data branch from 75ae11f to 9b070ad Compare September 12, 2025 12:14
@ktx-vaidehi ktx-vaidehi force-pushed the fix/dashboard/table-chart-no-data branch from 9b070ad to ce7c5fb Compare September 15, 2025 06:24
@ktx-vaidehi ktx-vaidehi merged commit c68cbcb into main Sep 15, 2025
42 of 64 checks passed
@ktx-vaidehi ktx-vaidehi deleted the fix/dashboard/table-chart-no-data branch September 15, 2025 07:31
ktx-vaidehi added a commit that referenced this pull request Sep 15, 2025
Bug fix

___
- Fix table chart no-data validation

- Separate table logic from other charts

- Ensure presence check on x/y aliases

- Prevent false negatives with single row

___

```mermaid
flowchart LR
  Renderer["PanelSchemaRenderer.vue"]
  Charts["Non-table charts validation"]
  Table["Table-specific validation"]
  Metric["Metric validation (unchanged)"]

  Renderer -- "refine validation" --> Charts
  Renderer -- "add distinct logic" --> Table
  Renderer -- "keep existing flow" --> Metric
```

<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>PanelSchemaRenderer.vue</strong><dd><code>Refine table
chart data validation logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

web/src/components/dashboards/PanelSchemaRenderer.vue

<ul><li>Remove table from generic chart validation branch.<br> <li> Add
table-specific data presence checks.<br> <li> Allow single-row tables
with any x/y value.<br> <li> Keep gauge and others using stricter alias
checks.</ul>

</details>

  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8422/files#diff-e5376e7e77bf3aaf6590c2522d8c2dbffcc95a8006ae0d6dc0040a37825367d6">+10/-2</a>&nbsp;
&nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
ktx-vaidehi added a commit that referenced this pull request Sep 15, 2025
Bug fix

___
- Fix table chart no-data validation

- Separate table logic from other charts

- Ensure presence check on x/y aliases

- Prevent false negatives with single row

___

```mermaid
flowchart LR
  Renderer["PanelSchemaRenderer.vue"]
  Charts["Non-table charts validation"]
  Table["Table-specific validation"]
  Metric["Metric validation (unchanged)"]

  Renderer -- "refine validation" --> Charts
  Renderer -- "add distinct logic" --> Table
  Renderer -- "keep existing flow" --> Metric
```

<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>PanelSchemaRenderer.vue</strong><dd><code>Refine table
chart data validation logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

web/src/components/dashboards/PanelSchemaRenderer.vue

<ul><li>Remove table from generic chart validation branch.<br> <li> Add
table-specific data presence checks.<br> <li> Allow single-row tables
with any x/y value.<br> <li> Keep gauge and others using stricter alias
checks.</ul>

</details>

  </td>
<td><a

href="https://github.com/openobserve/openobserve/pull/8422/files#diff-e5376e7e77bf3aaf6590c2522d8c2dbffcc95a8006ae0d6dc0040a37825367d6">+10/-2</a>&nbsp;
&nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants