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

pull/21658/head
Timmy Luong 2021-06-10 09:20:59 -07:00 committed by GitHub
parent fa31037d37
commit 354c385ee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 19 additions and 18 deletions

View File

@ -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]

View File

@ -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"`

View File

@ -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
@ -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,
})

View File

@ -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)

View File

@ -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"`
@ -1410,7 +1410,7 @@ type StaticLegend struct {
const (
fieldChartStaticLegendColorizeRows = "colorizeRows"
fieldChartStaticLegendHeightRatio = "heightRatio"
fieldChartStaticLegendHide = "hide"
fieldChartStaticLegendShow = "show"
fieldChartStaticLegendOpacity = "opacity"
fieldChartStaticLegendOrientationThreshold = "orientationThreshold"
fieldChartStaticLegendValueAxis = "valueAxis"
@ -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,

View File

@ -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)
@ -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)
@ -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)

View File

@ -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",
@ -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,
@ -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",

View File

@ -43,7 +43,7 @@ spec:
staticLegend:
colorizeRows: true
heightRatio: 0.2
hide: false
show: true
opacity: 1.0
orientationThreshold: 5
valueAxis: "y"

View File

@ -40,7 +40,7 @@
"staticLegend": {
"colorizeRows": true,
"heightRatio": 0.2,
"hide": false,
"show": true,
"opacity": 1.0,
"orientationThreshold": 5,
"valueAxis": "y",

View File

@ -40,7 +40,7 @@ spec:
staticLegend:
colorizeRows: true
heightRatio: 0.2
hide: false
show: true
opacity: 1.0
orientationThreshold: 5
valueAxis: "y"

View File

@ -39,7 +39,7 @@
"staticLegend": {
"colorizeRows": true,
"heightRatio": 0.2,
"hide": false,
"show": true,
"opacity": 1.0,
"orientationThreshold": 5,
"valueAxis": "y",

View File

@ -38,7 +38,7 @@ spec:
staticLegend:
colorizeRows: true
heightRatio: 0.2
hide: false
show: true
opacity: 1.0
orientationThreshold: 5
valueAxis: "y"