From 150b0f212d4f240eb2d413cafe0df7849ca11108 Mon Sep 17 00:00:00 2001 From: Chris Goller Date: Thu, 6 Apr 2017 17:30:53 -0500 Subject: [PATCH 1/4] Update cell dashboard error messags to be descriptive --- server/dashboards.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/dashboards.go b/server/dashboards.go index 0a0a71eac1..73705a645b 100644 --- a/server/dashboards.go +++ b/server/dashboards.go @@ -365,7 +365,7 @@ func (s *Service) NewDashboardCell(w http.ResponseWriter, r *http.Request) { dash.Cells = append(dash.Cells, cell) if err := s.DashboardsStore.Update(ctx, dash); err != nil { - msg := fmt.Sprintf("Error updating dashboard ID %d: %v", id, err) + msg := fmt.Sprintf("Error adding cell %s to dashboard %d: %v", cid, id, err) Error(w, http.StatusInternalServerError, msg, s.Logger) return } @@ -435,7 +435,7 @@ func (s *Service) RemoveDashboardCell(w http.ResponseWriter, r *http.Request) { dash.Cells = append(dash.Cells[:cellid], dash.Cells[cellid+1:]...) if err := s.DashboardsStore.Update(ctx, dash); err != nil { - msg := fmt.Sprintf("Error updating dashboard ID %d: %v", id, err) + msg := fmt.Sprintf("Error removing cell %s from dashboard %d: %v", cid, id, err) Error(w, http.StatusInternalServerError, msg, s.Logger) return } @@ -484,7 +484,7 @@ func (s *Service) ReplaceDashboardCell(w http.ResponseWriter, r *http.Request) { dash.Cells[cellid] = cell if err := s.DashboardsStore.Update(ctx, dash); err != nil { - msg := fmt.Sprintf("Error updating dashboard ID %d: %v", id, err) + msg := fmt.Sprintf("Error updating cell %s in dashboard %d: %v", cid, id, err) Error(w, http.StatusInternalServerError, msg, s.Logger) return } From 777221c9cfaad98e05fd41fa675a1122d12e9f63 Mon Sep 17 00:00:00 2001 From: lukevmorris Date: Thu, 6 Apr 2017 16:21:27 -0700 Subject: [PATCH 2/4] Server validates that queries include database + rp (#1219) * Server validates that queries include database + rp * Update CHANGELOG --- CHANGELOG.md | 1 + ui/src/dashboards/constants/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fabed63f6..c5e8c1f7a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ 1. [#1195](https://github.com/influxdata/chronograf/issues/1195): Chronograf was not redirecting with authentiation for Influx Enterprise Meta service 1. [#1095](https://github.com/influxdata/chronograf/pull/1095): Make logout button display again 1. [#1209](https://github.com/influxdata/chronograf/pull/1209): HipChat Kapacitor config now uses only the subdomain instead of asking for the entire HipChat URL. + 1. [#1219](https://github.com/influxdata/chronograf/pull/1219): Update query for default cell in new dashboard ### Features 1. [#1112](https://github.com/influxdata/chronograf/pull/1112): Add ability to delete a dashboard diff --git a/ui/src/dashboards/constants/index.js b/ui/src/dashboards/constants/index.js index 8ace203bae..418dfaf23c 100644 --- a/ui/src/dashboards/constants/index.js +++ b/ui/src/dashboards/constants/index.js @@ -24,7 +24,7 @@ export const NEW_DASHBOARD = { type: 'line', queries: [ { - query: "SELECT mean(\"usage_user\") AS \"usage_user\" FROM \"cpu\"", + query: "SELECT mean(\"usage_user\") AS \"usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\"", label: "", groupbys: [], wheres: [], From 11666128605c21064a7146fe30ae51e8539684e4 Mon Sep 17 00:00:00 2001 From: lukevmorris Date: Thu, 6 Apr 2017 17:07:13 -0700 Subject: [PATCH 3/4] Dashboard comes from params, not Redux (#1218) We removed the `dashboard` key from Redux in favor of `dashboards`, which contains an array of all dashboards. This means we have to pass the current dashboard around to action creators. --- ui/src/dashboards/actions/index.js | 5 +++-- ui/src/dashboards/reducers/ui.js | 8 +++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ui/src/dashboards/actions/index.js b/ui/src/dashboards/actions/index.js index 3258f0376e..f60b2395a3 100644 --- a/ui/src/dashboards/actions/index.js +++ b/ui/src/dashboards/actions/index.js @@ -64,9 +64,10 @@ export const syncDashboardCell = (dashboard, cell) => ({ }, }) -export const addDashboardCell = (cell) => ({ +export const addDashboardCell = (dashboard, cell) => ({ type: 'ADD_DASHBOARD_CELL', payload: { + dashboard, cell, }, }) @@ -141,7 +142,7 @@ export const deleteDashboardAsync = (dashboard) => async (dispatch) => { export const addDashboardCellAsync = (dashboard) => async (dispatch) => { try { const {data} = await addDashboardCellAJAX(dashboard, NEW_DEFAULT_DASHBOARD_CELL) - dispatch(addDashboardCell(data)) + dispatch(addDashboardCell(dashboard, data)) } catch (error) { console.error(error) throw error diff --git a/ui/src/dashboards/reducers/ui.js b/ui/src/dashboards/reducers/ui.js index 2f7b15cabd..5156c5da4a 100644 --- a/ui/src/dashboards/reducers/ui.js +++ b/ui/src/dashboards/reducers/ui.js @@ -72,15 +72,13 @@ export default function ui(state = initialState, action) { } case 'ADD_DASHBOARD_CELL': { - const {cell} = action.payload - const {dashboard, dashboards} = state + const {cell, dashboard} = action.payload + const {dashboards} = state const newCells = [cell, ...dashboard.cells] const newDashboard = {...dashboard, cells: newCells} const newDashboards = dashboards.map((d) => d.id === dashboard.id ? newDashboard : d) - const newState = { - dashboards: newDashboards, - } + const newState = {dashboards: newDashboards} return {...state, ...newState} } From 68877e07e3bb8cb1aca81a67a3eb1a56aedf7e4c Mon Sep 17 00:00:00 2001 From: lukevmorris Date: Thu, 6 Apr 2017 17:44:15 -0700 Subject: [PATCH 4/4] Fuller DefaultCell; Reference DefaultCell in DefaultDashboard (#1221) * Fuller default cell; reference cell in default dashboard * Update CHANGELOG --- CHANGELOG.md | 1 + ui/src/dashboards/constants/index.js | 34 +++++++++------------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5e8c1f7a8..9ee73a6759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ 1. [#1113](https://github.com/influxdata/chronograf/issues/1113): Add Slack channel per Kapacitor alert. 1. [#1095](https://github.com/influxdata/chronograf/pull/1095): Add new auth duration CLI option; add client heartbeat 1. [#1168](https://github.com/influxdata/chronograf/issue/1168): Expand support for --basepath on some load balancers + 1. [#1221](https://github.com/influxdata/chronograf/issue/1221): More sensical Cell and Dashboard defaults ### UI Improvements 1. [#1101](https://github.com/influxdata/chronograf/pull/1101): Compress InfluxQL responses with gzip diff --git a/ui/src/dashboards/constants/index.js b/ui/src/dashboards/constants/index.js index 418dfaf23c..8ede7d3c04 100644 --- a/ui/src/dashboards/constants/index.js +++ b/ui/src/dashboards/constants/index.js @@ -12,29 +12,17 @@ export const EMPTY_DASHBOARD = { ], } -export const NEW_DASHBOARD = { - name: 'Name This Dashboard', - cells: [ - { - x: 0, - y: 0, - w: 4, - h: 4, - name: 'Name This Graph', - type: 'line', - queries: [ - { - query: "SELECT mean(\"usage_user\") AS \"usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\"", - label: "", - groupbys: [], - wheres: [], - }, - ], - }, - ], +export const NEW_DEFAULT_DASHBOARD_CELL = { + x: 0, + y: 0, + w: 4, + h: 4, + name: 'Name This Graph', + type: 'line', + queries: [], } -export const NEW_DEFAULT_DASHBOARD_CELL = { - query: [], - type: 'line', +export const NEW_DASHBOARD = { + name: 'Name This Dashboard', + cells: [NEW_DEFAULT_DASHBOARD_CELL], }