Skip to content

[BUG] Editing Grafana dashboard generated using mixin fails with error TypeError: Cannot read properties of undefined (reading 'length') #388

@pkazi

Description

@pkazi

What is the bug?

  • Generated Grafana dashboard by following the instructions at mixin folder.
  • Imported the dashboard json file as Grafaba dashboard, dashboard was created, but when tries to edit it, got error
TypeError: Cannot read properties of undefined (reading 'length')

When traced via inspect, found below js function causing this error -

export function getPanelStrings(dashboard: DashboardModel): string[] {
const panelStrings = dashboard.panels
.filter(
(panel) =>
(panel.title.length > 0 && panel.title !== NEW_PANEL_TITLE) ||
(panel.description && panel.description.length > 0)
)
.map(getPanelString);

return panelStrings;
}

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Generate grafana dashboard using mixin
  2. Import into Grafana
  3. Edit the dashboard

What is the expected behavior?
Dashboard should be editable without any errors.

What is your host/environment?

  • OpenSearch version - 3.2.0
  • Plugin Version - 3.2.0
  • Grafana Version - Grafana v12.0.2 (5bda17e7)

Do you have any screenshots?

Do you have any additional context?

  • When searched, found that Grafana dashboard generated using mixin creates panels using legacy row-based format, whereas new Grafana format is panels array.

Workaround

  1. Deleted the dashboard from Grafana
  2. Added an empty panels array in generated dashboard json as "panels": [],
  3. Re-imported dashboard in Grafana, I was able to edit it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmixinOpenSearch-mixin related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions