diff --git a/CHANGELOG.md b/CHANGELOG.md index a72cf853e..c267580ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ 1. [#1179](https://github.com/influxdata/chronograf/pull/1179): Admin Databases Page will render a database without retention policies 1. [#1128](https://github.com/influxdata/chronograf/pull/1128): No more ghost dashboards 👻 1. [#1189](https://github.com/influxdata/chronograf/pull/1189): Clicking inside the graph header edit box will no longer blur the field. Use the Escape key for that behavior instead. + 1. [#1193](https://github.com/influxdata/chronograf/issues/1193): Fix no quoting of raw InfluxQL fields with function names 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. diff --git a/influx/query.go b/influx/query.go index 260189824..c3340bb9c 100644 --- a/influx/query.go +++ b/influx/query.go @@ -15,7 +15,7 @@ func Convert(influxQL string) (chronograf.QueryConfig, error) { } raw := chronograf.QueryConfig{ - RawText: query.String(), + RawText: influxQL, Fields: []chronograf.Field{}, GroupBy: chronograf.GroupBy{ Tags: []string{}, diff --git a/influx/query_test.go b/influx/query_test.go new file mode 100644 index 000000000..b930cb4fa --- /dev/null +++ b/influx/query_test.go @@ -0,0 +1,42 @@ +package influx + +import ( + "reflect" + "testing" + + "github.com/influxdata/chronograf" +) + +func TestConvert(t *testing.T) { + tests := []struct { + name string + influxQL string + want chronograf.QueryConfig + wantErr bool + }{ + { + name: "Test named count field", + influxQL: `SELECT moving_average(mean("count"),14) FROM "usage_computed"."autogen".unique_clusters_by_day WHERE time > now() - 90d AND product = 'influxdb' group by time(1d)`, + want: chronograf.QueryConfig{ + RawText: `SELECT moving_average(mean("count"),14) FROM "usage_computed"."autogen".unique_clusters_by_day WHERE time > now() - 90d AND product = 'influxdb' group by time(1d)`, + Fields: []chronograf.Field{}, + Tags: map[string][]string{}, + GroupBy: chronograf.GroupBy{ + Tags: []string{}, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := Convert(tt.influxQL) + if (err != nil) != tt.wantErr { + t.Errorf("Convert() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("Convert() = %#v, want %#v", got, tt.want) + } + }) + } +} diff --git a/server/dashboards_test.go b/server/dashboards_test.go index 55547f5fb..2d1c3c034 100644 --- a/server/dashboards_test.go +++ b/server/dashboards_test.go @@ -246,7 +246,7 @@ func Test_newDashboardResponse(t *testing.T) { { Command: "SELECT donors from hill_valley_preservation_society where time > '1985-10-25 08:00:00'", QueryConfig: chronograf.QueryConfig{ - RawText: "SELECT donors FROM hill_valley_preservation_society WHERE time > '1985-10-25 08:00:00'", + RawText: "SELECT donors from hill_valley_preservation_society where time > '1985-10-25 08:00:00'", Fields: []chronograf.Field{}, GroupBy: chronograf.GroupBy{ Tags: []string{}, diff --git a/ui/src/shared/components/LayoutRenderer.js b/ui/src/shared/components/LayoutRenderer.js index 68daeebae..fc6b3cd9f 100644 --- a/ui/src/shared/components/LayoutRenderer.js +++ b/ui/src/shared/components/LayoutRenderer.js @@ -100,7 +100,8 @@ export const LayoutRenderer = React.createClass({ // on a stable query representation. let queryText if (query.queryConfig) { - queryText = buildInfluxQLQuery(timeRange, query.queryConfig) + const {queryConfig: {rawText}} = query + queryText = rawText || buildInfluxQLQuery(timeRange, query.queryConfig) } else { queryText = this.buildQueryForOldQuerySchema(query) } diff --git a/ui/src/style/pages/dashboards.scss b/ui/src/style/pages/dashboards.scss index 7d4dff2d0..ae500071e 100644 --- a/ui/src/style/pages/dashboards.scss +++ b/ui/src/style/pages/dashboards.scss @@ -57,6 +57,7 @@ $dash-graph-options-arrow: 8px; left: 0; } .dash-graph--container { + z-index: 0; user-select: none !important; -o-user-select: none !important; -moz-user-select: none !important; @@ -88,7 +89,7 @@ $dash-graph-options-arrow: 8px; } } .dash-graph--heading { - z-index: 1; + z-index: 0; user-select: none !important; -o-user-select: none !important; -moz-user-select: none !important; @@ -146,7 +147,7 @@ $dash-graph-options-arrow: 8px; .dash-graph--options { width: $dash-graph-heading; position: absolute; - z-index: 2; + z-index: 1; right: 0px; top: 0px;