Fix missing cell type

Because we are now creating new instances of dashboards when we create a
response, it's critical to copy every element of Dashboards from the
previous to the new instance.

We were not previously copying the Type field of cells, so this was
defaulting to the empty string zero value. This patch adds "Type" to the
tests and ensures that it's properly copied
pull/1866/head
Tim Raymond 2017-08-14 13:13:39 -04:00
parent 7da02d52d7
commit 45e7bd8662
No known key found for this signature in database
GPG Key ID: 221ADC45076A48C0
2 changed files with 3 additions and 0 deletions

View File

@ -45,6 +45,7 @@ func newCellResponses(dID chronograf.DashboardID, dcells []chronograf.DashboardC
newCell.H = cell.H newCell.H = cell.H
newCell.Name = cell.Name newCell.Name = cell.Name
newCell.ID = cell.ID newCell.ID = cell.ID
newCell.Type = cell.Type
for _, lbl := range labels { for _, lbl := range labels {
if axis, found := cell.Axes[lbl]; !found { if axis, found := cell.Axes[lbl]; !found {

View File

@ -105,6 +105,7 @@ func Test_Service_DashboardCells(t *testing.T) {
W: 4, W: 4,
H: 4, H: 4,
Name: "CPU", Name: "CPU",
Type: "bar",
Queries: []chronograf.DashboardQuery{}, Queries: []chronograf.DashboardQuery{},
Axes: map[string]chronograf.Axis{}, Axes: map[string]chronograf.Axis{},
}, },
@ -117,6 +118,7 @@ func Test_Service_DashboardCells(t *testing.T) {
W: 4, W: 4,
H: 4, H: 4,
Name: "CPU", Name: "CPU",
Type: "bar",
Queries: []chronograf.DashboardQuery{}, Queries: []chronograf.DashboardQuery{},
Axes: map[string]chronograf.Axis{ Axes: map[string]chronograf.Axis{
"x": chronograf.Axis{ "x": chronograf.Axis{