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:
- Generate grafana dashboard using mixin
- Import into Grafana
- 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
- Deleted the dashboard from Grafana
- Added an empty panels array in generated dashboard json as
"panels": [],
- Re-imported dashboard in Grafana, I was able to edit it.