diff --git a/CHANGELOG.md b/CHANGELOG.md index 6735522183c..368882b5a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ 1. [18335](https://github.com/influxdata/influxdb/pull/18335): Disable failing when providing an unexpected error to influx CLI 1. [18345](https://github.com/influxdata/influxdb/pull/18345): Have influx delete cmd respect the config 1. [18385](https://github.com/influxdata/influxdb/pull/18385): Store initialization for pkger enforced on reads +1. [18434](https://github.com/influxdata/influxdb/pull/18434): Backfill missing fillColumns field for histograms in pkger ### UI Improvements diff --git a/pkger/clone_resource.go b/pkger/clone_resource.go index 10d7ecf905e..55d80437199 100644 --- a/pkger/clone_resource.go +++ b/pkger/clone_resource.go @@ -568,6 +568,7 @@ func convertCellView(cell influxdb.Cell) chart { ch.Kind = chartKindHistogram ch.Queries = convertQueries(p.Queries) ch.Colors = convertColors(p.ViewColors) + ch.FillColumns = p.FillColumns ch.XCol = p.XColumn ch.Axes = []axis{{Label: p.XAxisLabel, Name: "x", Domain: p.XDomain}} ch.Note = p.Note @@ -659,6 +660,10 @@ func convertChartToResource(ch chart) Resource { r[fieldChartLegend] = ch.Legend } + if len(ch.FillColumns) > 0 { + r[fieldChartFillColumns] = ch.FillColumns + } + if zero := new(tableOptions); ch.TableOptions != *zero { tRes := make(Resource) assignNonZeroBools(tRes, map[string]bool{ diff --git a/pkger/parser.go b/pkger/parser.go index 9eb999c1797..ec24e58fbf4 100644 --- a/pkger/parser.go +++ b/pkger/parser.go @@ -1340,6 +1340,7 @@ func parseChart(r Resource) (chart, []validationErr) { YCol: r.stringShort(fieldChartYCol), XPos: r.intShort(fieldChartXPos), YPos: r.intShort(fieldChartYPos), + FillColumns: r.slcStr(fieldChartFillColumns), } if presLeg, ok := r[fieldChartLegend].(legend); ok { diff --git a/pkger/parser_models.go b/pkger/parser_models.go index 2de3c13ec42..76e01c3965f 100644 --- a/pkger/parser_models.go +++ b/pkger/parser_models.go @@ -483,6 +483,7 @@ const ( fieldChartColors = "colors" fieldChartDecimalPlaces = "decimalPlaces" fieldChartDomain = "domain" + fieldChartFillColumns = "fillColumns" fieldChartGeom = "geom" fieldChartHeight = "height" fieldChartLegend = "legend" @@ -527,6 +528,7 @@ type chart struct { BinCount int Position string FieldOptions []fieldOption + FillColumns []string TableOptions tableOptions TimeFormat string } @@ -574,7 +576,7 @@ func (c chart) properties() influxdb.ViewProperties { Type: influxdb.ViewPropertyTypeHistogram, Queries: c.Queries.influxDashQueries(), ViewColors: c.Colors.influxViewColors(), - FillColumns: []string{}, + FillColumns: c.FillColumns, XColumn: c.XCol, XDomain: c.Axes.get("x").Domain, XAxisLabel: c.Axes.get("x").Label, diff --git a/pkger/parser_test.go b/pkger/parser_test.go index 5375f390e09..87b12eb56cd 100644 --- a/pkger/parser_test.go +++ b/pkger/parser_test.go @@ -1118,7 +1118,7 @@ spec: assert.Equal(t, 30, props.BinCount) assert.True(t, props.ShowNoteWhenEmpty) assert.Equal(t, []float64{0, 10}, props.XDomain) - assert.Equal(t, []string{}, props.FillColumns) + assert.Equal(t, []string{"a", "b"}, props.FillColumns) require.Len(t, props.Queries, 1) q := props.Queries[0] queryText := `from(bucket: v.bucket) |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r._measurement == "boltdb_reads_total") |> filter(fn: (r) => r._field == "counter")` diff --git a/pkger/service_test.go b/pkger/service_test.go index 221592fc405..c39eed28ad7 100644 --- a/pkger/service_test.go +++ b/pkger/service_test.go @@ -1804,7 +1804,7 @@ func TestService(t *testing.T) { Queries: []influxdb.DashboardQuery{newQuery()}, ShowNoteWhenEmpty: true, ViewColors: []influxdb.ViewColor{{Type: "scale", Hex: "#8F8AF4", Value: 0}, {Type: "scale", Hex: "#8F8AF4", Value: 0}, {Type: "scale", Hex: "#8F8AF4", Value: 0}}, - FillColumns: []string{}, + FillColumns: []string{"a", "b"}, XColumn: "_value", XDomain: []float64{0, 10}, XAxisLabel: "x_label", diff --git a/pkger/testdata/dashboard_histogram.json b/pkger/testdata/dashboard_histogram.json index dd6dd0d007c..e3949e5cf99 100644 --- a/pkger/testdata/dashboard_histogram.json +++ b/pkger/testdata/dashboard_histogram.json @@ -18,6 +18,7 @@ "xCol": "_value", "position": "stacked", "binCount": 30, + "fillColumns": ["a", "b"], "queries": [ { "query": "from(bucket: v.bucket) |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r._measurement == \"boltdb_reads_total\") |> filter(fn: (r) => r._field == \"counter\")" diff --git a/pkger/testdata/dashboard_histogram.yml b/pkger/testdata/dashboard_histogram.yml index 31d904a6b06..ea9c16373a0 100644 --- a/pkger/testdata/dashboard_histogram.yml +++ b/pkger/testdata/dashboard_histogram.yml @@ -13,6 +13,7 @@ spec: width: 6 height: 3 binCount: 30 + fillColumns: ["a", "b"] queries: - query: > from(bucket: v.bucket) |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r._measurement == "boltdb_reads_total") |> filter(fn: (r) => r._field == "counter")