From 242b5b371b7b0d535cbec896ab1f932fd6354cf6 Mon Sep 17 00:00:00 2001 From: Jeroen Op 't Eynde Date: Wed, 26 Aug 2020 11:28:33 +0200 Subject: [PATCH] fix(diff): diff with nested dashboard element (#41) As parseDashboards got refactored out, the nesting from the API didn't line up anymore with the rendered dashboards. This generated a broken diff. Ref for the original change: d58bc1a63f2215072c7053e7c7c9577a075afcc1 --- pkg/grizzly/grafana.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/grizzly/grafana.go b/pkg/grizzly/grafana.go index c56dbc12..2a3d0208 100644 --- a/pkg/grizzly/grafana.go +++ b/pkg/grizzly/grafana.go @@ -189,11 +189,16 @@ func getDashboard(config Config, uid string) (*Board, error) { return nil, err } - var board Board - if err := json.Unmarshal(data, &board); err != nil { + type nestedBoard struct { + Dashboard Board `json:"dashboard"` + } + var b nestedBoard + if err := json.Unmarshal(data, &b); err != nil { return nil, APIErr{err, data} } + board := Board{Dashboard: b.Dashboard.Dashboard} + return &board, nil }