From 620aa7a518898f712dd4e922ce4f99500855277a Mon Sep 17 00:00:00 2001 From: Brandon Farmer Date: Mon, 12 Mar 2018 20:14:04 -0700 Subject: [PATCH] Always return colors for single stat graphs Addresses a change that requires single stat graphs to have an array of colors, specifically in the case of canned dashboards. An empty array is acceptable but an undefined value will break the page. Closes #2862 Closes #2841 --- canned/docker.json | 2 ++ canned/mesos.json | 1 + chronograf.go | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/canned/docker.json b/canned/docker.json index ff0f7b5d39..a27528d3f6 100644 --- a/canned/docker.json +++ b/canned/docker.json @@ -56,6 +56,7 @@ ] } ], + "colors": [], "type": "single-stat" }, { @@ -73,6 +74,7 @@ ] } ], + "colors": [], "type": "single-stat" }, { diff --git a/canned/mesos.json b/canned/mesos.json index 370f67f0c8..beb8645852 100644 --- a/canned/mesos.json +++ b/canned/mesos.json @@ -117,6 +117,7 @@ "h": 4, "i": "0fa47984-825b-46f1-9ca5-0366e3220008", "name": "Mesos Master Uptime", + "colors": [], "type": "single-stat", "queries": [ { diff --git a/chronograf.go b/chronograf.go index 21c98dffc1..5d423f8108 100644 --- a/chronograf.go +++ b/chronograf.go @@ -572,15 +572,16 @@ type DashboardsStore interface { // Cell is a rectangle and multiple time series queries to visualize. type Cell struct { - X int32 `json:"x"` - Y int32 `json:"y"` - W int32 `json:"w"` - H int32 `json:"h"` - I string `json:"i"` - Name string `json:"name"` - Queries []Query `json:"queries"` - Axes map[string]Axis `json:"axes"` - Type string `json:"type"` + X int32 `json:"x"` + Y int32 `json:"y"` + W int32 `json:"w"` + H int32 `json:"h"` + I string `json:"i"` + Name string `json:"name"` + Queries []Query `json:"queries"` + Axes map[string]Axis `json:"axes"` + Type string `json:"type"` + CellColors []CellColor `json:"colors"` } // Layout is a collection of Cells for visualization