Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pkger): backfill missing fillColumns field for histograms #18434

Merged
merged 1 commit into from Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions pkger/clone_resource.go
Expand Up @@ -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
Expand Down Expand Up @@ -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{
Expand Down
1 change: 1 addition & 0 deletions pkger/parser.go
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion pkger/parser_models.go
Expand Up @@ -483,6 +483,7 @@ const (
fieldChartColors = "colors"
fieldChartDecimalPlaces = "decimalPlaces"
fieldChartDomain = "domain"
fieldChartFillColumns = "fillColumns"
fieldChartGeom = "geom"
fieldChartHeight = "height"
fieldChartLegend = "legend"
Expand Down Expand Up @@ -527,6 +528,7 @@ type chart struct {
BinCount int
Position string
FieldOptions []fieldOption
FillColumns []string
TableOptions tableOptions
TimeFormat string
}
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkger/parser_test.go
Expand Up @@ -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")`
Expand Down
2 changes: 1 addition & 1 deletion pkger/service_test.go
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions pkger/testdata/dashboard_histogram.json
Expand Up @@ -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\")"
Expand Down
1 change: 1 addition & 0 deletions pkger/testdata/dashboard_histogram.yml
Expand Up @@ -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")
Expand Down