From e703107644c798b453473b157572686ddf7cd5d7 Mon Sep 17 00:00:00 2001 From: Tim Raymond Date: Mon, 31 Jul 2017 17:24:43 -0400 Subject: [PATCH] Copy missing properties from Dashboards When creating new dashboards to set defaults, not all properties of the dashboard were being copied. This ensures that they are so that zero values are not used for things like the ID and Name. --- server/dashboards.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/dashboards.go b/server/dashboards.go index df307a8b4f..62e6aac1c5 100644 --- a/server/dashboards.go +++ b/server/dashboards.go @@ -235,7 +235,11 @@ func ValidDashboardRequest(d *chronograf.Dashboard) error { // DashboardDefaults updates the dashboard with the default values // if none are specified func DashboardDefaults(d chronograf.Dashboard) (newDash chronograf.Dashboard) { + newDash.ID = d.ID + newDash.Templates = d.Templates + newDash.Name = d.Name newDash.Cells = make([]chronograf.DashboardCell, len(d.Cells)) + for i, c := range d.Cells { CorrectWidthHeight(&c) newDash.Cells[i] = c @@ -246,7 +250,11 @@ func DashboardDefaults(d chronograf.Dashboard) (newDash chronograf.Dashboard) { // AddQueryConfigs updates all the celsl in the dashboard to have query config // objects corresponding to their influxql queries. func AddQueryConfigs(d chronograf.Dashboard) (newDash chronograf.Dashboard) { + newDash.ID = d.ID + newDash.Templates = d.Templates + newDash.Name = d.Name newDash.Cells = make([]chronograf.DashboardCell, len(d.Cells)) + for i, c := range d.Cells { AddQueryConfig(&c) newDash.Cells[i] = c