Skip to content

Conversation

@ktx-vaidehi
Copy link
Collaborator

No description provided.

@github-actions
Copy link
Contributor

Failed to generate code suggestions for PR

@ktx-vaidehi ktx-vaidehi force-pushed the feat/dashboard/table-chart-as-json branch 7 times, most recently from 4650057 to e9f5a77 Compare December 3, 2025 06:02
@ktx-vaidehi ktx-vaidehi marked this pull request as ready for review December 3, 2025 06:41
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Failed to generate code suggestions for PR

@ktx-vaidehi ktx-vaidehi force-pushed the feat/dashboard/table-chart-as-json branch from e9f5a77 to a3eae0f Compare December 3, 2025 06:42
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 3, 2025

Greptile Overview

Greptile Summary

This PR adds a new feature to dashboard table charts that allows users to render specific fields as formatted JSON/Array data.

Key Changes:

  • Added showFieldAsJson option to both X and Y axis field configurations in the dashboard panel schema
  • Created a new JsonFieldRenderer Vue component that parses and renders JSON data with syntax highlighting, supporting arrays, objects, and primitives with theme-aware colors
  • Integrated the renderer into TableRenderer to conditionally display JSON formatting when the flag is enabled
  • Added UI checkboxes in the query builder for users to toggle JSON rendering per field

The implementation follows existing patterns in the codebase (similar to treatAsNonTimestamp) and properly initializes the new field for both new and existing panels.

Confidence Score: 5/5

  • This PR is safe to merge - it adds a well-implemented feature with no breaking changes to existing functionality.
  • The changes are clean, follow existing patterns in the codebase, and add a self-contained feature. The backend schema change uses proper optional field with serde skip_serializing_if, ensuring backward compatibility. The frontend components are well-structured with proper initialization and error handling.
  • No files require special attention.

Important Files Changed

File Analysis

Filename Score Overview
src/config/src/meta/dashboards/v7/mod.rs 5/5 Added show_field_as_json: Option<bool> field to AxisItem struct for JSON rendering support in dashboard tables.
web/src/components/dashboards/panels/JsonFieldRenderer.vue 5/5 New component that renders JSON/Array data with syntax highlighting and theme-aware colors. Handles arrays, objects, and primitives with proper formatting.
web/src/components/dashboards/panels/TableRenderer.vue 5/5 Integrated JsonFieldRenderer component to conditionally render JSON data when showFieldAsJson flag is set on the column.
web/src/components/dashboards/addPanel/DashboardQueryBuilder.vue 5/5 Added "Render Data as JSON / Array" checkbox for both X and Y axis fields in table charts, with proper initialization logic.
web/src/composables/useDashboardPanel.ts 5/5 Added showFieldAsJson: false default value when adding X and Y axis items to dashboard panels.
web/src/utils/dashboard/convertTableData.ts 5/5 Passes showFieldAsJson flag from field configuration to the table column object for renderer consumption.

Sequence Diagram

sequenceDiagram
    participant User
    participant QueryBuilder as DashboardQueryBuilder
    participant Panel as useDashboardPanel
    participant Converter as convertTableData
    participant Renderer as TableRenderer
    participant JSON as JsonFieldRenderer

    User->>QueryBuilder: Toggle "Render Data as JSON" checkbox
    QueryBuilder->>Panel: Update field.showFieldAsJson = true
    Panel->>Converter: Pass panelSchema with showFieldAsJson
    Converter->>Converter: Map showFieldAsJson to column object
    Converter->>Renderer: Return columns with showFieldAsJson flag
    Renderer->>Renderer: Check props.col.showFieldAsJson
    alt showFieldAsJson is true
        Renderer->>JSON: Render with JsonFieldRenderer
        JSON->>JSON: Parse and format JSON/Array
        JSON-->>Renderer: Return formatted output
    else showFieldAsJson is false
        Renderer->>Renderer: Render plain value
    end
    Renderer-->>User: Display table cell
Loading

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.

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@ktx-vaidehi ktx-vaidehi force-pushed the feat/dashboard/table-chart-as-json branch from a3eae0f to d6870e2 Compare December 3, 2025 11:53
@ktx-vaidehi ktx-vaidehi force-pushed the feat/dashboard/table-chart-as-json branch from d6870e2 to e9db659 Compare December 4, 2025 05:53
@ktx-vaidehi ktx-vaidehi merged commit 975bca1 into main Dec 4, 2025
52 of 54 checks passed
@ktx-vaidehi ktx-vaidehi deleted the feat/dashboard/table-chart-as-json branch December 4, 2025 06:49
@ktx-akshay ktx-akshay added this to the v0.30.0 milestone Dec 4, 2025
@ktx-vaidehi ktx-vaidehi added the Needs-Testing Needs-Testing label Dec 4, 2025
@ktx-akshay ktx-akshay added Needs-Automation Needs-Automation v0.30.0-rc1 Testing-Completed Testing-Completed labels Dec 5, 2025
@ktx-akshay ktx-akshay removed Needs-Automation Needs-Automation Needs-Testing Needs-Testing labels Dec 10, 2025
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