From 9754d76503b921d47acde40935a4a11f41e2ec05 Mon Sep 17 00:00:00 2001 From: Pulak Kanti Bhowmick Date: Tue, 23 Nov 2021 23:30:52 +0600 Subject: [PATCH] Add `FieldConfig` field for `StatPanel` Signed-off-by: Pulak Kanti Bhowmick --- board_test.go | 18 +++++++++--------- panel.go | 45 +++++++++++++++++++++++---------------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/board_test.go b/board_test.go index c80d397a..8943c17b 100644 --- a/board_test.go +++ b/board_test.go @@ -92,14 +92,14 @@ func TestBoardHasTag_TagNotExists(t *testing.T) { } func TestBoardAddLink(t *testing.T) { - b := sdk.NewBoard("Sample") - b.AddLink(sdk.Link { - Title: "test", - Type: "external_link", - IncludeVars: false, - }) - - if len(b.Links) != 1 { + b := sdk.NewBoard("Sample") + b.AddLink(sdk.Link{ + Title: "test", + Type: "external_link", + IncludeVars: false, + }) + + if len(b.Links) != 1 { t.Error("Link wasn't added") - } + } } diff --git a/panel.go b/panel.go index f85270fa..5e214f29 100644 --- a/panel.go +++ b/panel.go @@ -261,28 +261,29 @@ type ( ValueName string `json:"valueName"` } StatPanel struct { - Colors []string `json:"colors"` - ColorValue bool `json:"colorValue"` - ColorBackground bool `json:"colorBackground"` - Decimals int `json:"decimals"` - Format string `json:"format"` - Gauge Gauge `json:"gauge,omitempty"` - MappingType *uint `json:"mappingType,omitempty"` - MappingTypes []*MapType `json:"mappingTypes,omitempty"` - MaxDataPoints *IntString `json:"maxDataPoints,omitempty"` - NullPointMode string `json:"nullPointMode"` - Postfix *string `json:"postfix,omitempty"` - PostfixFontSize *string `json:"postfixFontSize,omitempty"` - Prefix *string `json:"prefix,omitempty"` - PrefixFontSize *string `json:"prefixFontSize,omitempty"` - RangeMaps []*RangeMap `json:"rangeMaps,omitempty"` - SparkLine SparkLine `json:"sparkline,omitempty"` - Targets []Target `json:"targets,omitempty"` - Thresholds string `json:"thresholds"` - ValueFontSize string `json:"valueFontSize"` - ValueMaps []ValueMap `json:"valueMaps"` - ValueName string `json:"valueName"` - Options Options `json:"options"` + Colors []string `json:"colors"` + ColorValue bool `json:"colorValue"` + ColorBackground bool `json:"colorBackground"` + Decimals int `json:"decimals"` + Format string `json:"format"` + Gauge Gauge `json:"gauge,omitempty"` + MappingType *uint `json:"mappingType,omitempty"` + MappingTypes []*MapType `json:"mappingTypes,omitempty"` + MaxDataPoints *IntString `json:"maxDataPoints,omitempty"` + NullPointMode string `json:"nullPointMode"` + Postfix *string `json:"postfix,omitempty"` + PostfixFontSize *string `json:"postfixFontSize,omitempty"` + Prefix *string `json:"prefix,omitempty"` + PrefixFontSize *string `json:"prefixFontSize,omitempty"` + RangeMaps []*RangeMap `json:"rangeMaps,omitempty"` + SparkLine SparkLine `json:"sparkline,omitempty"` + Targets []Target `json:"targets,omitempty"` + Thresholds string `json:"thresholds"` + ValueFontSize string `json:"valueFontSize"` + ValueMaps []ValueMap `json:"valueMaps"` + ValueName string `json:"valueName"` + Options Options `json:"options"` + FieldConfig *FieldConfig `json:"fieldConfig,omitempty"` } DashlistPanel struct { Mode string `json:"mode"`