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

fix: change static legend's hide property to show #21648

Merged
merged 2 commits into from
Jun 10, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ This release adds an embedded SQLite database for storing metadata required by t
### Bug Fixes

1. [21610](https://github.com/influxdata/influxdb/pull/21610): Avoid rewriting `fields.idx` unnecessarily.
1. [21648](https://github.com/influxdata/influxdb/pull/21648): Change static legend's `hide` to `show` to let users decide if they want it.

## v2.0.7 [2021-06-04]

Expand Down
2 changes: 1 addition & 1 deletion dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ type ViewColor struct {
type StaticLegend struct {
ColorizeRows bool `json:"colorizeRows,omitempty"`
HeightRatio float64 `json:"heightRatio,omitempty"`
Hide bool `json:"hide,omitempty"`
Show bool `json:"show,omitempty"`
Opacity float64 `json:"opacity,omitempty"`
OrientationThreshold int `json:"orientationThreshold,omitempty"`
ValueAxis string `json:"valueAxis,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions pkger/clone_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ func convertCellView(cell influxdb.Cell) chart {
setStaticLegend := func(sl influxdb.StaticLegend) {
ch.StaticLegend.ColorizeRows = sl.ColorizeRows
ch.StaticLegend.HeightRatio = sl.HeightRatio
ch.StaticLegend.Hide = sl.Hide
ch.StaticLegend.Show = sl.Show
ch.StaticLegend.Opacity = sl.Opacity
ch.StaticLegend.OrientationThreshold = sl.OrientationThreshold
ch.StaticLegend.ValueAxis = sl.ValueAxis
Expand Down Expand Up @@ -1090,7 +1090,7 @@ func convertChartToResource(ch chart) Resource {
fieldChartLegendColorizeRows: ch.LegendColorizeRows,
fieldChartLegendHide: ch.LegendHide,
fieldChartStaticLegendColorizeRows: ch.StaticLegend.ColorizeRows,
fieldChartStaticLegendHide: ch.StaticLegend.Hide,
fieldChartStaticLegendShow: ch.StaticLegend.Show,
fieldChartGeoAllowPanAndZoom: ch.AllowPanAndZoom,
fieldChartGeoDetectCoordinateFields: ch.DetectCoordinateFields,
})
Expand Down
2 changes: 1 addition & 1 deletion pkger/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ func (p *Template) parseChart(dashMetaName string, chartIdx int, r Resource) (*c
if staticLeg, ok := ifaceToResource(r[fieldChartStaticLegend]); ok {
c.StaticLegend.ColorizeRows = staticLeg.boolShort(fieldChartStaticLegendColorizeRows)
c.StaticLegend.HeightRatio = staticLeg.float64Short(fieldChartStaticLegendHeightRatio)
c.StaticLegend.Hide = staticLeg.boolShort(fieldChartStaticLegendHide)
c.StaticLegend.Show = staticLeg.boolShort(fieldChartStaticLegendShow)
c.StaticLegend.Opacity = staticLeg.float64Short(fieldChartStaticLegendOpacity)
c.StaticLegend.OrientationThreshold = staticLeg.intShort(fieldChartStaticLegendOrientationThreshold)
c.StaticLegend.ValueAxis = staticLeg.stringShort(fieldChartStaticLegendValueAxis)
Expand Down
6 changes: 3 additions & 3 deletions pkger/parser_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ func (a axes) hasAxes(expectedAxes ...string) []validationErr {
type StaticLegend struct {
ColorizeRows bool `json:"colorizeRows,omitempty" yaml:"colorizeRows,omitempty"`
HeightRatio float64 `json:"heightRatio,omitempty" yaml:"heightRatio,omitempty"`
Hide bool `json:"hide,omitempty" yaml:"hide,omitempty"`
Show bool `json:"show,omitempty" yaml:"show,omitempty"`
Opacity float64 `json:"opacity,omitempty" yaml:"opacity,omitempty"`
OrientationThreshold int `json:"orientationThreshold,omitempty" yaml:"orientationThreshold,omitempty"`
ValueAxis string `json:"valueAxis,omitempty" yaml:"valueAxis,omitempty"`
Expand All @@ -1410,7 +1410,7 @@ type StaticLegend struct {
const (
fieldChartStaticLegendColorizeRows = "colorizeRows"
fieldChartStaticLegendHeightRatio = "heightRatio"
fieldChartStaticLegendHide = "hide"
fieldChartStaticLegendShow = "show"
fieldChartStaticLegendOpacity = "opacity"
fieldChartStaticLegendOrientationThreshold = "orientationThreshold"
fieldChartStaticLegendValueAxis = "valueAxis"
Expand All @@ -1421,7 +1421,7 @@ func (sl StaticLegend) influxStaticLegend() influxdb.StaticLegend {
return influxdb.StaticLegend{
ColorizeRows: sl.ColorizeRows,
HeightRatio: sl.HeightRatio,
Hide: sl.Hide,
Show: sl.Show,
Opacity: sl.Opacity,
OrientationThreshold: sl.OrientationThreshold,
ValueAxis: sl.ValueAxis,
Expand Down
6 changes: 3 additions & 3 deletions pkger/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ spec:
assert.Equal(t, 5, props.LegendOrientationThreshold)
assert.Equal(t, true, props.StaticLegend.ColorizeRows)
assert.Equal(t, 0.2, props.StaticLegend.HeightRatio)
assert.Equal(t, false, props.StaticLegend.Hide)
assert.Equal(t, true, props.StaticLegend.Show)
assert.Equal(t, 1.0, props.StaticLegend.Opacity)
assert.Equal(t, 5, props.StaticLegend.OrientationThreshold)
assert.Equal(t, "y", props.StaticLegend.ValueAxis)
Expand Down Expand Up @@ -1985,7 +1985,7 @@ spec:
assert.Equal(t, 5, props.LegendOrientationThreshold)
assert.Equal(t, true, props.StaticLegend.ColorizeRows)
assert.Equal(t, 0.2, props.StaticLegend.HeightRatio)
assert.Equal(t, false, props.StaticLegend.Hide)
assert.Equal(t, true, props.StaticLegend.Show)
assert.Equal(t, 1.0, props.StaticLegend.Opacity)
assert.Equal(t, 5, props.StaticLegend.OrientationThreshold)
assert.Equal(t, "y", props.StaticLegend.ValueAxis)
Expand Down Expand Up @@ -2460,7 +2460,7 @@ spec:
assert.Equal(t, 5, props.LegendOrientationThreshold)
assert.Equal(t, true, props.StaticLegend.ColorizeRows)
assert.Equal(t, 0.2, props.StaticLegend.HeightRatio)
assert.Equal(t, false, props.StaticLegend.Hide)
assert.Equal(t, true, props.StaticLegend.Show)
assert.Equal(t, 1.0, props.StaticLegend.Opacity)
assert.Equal(t, 5, props.StaticLegend.OrientationThreshold)
assert.Equal(t, "y", props.StaticLegend.ValueAxis)
Expand Down
6 changes: 3 additions & 3 deletions pkger/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2577,7 +2577,7 @@ func TestService(t *testing.T) {
Type: influxdb.ViewPropertyTypeSingleStatPlusLine,
Axes: newAxes(),
DecimalPlaces: influxdb.DecimalPlaces{IsEnforced: true, Digits: 1},
StaticLegend: influxdb.StaticLegend{ColorizeRows: true, HeightRatio: 0.2, Hide: false, Opacity: 1.0, OrientationThreshold: 5, ValueAxis: "y", WidthRatio: 1.0},
StaticLegend: influxdb.StaticLegend{ColorizeRows: true, HeightRatio: 0.2, Show: true, Opacity: 1.0, OrientationThreshold: 5, ValueAxis: "y", WidthRatio: 1.0},
Note: "a note",
Prefix: "pre",
Suffix: "suf",
Expand Down Expand Up @@ -2615,7 +2615,7 @@ func TestService(t *testing.T) {
Type: influxdb.ViewPropertyTypeXY,
Axes: newAxes(),
Geom: "step",
StaticLegend: influxdb.StaticLegend{ColorizeRows: true, HeightRatio: 0.2, Hide: false, Opacity: 1.0, OrientationThreshold: 5, ValueAxis: "y", WidthRatio: 1.0},
StaticLegend: influxdb.StaticLegend{ColorizeRows: true, HeightRatio: 0.2, Show: true, Opacity: 1.0, OrientationThreshold: 5, ValueAxis: "y", WidthRatio: 1.0},
Note: "a note",
Queries: []influxdb.DashboardQuery{newQuery()},
ShadeBelow: true,
Expand Down Expand Up @@ -2652,7 +2652,7 @@ func TestService(t *testing.T) {
Type: influxdb.ViewPropertyTypeBand,
Axes: newAxes(),
Geom: "step",
StaticLegend: influxdb.StaticLegend{ColorizeRows: true, HeightRatio: 0.2, Hide: false, Opacity: 1.0, OrientationThreshold: 5, ValueAxis: "y", WidthRatio: 1.0},
StaticLegend: influxdb.StaticLegend{ColorizeRows: true, HeightRatio: 0.2, Show: true, Opacity: 1.0, OrientationThreshold: 5, ValueAxis: "y", WidthRatio: 1.0},
Note: "a note",
Queries: []influxdb.DashboardQuery{newQuery()},
HoverDimension: "y",
Expand Down
2 changes: 1 addition & 1 deletion pkger/testdata/dashboard_band.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
staticLegend:
colorizeRows: true
heightRatio: 0.2
hide: false
show: true
opacity: 1.0
orientationThreshold: 5
valueAxis: "y"
Expand Down
2 changes: 1 addition & 1 deletion pkger/testdata/dashboard_single_stat_plus_line.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"staticLegend": {
"colorizeRows": true,
"heightRatio": 0.2,
"hide": false,
"show": true,
"opacity": 1.0,
"orientationThreshold": 5,
"valueAxis": "y",
Expand Down
2 changes: 1 addition & 1 deletion pkger/testdata/dashboard_single_stat_plus_line.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
staticLegend:
colorizeRows: true
heightRatio: 0.2
hide: false
show: true
opacity: 1.0
orientationThreshold: 5
valueAxis: "y"
Expand Down
2 changes: 1 addition & 1 deletion pkger/testdata/dashboard_xy.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"staticLegend": {
"colorizeRows": true,
"heightRatio": 0.2,
"hide": false,
"show": true,
"opacity": 1.0,
"orientationThreshold": 5,
"valueAxis": "y",
Expand Down
2 changes: 1 addition & 1 deletion pkger/testdata/dashboard_xy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
staticLegend:
colorizeRows: true
heightRatio: 0.2
hide: false
show: true
opacity: 1.0
orientationThreshold: 5
valueAxis: "y"
Expand Down