mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix the disjuction of panels (#39412)
[As code] Correct trim apply defaults when import/export dashboards
This commit is contained in:
parent
ccd6a2eae3
commit
227c8403b5
@ -57,7 +57,7 @@ Family: scuemata.#Family & {
|
|||||||
// Datasource to use for annotation.
|
// Datasource to use for annotation.
|
||||||
datasource: string
|
datasource: string
|
||||||
// Whether annotation is enabled.
|
// Whether annotation is enabled.
|
||||||
enable?: bool | *true
|
enable: bool | *true
|
||||||
// Whether to hide annotation.
|
// Whether to hide annotation.
|
||||||
hide?: bool | *false
|
hide?: bool | *false
|
||||||
// Annotation icon color.
|
// Annotation icon color.
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package load
|
package load
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
@ -21,7 +24,57 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
var p = GetDefaultLoadPaths()
|
var (
|
||||||
|
p = GetDefaultLoadPaths()
|
||||||
|
update = flag.Bool("update", false, "update golden files")
|
||||||
|
)
|
||||||
|
|
||||||
|
type testfunc func(*testing.T, schema.VersionedCueSchema, []byte, fs.FileInfo, string)
|
||||||
|
|
||||||
|
// for now we keep the validdir as input parameter since for trim apply default we can't use devenv directory yet,
|
||||||
|
// otherwise we can hardcoded validdir and just pass the testtype is more than enough.
|
||||||
|
// TODO: remove validdir once we can test directly with devenv folder
|
||||||
|
var doTestAgainstDevenv = func(sch schema.VersionedCueSchema, validdir string, fn testfunc) func(t *testing.T) {
|
||||||
|
return func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
require.NoError(t, filepath.Walk(validdir, func(path string, d fs.FileInfo, err error) error {
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
if d.IsDir() || filepath.Ext(d.Name()) != ".json" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore gosec warning G304 since it's a test
|
||||||
|
// nolint:gosec
|
||||||
|
b, err := os.Open(path)
|
||||||
|
require.NoError(t, err, "failed to open dashboard file")
|
||||||
|
|
||||||
|
// Only try to validate dashboards with schemaVersion >= 30
|
||||||
|
jtree := make(map[string]interface{})
|
||||||
|
byt, err := io.ReadAll(b)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
require.NoError(t, json.Unmarshal(byt, &jtree))
|
||||||
|
if oldschemav, has := jtree["schemaVersion"]; !has {
|
||||||
|
t.Logf("no schemaVersion in %s", path)
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
if !(oldschemav.(float64) > 29) {
|
||||||
|
if testing.Verbose() {
|
||||||
|
t.Logf("schemaVersion is %v, older than 30, skipping %s", oldschemav, path)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Run(filepath.Base(path), func(t *testing.T) {
|
||||||
|
fn(t, sch, byt, d, path)
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Basic well-formedness tests on core scuemata.
|
// Basic well-formedness tests on core scuemata.
|
||||||
func TestScuemataBasics(t *testing.T) {
|
func TestScuemataBasics(t *testing.T) {
|
||||||
@ -54,70 +107,76 @@ func TestScuemataBasics(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDevenvDashboardValidity(t *testing.T) {
|
func TestDevenvDashboardValidity(t *testing.T) {
|
||||||
validdir := filepath.Join("..", "..", "..", "devenv", "dev-dashboards")
|
|
||||||
|
|
||||||
doTest := func(sch schema.VersionedCueSchema) func(t *testing.T) {
|
|
||||||
return func(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
require.NoError(t, filepath.Walk(validdir, func(path string, d fs.FileInfo, err error) error {
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
if d.IsDir() || filepath.Ext(d.Name()) != ".json" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ignore gosec warning G304 since it's a test
|
|
||||||
// nolint:gosec
|
|
||||||
b, err := os.Open(path)
|
|
||||||
require.NoError(t, err, "failed to open dashboard file")
|
|
||||||
|
|
||||||
// Only try to validate dashboards with schemaVersion >= 30
|
|
||||||
jtree := make(map[string]interface{})
|
|
||||||
byt, err := io.ReadAll(b)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
require.NoError(t, json.Unmarshal(byt, &jtree))
|
|
||||||
if oldschemav, has := jtree["schemaVersion"]; !has {
|
|
||||||
t.Logf("no schemaVersion in %s", path)
|
|
||||||
return nil
|
|
||||||
} else {
|
|
||||||
if !(oldschemav.(float64) > 29) {
|
|
||||||
if testing.Verbose() {
|
|
||||||
t.Logf("schemaVersion is %v, older than 30, skipping %s", oldschemav, path)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Run(filepath.Base(path), func(t *testing.T) {
|
|
||||||
err := sch.Validate(schema.Resource{Value: string(byt), Name: path})
|
|
||||||
if err != nil {
|
|
||||||
// Testify trims errors to short length. We want the full text
|
|
||||||
errstr := errors.Details(err, nil)
|
|
||||||
t.Log(errstr)
|
|
||||||
if strings.Contains(errstr, "null") {
|
|
||||||
t.Log("validation failure appears to involve nulls - see if scripts/stripnulls.sh has any effect?")
|
|
||||||
}
|
|
||||||
t.FailNow()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO will need to expand this appropriately when the scuemata contain
|
// TODO will need to expand this appropriately when the scuemata contain
|
||||||
// more than one schema
|
// more than one schema
|
||||||
|
var validdir = filepath.Join("..", "..", "..", "devenv", "dev-dashboards")
|
||||||
dash, err := BaseDashboardFamily(p)
|
dash, err := BaseDashboardFamily(p)
|
||||||
require.NoError(t, err, "error while loading base dashboard scuemata")
|
require.NoError(t, err, "error while loading base dashboard scuemata")
|
||||||
t.Run("base", doTest(dash))
|
dashboardValidity := func(t *testing.T, sch schema.VersionedCueSchema, byt []byte, d fs.FileInfo, path string) {
|
||||||
|
err := sch.Validate(schema.Resource{Value: string(byt), Name: path})
|
||||||
|
if err != nil {
|
||||||
|
// Testify trims errors to short length. We want the full text
|
||||||
|
errstr := errors.Details(err, nil)
|
||||||
|
t.Log(errstr)
|
||||||
|
if strings.Contains(errstr, "null") {
|
||||||
|
t.Log("validation failure appears to involve nulls - see if scripts/stripnulls.sh has any effect?")
|
||||||
|
}
|
||||||
|
t.FailNow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.Run("base", doTestAgainstDevenv(dash, validdir, dashboardValidity))
|
||||||
|
|
||||||
ddash, err := DistDashboardFamily(p)
|
ddash, err := DistDashboardFamily(p)
|
||||||
require.NoError(t, err, "error while loading dist dashboard scuemata")
|
require.NoError(t, err, "error while loading dist dashboard scuemata")
|
||||||
t.Run("dist", doTest(ddash))
|
t.Run("dist", doTestAgainstDevenv(ddash, validdir, dashboardValidity))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TO update the golden file located in pkg/schema/testdata/devenvgoldenfiles
|
||||||
|
// run go test -v ./pkg/schema/load/... -update
|
||||||
|
func TestUpdateDevenvDashboardGoldenFiles(t *testing.T) {
|
||||||
|
flag.Parse()
|
||||||
|
if *update {
|
||||||
|
ddash, err := DistDashboardFamily(p)
|
||||||
|
require.NoError(t, err, "error while loading dist dashboard scuemata")
|
||||||
|
var validdir = filepath.Join("..", "..", "..", "devenv", "dev-dashboards")
|
||||||
|
goldenFileUpdate := func(t *testing.T, sch schema.VersionedCueSchema, byt []byte, d fs.FileInfo, _ string) {
|
||||||
|
dsSchema, err := schema.SearchAndValidate(sch, string(byt))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
origin, err := schema.ApplyDefaults(schema.Resource{Value: string(byt)}, dsSchema.CUE())
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
var prettyJSON bytes.Buffer
|
||||||
|
err = json.Indent(&prettyJSON, []byte(origin.Value.(string)), "", "\t")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
err = ioutil.WriteFile(filepath.Join("..", "testdata", "devenvgoldenfiles", d.Name()), prettyJSON.Bytes(), 0644)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
t.Run("updategoldenfile", doTestAgainstDevenv(ddash, validdir, goldenFileUpdate))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDevenvDashboardTrimApplyDefaults(t *testing.T) {
|
||||||
|
ddash, err := DistDashboardFamily(p)
|
||||||
|
require.NoError(t, err, "error while loading dist dashboard scuemata")
|
||||||
|
// TODO will need to expand this appropriately when the scuemata contain
|
||||||
|
// more than one schema
|
||||||
|
validdir := filepath.Join("..", "testdata", "devenvgoldenfiles")
|
||||||
|
trimApplyDefaults := func(t *testing.T, sch schema.VersionedCueSchema, byt []byte, d fs.FileInfo, path string) {
|
||||||
|
dsSchema, err := schema.SearchAndValidate(sch, string(byt))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
// Trimmed default json file
|
||||||
|
trimmed, err := schema.TrimDefaults(schema.Resource{Value: string(byt)}, dsSchema.CUE())
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
// store the trimmed result into testdata for easy debug
|
||||||
|
out, err := schema.ApplyDefaults(trimmed, dsSchema.CUE())
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.JSONEq(t, string(byt), out.Value.(string))
|
||||||
|
}
|
||||||
|
t.Run("defaults", doTestAgainstDevenv(ddash, validdir, trimApplyDefaults))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPanelValidity(t *testing.T) {
|
func TestPanelValidity(t *testing.T) {
|
||||||
|
@ -5,16 +5,12 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/bits"
|
"math/bits"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
"cuelang.org/go/cue/cuecontext"
|
|
||||||
errs "cuelang.org/go/cue/errors"
|
errs "cuelang.org/go/cue/errors"
|
||||||
cuejson "cuelang.org/go/pkg/encoding/json"
|
cuejson "cuelang.org/go/pkg/encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ctx = cuecontext.New()
|
|
||||||
|
|
||||||
// CueError wraps Errors caused by malformed cue files.
|
// CueError wraps Errors caused by malformed cue files.
|
||||||
type CueError struct {
|
type CueError struct {
|
||||||
ErrorMap map[int]string
|
ErrorMap map[int]string
|
||||||
@ -282,11 +278,16 @@ func ApplyDefaults(r Resource, scue cue.Value) (Resource, error) {
|
|||||||
if name == "" {
|
if name == "" {
|
||||||
name = "resource"
|
name = "resource"
|
||||||
}
|
}
|
||||||
rv := ctx.CompileString(r.Value.(string), cue.Filename(name))
|
rv := scue.Context().CompileString(r.Value.(string), cue.Filename(name))
|
||||||
if rv.Err() != nil {
|
if rv.Err() != nil {
|
||||||
return r, rv.Err()
|
return r, rv.Err()
|
||||||
}
|
}
|
||||||
rvUnified := rv.Unify(scue)
|
|
||||||
|
rvUnified, err := applyDefaultHelper(rv, scue)
|
||||||
|
if err != nil {
|
||||||
|
return r, err
|
||||||
|
}
|
||||||
|
|
||||||
re, err := convertCUEValueToString(rvUnified)
|
re, err := convertCUEValueToString(rvUnified)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return r, err
|
return r, err
|
||||||
@ -294,6 +295,68 @@ func ApplyDefaults(r Resource, scue cue.Value) (Resource, error) {
|
|||||||
return Resource{Value: re}, nil
|
return Resource{Value: re}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func applyDefaultHelper(input cue.Value, scue cue.Value) (cue.Value, error) {
|
||||||
|
switch scue.IncompleteKind() {
|
||||||
|
case cue.ListKind:
|
||||||
|
// if list element exist
|
||||||
|
ele := scue.LookupPath(cue.MakePath(cue.AnyIndex))
|
||||||
|
|
||||||
|
// if input is not a concrete list, we must have list elements exist to be used to trim defaults
|
||||||
|
if ele.Exists() {
|
||||||
|
if ele.IncompleteKind() == cue.BottomKind {
|
||||||
|
return input, errors.New("can't get the element of list")
|
||||||
|
}
|
||||||
|
iter, err := input.List()
|
||||||
|
if err != nil {
|
||||||
|
return input, errors.New("can't apply defaults for list")
|
||||||
|
}
|
||||||
|
var iterlist []cue.Value
|
||||||
|
for iter.Next() {
|
||||||
|
ref, err := getBranch(ele, iter.Value())
|
||||||
|
if err != nil {
|
||||||
|
return input, err
|
||||||
|
}
|
||||||
|
re, err := applyDefaultHelper(iter.Value(), ref)
|
||||||
|
if err == nil {
|
||||||
|
iterlist = append(iterlist, re)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
liInstance := scue.Context().NewList(iterlist...)
|
||||||
|
if liInstance.Err() != nil {
|
||||||
|
return input, liInstance.Err()
|
||||||
|
}
|
||||||
|
return liInstance, nil
|
||||||
|
} else {
|
||||||
|
return input.Unify(scue), nil
|
||||||
|
}
|
||||||
|
case cue.StructKind:
|
||||||
|
iter, err := scue.Fields(cue.Optional(true))
|
||||||
|
if err != nil {
|
||||||
|
return input, err
|
||||||
|
}
|
||||||
|
for iter.Next() {
|
||||||
|
lable, _ := iter.Value().Label()
|
||||||
|
lv := input.LookupPath(cue.MakePath(cue.Str(lable)))
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if lv.Exists() {
|
||||||
|
res, err := applyDefaultHelper(lv, iter.Value())
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
input = input.FillPath(cue.MakePath(cue.Str(lable)), res)
|
||||||
|
} else if !iter.IsOptional() {
|
||||||
|
input = input.FillPath(cue.MakePath(cue.Str(lable)), iter.Value().Eval())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return input, nil
|
||||||
|
default:
|
||||||
|
input = input.Unify(scue)
|
||||||
|
}
|
||||||
|
return input, nil
|
||||||
|
}
|
||||||
|
|
||||||
func convertCUEValueToString(inputCUE cue.Value) (string, error) {
|
func convertCUEValueToString(inputCUE cue.Value) (string, error) {
|
||||||
re, err := cuejson.Marshal(inputCUE)
|
re, err := cuejson.Marshal(inputCUE)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -315,34 +378,67 @@ func TrimDefaults(r Resource, scue cue.Value) (Resource, error) {
|
|||||||
if name == "" {
|
if name == "" {
|
||||||
name = "resource"
|
name = "resource"
|
||||||
}
|
}
|
||||||
rvInstance := ctx.CompileString(r.Value.(string), cue.Filename(name))
|
rvInstance := scue.Context().CompileString(r.Value.(string), cue.Filename(name))
|
||||||
if rvInstance.Err() != nil {
|
if rvInstance.Err() != nil {
|
||||||
return r, rvInstance.Err()
|
return r, rvInstance.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
rv, _, err := removeDefaultHelper(scue, rvInstance)
|
rv, _, err := removeDefaultHelper(scue, rvInstance)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return r, err
|
return r, err
|
||||||
}
|
}
|
||||||
re, err := convertCUEValueToString(rv)
|
re, err := convertCUEValueToString(rv)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return r, err
|
return r, err
|
||||||
}
|
}
|
||||||
return Resource{Value: re}, nil
|
return Resource{Value: re}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getDefault(icue cue.Value) (cue.Value, bool) {
|
||||||
|
d, exist := icue.Default()
|
||||||
|
if exist && d.Kind() == cue.ListKind {
|
||||||
|
len, err := d.Len().Int64()
|
||||||
|
if err != nil {
|
||||||
|
return d, false
|
||||||
|
}
|
||||||
|
var defaultExist bool
|
||||||
|
if len <= 0 {
|
||||||
|
op, vals := icue.Expr()
|
||||||
|
if op == cue.OrOp {
|
||||||
|
for _, val := range vals {
|
||||||
|
vallen, _ := val.Len().Int64()
|
||||||
|
if val.Kind() == cue.ListKind && vallen <= 0 {
|
||||||
|
defaultExist = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !defaultExist {
|
||||||
|
exist = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
exist = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return d, exist
|
||||||
|
}
|
||||||
|
|
||||||
func isCueValueEqual(inputdef cue.Value, input cue.Value) bool {
|
func isCueValueEqual(inputdef cue.Value, input cue.Value) bool {
|
||||||
val, _ := inputdef.Default()
|
d, exist := getDefault(inputdef)
|
||||||
return input.Subsume(val) == nil && val.Subsume(input) == nil
|
if exist {
|
||||||
|
return input.Subsume(d) == nil && d.Subsume(input) == nil
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeDefaultHelper(inputdef cue.Value, input cue.Value) (cue.Value, bool, error) {
|
func removeDefaultHelper(inputdef cue.Value, input cue.Value) (cue.Value, bool, error) {
|
||||||
// To include all optional fields, we need to use inputdef for iteration,
|
// To include all optional fields, we need to use inputdef for iteration,
|
||||||
// since the lookuppath with optional field doesn't work very well
|
// since the lookuppath with optional field doesn't work very well
|
||||||
rvInstance := ctx.CompileString("", cue.Filename("helper"))
|
rv := inputdef.Context().CompileString("", cue.Filename("helper"))
|
||||||
if rvInstance.Err() != nil {
|
if rv.Err() != nil {
|
||||||
return input, false, rvInstance.Err()
|
return input, false, rv.Err()
|
||||||
}
|
}
|
||||||
rv := rvInstance.Value()
|
|
||||||
|
|
||||||
switch inputdef.IncompleteKind() {
|
switch inputdef.IncompleteKind() {
|
||||||
case cue.StructKind:
|
case cue.StructKind:
|
||||||
@ -357,7 +453,7 @@ func removeDefaultHelper(inputdef cue.Value, input cue.Value) (cue.Value, bool,
|
|||||||
keySet[lable] = true
|
keySet[lable] = true
|
||||||
lv := input.LookupPath(cue.MakePath(cue.Str(lable)))
|
lv := input.LookupPath(cue.MakePath(cue.Str(lable)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
return rv, false, err
|
||||||
}
|
}
|
||||||
if lv.Exists() {
|
if lv.Exists() {
|
||||||
re, isEqual, err := removeDefaultHelper(iter.Value(), lv)
|
re, isEqual, err := removeDefaultHelper(iter.Value(), lv)
|
||||||
@ -382,34 +478,40 @@ func removeDefaultHelper(inputdef cue.Value, input cue.Value) (cue.Value, bool,
|
|||||||
if isCueValueEqual(inputdef, input) {
|
if isCueValueEqual(inputdef, input) {
|
||||||
return rv, true, nil
|
return rv, true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// take every element of the list
|
||||||
ele := inputdef.LookupPath(cue.MakePath(cue.AnyIndex))
|
ele := inputdef.LookupPath(cue.MakePath(cue.AnyIndex))
|
||||||
if ele.IncompleteKind() == cue.BottomKind {
|
|
||||||
return rv, true, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
iter, err := input.List()
|
// if input is not a concrete list, we must have list elements exist to be used to trim defaults
|
||||||
if err != nil {
|
if ele.Exists() {
|
||||||
return rv, true, nil
|
if ele.IncompleteKind() == cue.BottomKind {
|
||||||
}
|
return rv, true, nil
|
||||||
|
|
||||||
// The following code is workaround since today overwrite list element doesn't work
|
|
||||||
var iterlist []string
|
|
||||||
for iter.Next() {
|
|
||||||
re, isEqual, err := removeDefaultHelper(ele, iter.Value())
|
|
||||||
if err == nil && !isEqual {
|
|
||||||
reString, err := convertCUEValueToString(re)
|
|
||||||
if err != nil {
|
|
||||||
return rv, true, nil
|
|
||||||
}
|
|
||||||
iterlist = append(iterlist, reString)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iter, err := input.List()
|
||||||
|
if err != nil {
|
||||||
|
return rv, true, nil
|
||||||
|
}
|
||||||
|
var iterlist []cue.Value
|
||||||
|
for iter.Next() {
|
||||||
|
ref, err := getBranch(ele, iter.Value())
|
||||||
|
if err != nil {
|
||||||
|
iterlist = append(iterlist, iter.Value())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
re, isEqual, err := removeDefaultHelper(ref, iter.Value())
|
||||||
|
if err == nil && !isEqual {
|
||||||
|
iterlist = append(iterlist, re)
|
||||||
|
} else {
|
||||||
|
iterlist = append(iterlist, iter.Value())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
liInstance := inputdef.Context().NewList(iterlist...)
|
||||||
|
return liInstance, false, liInstance.Err()
|
||||||
}
|
}
|
||||||
iterlistContent := fmt.Sprintf("[%s]", strings.Join(iterlist, ","))
|
// now when ele is empty, we don't trim anything
|
||||||
liInstance := ctx.CompileString(iterlistContent, cue.Filename("resource"))
|
return input, false, nil
|
||||||
if liInstance.Err() != nil {
|
|
||||||
return rv, false, err
|
|
||||||
}
|
|
||||||
return liInstance, false, nil
|
|
||||||
default:
|
default:
|
||||||
if isCueValueEqual(inputdef, input) {
|
if isCueValueEqual(inputdef, input) {
|
||||||
return input, true, nil
|
return input, true, nil
|
||||||
@ -418,6 +520,21 @@ func removeDefaultHelper(inputdef cue.Value, input cue.Value) (cue.Value, bool,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getBranch(schemaObj cue.Value, concretObj cue.Value) (cue.Value, error) {
|
||||||
|
op, defs := schemaObj.Expr()
|
||||||
|
if op == cue.OrOp {
|
||||||
|
for _, def := range defs {
|
||||||
|
err := def.Unify(concretObj).Validate(cue.Concrete(true))
|
||||||
|
if err == nil {
|
||||||
|
return def, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// no matching branches? wtf
|
||||||
|
return schemaObj, errors.New("no branch is found for list")
|
||||||
|
}
|
||||||
|
return schemaObj, nil
|
||||||
|
}
|
||||||
|
|
||||||
// A Resource represents a concrete data object - e.g., JSON
|
// A Resource represents a concrete data object - e.g., JSON
|
||||||
// representing a dashboard.
|
// representing a dashboard.
|
||||||
//
|
//
|
||||||
|
@ -6,9 +6,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
|
"cuelang.org/go/cue/cuecontext"
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"golang.org/x/tools/txtar"
|
"golang.org/x/tools/txtar"
|
||||||
)
|
)
|
||||||
@ -27,9 +29,9 @@ func TestGenerate(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
t.Run(c.Name+" apply default value", func(t *testing.T) {
|
t.Run(c.Name+" apply defaults", func(t *testing.T) {
|
||||||
|
ctx := cuecontext.New()
|
||||||
scmInstance := ctx.CompileString(c.CUE, cue.Filename(c.Name+".cue"))
|
scmInstance := ctx.CompileString(c.CUE, cue.Filename(c.Name+".cue"))
|
||||||
if scmInstance.Err() != nil {
|
if scmInstance.Err() != nil {
|
||||||
t.Fatal(scmInstance.Err())
|
t.Fatal(scmInstance.Err())
|
||||||
@ -40,15 +42,17 @@ func TestGenerate(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
b := []byte(out.Value.(string))
|
b := []byte(out.Value.(string))
|
||||||
|
b, _ = JsonRemarshal(b)
|
||||||
|
|
||||||
if s := cmp.Diff(string(b), c.Full); s != "" {
|
if s := cmp.Diff(c.Full, string(b)); s != "" {
|
||||||
t.Fatal(s)
|
t.Fatal(s)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
t.Run(c.Name+" trim default value", func(t *testing.T) {
|
t.Run(c.Name+" trim defaults", func(t *testing.T) {
|
||||||
|
ctx := cuecontext.New()
|
||||||
scmInstance := ctx.CompileString(c.CUE, cue.Filename(c.Name+".cue"))
|
scmInstance := ctx.CompileString(c.CUE, cue.Filename(c.Name+".cue"))
|
||||||
if scmInstance.Err() != nil {
|
if scmInstance.Err() != nil {
|
||||||
t.Fatal(scmInstance.Err())
|
t.Fatal(scmInstance.Err())
|
||||||
@ -59,13 +63,32 @@ func TestGenerate(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
b := []byte(out.Value.(string))
|
b := []byte(out.Value.(string))
|
||||||
if s := cmp.Diff(string(b), c.Trimmed); s != "" {
|
b, _ = JsonRemarshal(b)
|
||||||
|
|
||||||
|
if s := cmp.Diff(c.Trimmed, string(b)); s != "" {
|
||||||
t.Fatal(s)
|
t.Fatal(s)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func JsonRemarshal(bytes []byte) ([]byte, error) {
|
||||||
|
var ifce interface{}
|
||||||
|
err := json.Unmarshal(bytes, &ifce)
|
||||||
|
if err != nil {
|
||||||
|
return []byte{}, err
|
||||||
|
}
|
||||||
|
output, err := json.Marshal(ifce)
|
||||||
|
outputstring := string(output)
|
||||||
|
if err != nil {
|
||||||
|
return []byte{}, err
|
||||||
|
}
|
||||||
|
outputstring = strings.Replace(outputstring, "\\u003c", "<", -1)
|
||||||
|
outputstring = strings.Replace(outputstring, "\\u003e", ">", -1)
|
||||||
|
outputstring = strings.Replace(outputstring, "\\u0026", "&", -1)
|
||||||
|
return []byte(outputstring), nil
|
||||||
|
}
|
||||||
|
|
||||||
func loadCases(dir string) ([]Case, error) {
|
func loadCases(dir string) ([]Case, error) {
|
||||||
files, err := ioutil.ReadDir(dir)
|
files, err := ioutil.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -96,7 +119,7 @@ func loadCases(dir string) ([]Case, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cases = append(cases, Case{
|
cases = append(cases, Case{
|
||||||
Name: fi.Name(),
|
Name: strings.TrimSuffix(fi.Name(), filepath.Ext(fi.Name())),
|
||||||
CUE: string(a.Files[0].Data),
|
CUE: string(a.Files[0].Data),
|
||||||
Full: fullBuffer.String(),
|
Full: fullBuffer.String(),
|
||||||
Trimmed: trimBuffer.String(),
|
Trimmed: trimBuffer.String(),
|
||||||
|
1180
pkg/schema/testdata/devenvgoldenfiles/all-panels.json
vendored
Normal file
1180
pkg/schema/testdata/devenvgoldenfiles/all-panels.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
621
pkg/schema/testdata/devenvgoldenfiles/barchart-autosizing.json
vendored
Normal file
621
pkg/schema/testdata/devenvgoldenfiles/barchart-autosizing.json
vendored
Normal file
@ -0,0 +1,621 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"target": {
|
||||||
|
"limit": 100,
|
||||||
|
"matchAny": false,
|
||||||
|
"tags": [],
|
||||||
|
"type": "dashboard"
|
||||||
|
},
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"axisSoftMin": 0,
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineWidth": 0
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 10,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 9,
|
||||||
|
"options": {
|
||||||
|
"barWidth": 1,
|
||||||
|
"groupWidth": 0.82,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [
|
||||||
|
"max"
|
||||||
|
],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "right",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"orientation": "auto",
|
||||||
|
"showValue": "auto",
|
||||||
|
"stacking": "none",
|
||||||
|
"text": {},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Time,Name,Stat1,Stat2\n2020-01-01T00:00:00Z,Stockholm, 10, 15\n2020-01-01T00:00:00Z,New York, 19, 5\n2020-01-01T00:00:00Z,London, 10, 1\n2020-01-01T00:00:00Z,Negative, 15, -5\n2020-01-01T00:00:00Z,Long value, 15,10",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Auto sizing & auto show values",
|
||||||
|
"type": "barchart",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Should be smaller given the longer value",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"axisSoftMin": 0,
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineWidth": 0
|
||||||
|
},
|
||||||
|
"decimals": 2,
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 10,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 15,
|
||||||
|
"options": {
|
||||||
|
"barWidth": 1,
|
||||||
|
"groupWidth": 0.82,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [
|
||||||
|
"max"
|
||||||
|
],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "right",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"orientation": "auto",
|
||||||
|
"showValue": "auto",
|
||||||
|
"stacking": "none",
|
||||||
|
"text": {},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name,Stat1,Stat2\nStockholm, 10, 15\nNew York, 19, 5\nLondon, 10, 1\nNegative, 15, -5\nLong value, 15,10",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Auto sizing & auto show values",
|
||||||
|
"type": "barchart",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"axisSoftMin": 0,
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineWidth": 0
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 8,
|
||||||
|
"x": 0,
|
||||||
|
"y": 10
|
||||||
|
},
|
||||||
|
"id": 16,
|
||||||
|
"options": {
|
||||||
|
"barWidth": 1,
|
||||||
|
"groupWidth": 0.89,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [
|
||||||
|
"max"
|
||||||
|
],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "right",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"orientation": "auto",
|
||||||
|
"showValue": "auto",
|
||||||
|
"stacking": "none",
|
||||||
|
"text": {},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name,Stat1,Stat2,Stat3,Stat4,Stat5,Stat6,Stat7,Stat8,Stat9,Stat10\nA, 10, 15,8,3,4,12,14,1,5,10\nB, 19, 5,8,3,4,12,14,6,7,2\nC, 15, 5,8,3,4,10,4,6,7,2\n",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "auto show values & No room for value",
|
||||||
|
"type": "barchart",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"axisSoftMin": 0,
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineWidth": 0
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 8,
|
||||||
|
"x": 8,
|
||||||
|
"y": 10
|
||||||
|
},
|
||||||
|
"id": 17,
|
||||||
|
"options": {
|
||||||
|
"barWidth": 1,
|
||||||
|
"groupWidth": 0.89,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [
|
||||||
|
"max"
|
||||||
|
],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "right",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"orientation": "auto",
|
||||||
|
"showValue": "always",
|
||||||
|
"stacking": "none",
|
||||||
|
"text": {},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name,Stat1,Stat2,Stat3,Stat4,Stat5,Stat6,Stat7,Stat8,Stat9,Stat10\nA, 10, 15,8,3,4,12,14,1,5,10\nB, 19, 5,8,3,4,12,14,6,7,2\nC, 15, 5,8,3,4,10,4,6,7,2\n",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "auto show values & Always show value",
|
||||||
|
"type": "barchart",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"axisSoftMin": 0,
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineWidth": 0
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 8,
|
||||||
|
"x": 16,
|
||||||
|
"y": 10
|
||||||
|
},
|
||||||
|
"id": 10,
|
||||||
|
"options": {
|
||||||
|
"barWidth": 1,
|
||||||
|
"groupWidth": 1,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"orientation": "auto",
|
||||||
|
"showValue": "auto",
|
||||||
|
"stacking": "none",
|
||||||
|
"text": {
|
||||||
|
"titleSize": 10,
|
||||||
|
"valueSize": 25
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 9,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Fixed value sizing",
|
||||||
|
"type": "barchart",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"axisSoftMin": 0,
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineWidth": 0
|
||||||
|
},
|
||||||
|
"decimals": 7,
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 21
|
||||||
|
},
|
||||||
|
"id": 18,
|
||||||
|
"options": {
|
||||||
|
"barWidth": 1,
|
||||||
|
"groupWidth": 0.82,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [
|
||||||
|
"max"
|
||||||
|
],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "right",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"orientation": "horizontal",
|
||||||
|
"showValue": "auto",
|
||||||
|
"stacking": "none",
|
||||||
|
"text": {},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name,Stat1,Stat2\nStockholm, 10, 15\nNew York, 19, -5\nLondon, 10, 1\nLong value, 15,10",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Auto sizing & auto show values",
|
||||||
|
"type": "barchart",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"axisSoftMin": 0,
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineWidth": 0
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 21
|
||||||
|
},
|
||||||
|
"id": 19,
|
||||||
|
"options": {
|
||||||
|
"barWidth": 1,
|
||||||
|
"groupWidth": 0.89,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [
|
||||||
|
"max"
|
||||||
|
],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "right",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"orientation": "horizontal",
|
||||||
|
"showValue": "auto",
|
||||||
|
"stacking": "none",
|
||||||
|
"text": {},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name,Stat1,Stat2,Stat3,Stat4,Stat5,Stat6,Stat7,Stat8,Stat9,Stat10\nA, 10, 15,8,3,4,12,14,1,5,10\nB, 19, 5,8,3,4,12,14,6,7,2\nC, 15, 5,8,3,4,10,4,6,7,2\n",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "auto show values & little room",
|
||||||
|
"type": "barchart",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": "",
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"panel-tests",
|
||||||
|
"barchart"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-5m",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false,
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "BarChart - Panel Tests - Value sizing",
|
||||||
|
"uid": "WFlOM-jM1",
|
||||||
|
"version": 9
|
||||||
|
}
|
617
pkg/schema/testdata/devenvgoldenfiles/config-from-query.json
vendored
Normal file
617
pkg/schema/testdata/devenvgoldenfiles/config-from-query.json
vendored
Normal file
@ -0,0 +1,617 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"target": {
|
||||||
|
"limit": 100,
|
||||||
|
"matchAny": false,
|
||||||
|
"tags": [],
|
||||||
|
"type": "dashboard"
|
||||||
|
},
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "",
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "line",
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "linear",
|
||||||
|
"lineWidth": 1,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "auto",
|
||||||
|
"spanNulls": false,
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "line"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 9,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 2,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"hide": false,
|
||||||
|
"max": 100,
|
||||||
|
"min": 1,
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "random_walk",
|
||||||
|
"startValue": 50
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "",
|
||||||
|
"csvContent": "min,max,threshold1\n1000,1000,8000\n0,100,80\n\n",
|
||||||
|
"refId": "config",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Min, max, threshold from separate query",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "configFromData",
|
||||||
|
"options": {
|
||||||
|
"configRefId": "config",
|
||||||
|
"mappings": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "left",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"matcher": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "SensorA"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "custom.displayMode",
|
||||||
|
"value": "color-text"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 9,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 5,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name, Value, SensorA, MyUnit, MyColor\nGoogle, 10, 50, km/h, blue\nGoogle, 100, 100,km/h, orange\n",
|
||||||
|
"hide": false,
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Custom mappings and apply to self",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "configFromData",
|
||||||
|
"options": {
|
||||||
|
"applyTo": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "SensorA"
|
||||||
|
},
|
||||||
|
"applyToConfig": true,
|
||||||
|
"configRefId": "A",
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"configProperty": "unit",
|
||||||
|
"fieldName": "MyUnit",
|
||||||
|
"handlerKey": "unit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldName": "MyColor",
|
||||||
|
"handlerKey": "color"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "center",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"matcher": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "Value"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "custom.displayMode",
|
||||||
|
"value": "color-background-solid"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 5,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 9
|
||||||
|
},
|
||||||
|
"id": 7,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "ID, DisplayText\n21412312312, Homer\n12421412413, Simpsons \n12321312313, Bart",
|
||||||
|
"hide": false,
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Mapping data",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "configFromData",
|
||||||
|
"options": {
|
||||||
|
"applyToConfig": true,
|
||||||
|
"configRefId": "A",
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"fieldName": "Color",
|
||||||
|
"handlerKey": "mappings.color"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldName": "Value",
|
||||||
|
"handlerKey": "mappings.value"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "center",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"matcher": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "Value"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "custom.displayMode",
|
||||||
|
"value": "color-background-solid"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 10,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 9
|
||||||
|
},
|
||||||
|
"id": 6,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Value, Color\nOK, blue\nPretty bad, red\nYay it's green, green\nSomething is off, orange\nNo idea, #88AA00\nAm I purple?, purple",
|
||||||
|
"hide": false,
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Value mappings from query result applied to itself",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "configFromData",
|
||||||
|
"options": {
|
||||||
|
"applyTo": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "Value"
|
||||||
|
},
|
||||||
|
"applyToConfig": true,
|
||||||
|
"configRefId": "A",
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"fieldName": "Color",
|
||||||
|
"handlerKey": "mappings.color"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldName": "Value",
|
||||||
|
"handlerKey": "mappings.value"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "center",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 5,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 14
|
||||||
|
},
|
||||||
|
"id": 8,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "ID, Value\n21412312312, 100\n12421412413, 20\n12321312313, 10",
|
||||||
|
"hide": false,
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Display data",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "configFromData",
|
||||||
|
"options": {
|
||||||
|
"applyToConfig": true,
|
||||||
|
"configRefId": "A",
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"fieldName": "Color",
|
||||||
|
"handlerKey": "mappings.color"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldName": "Value",
|
||||||
|
"handlerKey": "mappings.value"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"axisSoftMin": 0,
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 10,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 19
|
||||||
|
},
|
||||||
|
"id": 9,
|
||||||
|
"options": {
|
||||||
|
"barWidth": 0.97,
|
||||||
|
"groupWidth": 0.7,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"orientation": "horizontal",
|
||||||
|
"stacking": "none",
|
||||||
|
"showValue": "auto",
|
||||||
|
"text": {},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "ID, Value\nA21412312312, 100\nA12421412413, 20\nA12321312313, 10\n",
|
||||||
|
"hide": false,
|
||||||
|
"refId": "data",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"csvContent": "ID, DisplayText\nA21412312312, Homer\nA12421412413, Marge \nA12321312313, Bart",
|
||||||
|
"hide": false,
|
||||||
|
"refId": "mappings",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Value mapping ID -> DisplayText from separate query",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "configFromData",
|
||||||
|
"options": {
|
||||||
|
"applyTo": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "ID"
|
||||||
|
},
|
||||||
|
"applyToConfig": false,
|
||||||
|
"configRefId": "mappings",
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"fieldName": "ID",
|
||||||
|
"handlerKey": "mappings.value"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldName": "DisplayText",
|
||||||
|
"handlerKey": "mappings.text"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "barchart",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": "",
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"transform"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-6h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false,
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "Transforms - Config from query",
|
||||||
|
"uid": "Juj4_7ink",
|
||||||
|
"version": 1
|
||||||
|
}
|
10830
pkg/schema/testdata/devenvgoldenfiles/elasticsearch_compare.json
vendored
Normal file
10830
pkg/schema/testdata/devenvgoldenfiles/elasticsearch_compare.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
944
pkg/schema/testdata/devenvgoldenfiles/graph-ng-by-value-color-schemes.json
vendored
Normal file
944
pkg/schema/testdata/devenvgoldenfiles/graph-ng-by-value-color-schemes.json
vendored
Normal file
@ -0,0 +1,944 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"target": {
|
||||||
|
"limit": 100,
|
||||||
|
"matchAny": false,
|
||||||
|
"tags": [],
|
||||||
|
"type": "dashboard"
|
||||||
|
},
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"description": "",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "line",
|
||||||
|
"fillOpacity": 37,
|
||||||
|
"gradientMode": "scheme",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "smooth",
|
||||||
|
"lineWidth": 3,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "never",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"max": 50,
|
||||||
|
"min": 0,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "orange",
|
||||||
|
"value": 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "degree"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 8,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 11,
|
||||||
|
"maxDataPoints": 45,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "hidden",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "1,10,20,30,40,50"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "15 orange, 30 red",
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "line",
|
||||||
|
"fillOpacity": 37,
|
||||||
|
"gradientMode": "scheme",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "smooth",
|
||||||
|
"lineWidth": 3,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "never",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"max": 50,
|
||||||
|
"min": 20,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "orange",
|
||||||
|
"value": 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "degree"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 8,
|
||||||
|
"x": 8,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 12,
|
||||||
|
"maxDataPoints": 45,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "1,10,20,30,40,50"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "15 orange, 30 red",
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "line",
|
||||||
|
"fillOpacity": 37,
|
||||||
|
"gradientMode": "scheme",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "smooth",
|
||||||
|
"lineWidth": 2,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "never",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"max": 50,
|
||||||
|
"min": 20,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "orange",
|
||||||
|
"value": 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 50
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "degree"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 8,
|
||||||
|
"x": 16,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 13,
|
||||||
|
"maxDataPoints": 45,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "1,10,20,30,40,50"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "15 orange, 50 red",
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "line",
|
||||||
|
"fillOpacity": 5,
|
||||||
|
"gradientMode": "scheme",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "smooth",
|
||||||
|
"lineWidth": 3,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "never",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"max": 50,
|
||||||
|
"min": 0,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "orange",
|
||||||
|
"value": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "degree"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 7
|
||||||
|
},
|
||||||
|
"id": 9,
|
||||||
|
"maxDataPoints": 45,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 4,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Color line by discrete tresholds",
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "bars",
|
||||||
|
"fillOpacity": 84,
|
||||||
|
"gradientMode": "scheme",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "smooth",
|
||||||
|
"lineWidth": 0,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "never",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"max": 50,
|
||||||
|
"min": 0,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "orange",
|
||||||
|
"value": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "degree"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 7
|
||||||
|
},
|
||||||
|
"id": 4,
|
||||||
|
"interval": "80s",
|
||||||
|
"maxDataPoints": 42,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"max": 40,
|
||||||
|
"min": 0,
|
||||||
|
"noise": 1,
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "random_walk",
|
||||||
|
"spread": 20,
|
||||||
|
"startValue": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Color bars by discrete thresholds",
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "continuous-GrYlRd"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "line",
|
||||||
|
"fillOpacity": 10,
|
||||||
|
"gradientMode": "scheme",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "smooth",
|
||||||
|
"lineWidth": 3,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "never",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"max": 50,
|
||||||
|
"min": 0,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "blue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "green",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "orange",
|
||||||
|
"value": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "degree"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 14
|
||||||
|
},
|
||||||
|
"id": 6,
|
||||||
|
"maxDataPoints": 50,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 4,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Color line by color scale",
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "continuous-GrYlRd"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "bars",
|
||||||
|
"fillOpacity": 64,
|
||||||
|
"gradientMode": "scheme",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "smooth",
|
||||||
|
"lineWidth": 1,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "never",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"max": 50,
|
||||||
|
"min": 0,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "blue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "green",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "orange",
|
||||||
|
"value": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "degree"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 14
|
||||||
|
},
|
||||||
|
"id": 10,
|
||||||
|
"maxDataPoints": 45,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 4,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Color bars by color scale",
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "continuous-GrYlRd"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "line",
|
||||||
|
"fillOpacity": 64,
|
||||||
|
"gradientMode": "scheme",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "smooth",
|
||||||
|
"lineWidth": 1,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "never",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"max": 50,
|
||||||
|
"min": 0,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "blue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "green",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "orange",
|
||||||
|
"value": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "degree"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 21
|
||||||
|
},
|
||||||
|
"id": 7,
|
||||||
|
"maxDataPoints": 50,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 4,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Color line by color scale",
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "continuous-GrYlRd"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": 0,
|
||||||
|
"drawStyle": "points",
|
||||||
|
"fillOpacity": 10,
|
||||||
|
"gradientMode": "scheme",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "smooth",
|
||||||
|
"lineWidth": 3,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "never",
|
||||||
|
"spanNulls": false,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"max": 50,
|
||||||
|
"min": 0,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "blue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "green",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "orange",
|
||||||
|
"value": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "degree"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 21
|
||||||
|
},
|
||||||
|
"id": 8,
|
||||||
|
"maxDataPoints": 250,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"max": 45,
|
||||||
|
"min": 20,
|
||||||
|
"noise": 0,
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "random_walk",
|
||||||
|
"spread": 12,
|
||||||
|
"startValue": 40
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hide": false,
|
||||||
|
"max": 20,
|
||||||
|
"min": 1,
|
||||||
|
"noise": 0,
|
||||||
|
"refId": "B",
|
||||||
|
"scenarioId": "random_walk",
|
||||||
|
"spread": 10
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Color line by color scale",
|
||||||
|
"type": "timeseries",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": false,
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"panel-tests"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-6h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false,
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "Panel Tests - Graph NG - By value color schemes",
|
||||||
|
"uid": "aBXrJ0R7z",
|
||||||
|
"version": 11
|
||||||
|
}
|
1321
pkg/schema/testdata/devenvgoldenfiles/graph-ng-nulls.json
vendored
Normal file
1321
pkg/schema/testdata/devenvgoldenfiles/graph-ng-nulls.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
497
pkg/schema/testdata/devenvgoldenfiles/histogram_tests.json
vendored
Normal file
497
pkg/schema/testdata/devenvgoldenfiles/histogram_tests.json
vendored
Normal file
@ -0,0 +1,497 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"id": 632,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"viz": false,
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false
|
||||||
|
},
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 4,
|
||||||
|
"options": {
|
||||||
|
"bucketOffset": 0,
|
||||||
|
"combine": false,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "hidden",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "random_walk",
|
||||||
|
"spread": 10
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Time series + Auto buckets",
|
||||||
|
"type": "histogram",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"viz": false,
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false
|
||||||
|
},
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 3,
|
||||||
|
"options": {
|
||||||
|
"bucketOffset": 0,
|
||||||
|
"bucketSize": 3,
|
||||||
|
"combine": false,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "hidden",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 4,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Time series + bucket size 3",
|
||||||
|
"type": "histogram",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"viz": false,
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false
|
||||||
|
},
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 8
|
||||||
|
},
|
||||||
|
"id": 5,
|
||||||
|
"options": {
|
||||||
|
"bucketOffset": 0,
|
||||||
|
"bucketSize": 1,
|
||||||
|
"combine": false,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "hidden",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvFileName": "weight_height.csv",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "People height distribution",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "filterFieldsByName",
|
||||||
|
"options": {
|
||||||
|
"include": {
|
||||||
|
"names": [
|
||||||
|
"Height"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "histogram",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"viz": false,
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false
|
||||||
|
},
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 8
|
||||||
|
},
|
||||||
|
"id": 6,
|
||||||
|
"options": {
|
||||||
|
"bucketOffset": 0,
|
||||||
|
"bucketSize": 5,
|
||||||
|
"combine": false,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "hidden",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvFileName": "weight_height.csv",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "People weight distribution",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "filterFieldsByName",
|
||||||
|
"options": {
|
||||||
|
"include": {
|
||||||
|
"names": [
|
||||||
|
"Weight"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "histogram",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "auto",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 9,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 16
|
||||||
|
},
|
||||||
|
"id": 8,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvFileName": "weight_height.csv",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Standalone transform - Height",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "filterFieldsByName",
|
||||||
|
"options": {
|
||||||
|
"include": {
|
||||||
|
"names": [
|
||||||
|
"Height"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "histogram",
|
||||||
|
"options": {
|
||||||
|
"combine": true,
|
||||||
|
"fields": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "auto",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 9,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 16
|
||||||
|
},
|
||||||
|
"id": 9,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvFileName": "weight_height.csv",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Standalone transform - Weight",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "filterFieldsByName",
|
||||||
|
"options": {
|
||||||
|
"include": {
|
||||||
|
"names": [
|
||||||
|
"Weight"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "histogram",
|
||||||
|
"options": {
|
||||||
|
"combine": true,
|
||||||
|
"fields": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"panel-tests"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-6h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false,
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "Panel Tests - Histogram",
|
||||||
|
"uid": "UTv--wqMk",
|
||||||
|
"version": 4
|
||||||
|
}
|
313
pkg/schema/testdata/devenvgoldenfiles/home.json
vendored
Normal file
313
pkg/schema/testdata/devenvgoldenfiles/home.json
vendored
Normal file
@ -0,0 +1,313 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"target": {
|
||||||
|
"limit": 100,
|
||||||
|
"matchAny": false,
|
||||||
|
"tags": [],
|
||||||
|
"type": "dashboard"
|
||||||
|
},
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"gridPos": {
|
||||||
|
"h": 26,
|
||||||
|
"w": 6,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 7,
|
||||||
|
"links": [],
|
||||||
|
"options": {
|
||||||
|
"maxItems": 100,
|
||||||
|
"query": "",
|
||||||
|
"showHeadings": true,
|
||||||
|
"showRecentlyViewed": true,
|
||||||
|
"showSearch": false,
|
||||||
|
"showStarred": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"tags": [],
|
||||||
|
"title": "Starred",
|
||||||
|
"type": "dashlist",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": [],
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gridPos": {
|
||||||
|
"h": 13,
|
||||||
|
"w": 6,
|
||||||
|
"x": 6,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 2,
|
||||||
|
"links": [],
|
||||||
|
"options": {
|
||||||
|
"maxItems": 1000,
|
||||||
|
"query": "",
|
||||||
|
"showHeadings": false,
|
||||||
|
"showRecentlyViewed": false,
|
||||||
|
"showSearch": true,
|
||||||
|
"showStarred": false,
|
||||||
|
"tags": [
|
||||||
|
"panel-tests"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"tags": [
|
||||||
|
"panel-tests"
|
||||||
|
],
|
||||||
|
"title": "tag: panel-tests",
|
||||||
|
"type": "dashlist",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": [],
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gridPos": {
|
||||||
|
"h": 13,
|
||||||
|
"w": 6,
|
||||||
|
"x": 12,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 3,
|
||||||
|
"links": [],
|
||||||
|
"options": {
|
||||||
|
"maxItems": 1000,
|
||||||
|
"query": "",
|
||||||
|
"showHeadings": false,
|
||||||
|
"showRecentlyViewed": false,
|
||||||
|
"showSearch": true,
|
||||||
|
"showStarred": false,
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"demo"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"demo"
|
||||||
|
],
|
||||||
|
"title": "tag: dashboard-demo",
|
||||||
|
"type": "dashlist",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": [],
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gridPos": {
|
||||||
|
"h": 26,
|
||||||
|
"w": 6,
|
||||||
|
"x": 18,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 5,
|
||||||
|
"links": [],
|
||||||
|
"options": {
|
||||||
|
"maxItems": 1000,
|
||||||
|
"query": "",
|
||||||
|
"showHeadings": false,
|
||||||
|
"showRecentlyViewed": false,
|
||||||
|
"showSearch": true,
|
||||||
|
"showStarred": false,
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"datasource-test"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"datasource-test"
|
||||||
|
],
|
||||||
|
"title": "Data source tests",
|
||||||
|
"type": "dashlist",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": [],
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gridPos": {
|
||||||
|
"h": 13,
|
||||||
|
"w": 6,
|
||||||
|
"x": 6,
|
||||||
|
"y": 13
|
||||||
|
},
|
||||||
|
"id": 4,
|
||||||
|
"links": [],
|
||||||
|
"options": {
|
||||||
|
"maxItems": 1000,
|
||||||
|
"query": "",
|
||||||
|
"showHeadings": false,
|
||||||
|
"showRecentlyViewed": false,
|
||||||
|
"showSearch": true,
|
||||||
|
"showStarred": false,
|
||||||
|
"tags": [
|
||||||
|
"templating",
|
||||||
|
"gdev"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"tags": [
|
||||||
|
"templating",
|
||||||
|
"gdev"
|
||||||
|
],
|
||||||
|
"title": "tag: templating ",
|
||||||
|
"type": "dashlist",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": [],
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gridPos": {
|
||||||
|
"h": 13,
|
||||||
|
"w": 6,
|
||||||
|
"x": 12,
|
||||||
|
"y": 13
|
||||||
|
},
|
||||||
|
"id": 8,
|
||||||
|
"links": [],
|
||||||
|
"options": {
|
||||||
|
"maxItems": 1000,
|
||||||
|
"query": "",
|
||||||
|
"showHeadings": false,
|
||||||
|
"showRecentlyViewed": false,
|
||||||
|
"showSearch": true,
|
||||||
|
"showStarred": false,
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"transform"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"demo"
|
||||||
|
],
|
||||||
|
"title": "tag: transforms",
|
||||||
|
"type": "dashlist",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": [],
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-6h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
],
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false,
|
||||||
|
"time_options": [
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"1h",
|
||||||
|
"6h",
|
||||||
|
"12h",
|
||||||
|
"24h",
|
||||||
|
"2d",
|
||||||
|
"7d",
|
||||||
|
"30d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "Grafana Dev Overview & Home",
|
||||||
|
"uid": "j6T00KRZz",
|
||||||
|
"version": 2
|
||||||
|
}
|
3097
pkg/schema/testdata/devenvgoldenfiles/new_features_in_v8.json
vendored
Normal file
3097
pkg/schema/testdata/devenvgoldenfiles/new_features_in_v8.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
252
pkg/schema/testdata/devenvgoldenfiles/opentsdb_v2.3.json
vendored
Normal file
252
pkg/schema/testdata/devenvgoldenfiles/opentsdb_v2.3.json
vendored
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"id": 3151,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"aliasColors": {},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "gdev-opentsdb-v2.3",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"links": []
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"fill": 1,
|
||||||
|
"fillGradient": 0,
|
||||||
|
"gridPos": {
|
||||||
|
"h": 9,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"hiddenSeries": false,
|
||||||
|
"id": 2,
|
||||||
|
"legend": {
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"show": true,
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 1,
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"options": {
|
||||||
|
"alertThreshold": true
|
||||||
|
},
|
||||||
|
"percentage": false,
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"pointradius": 2,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"seriesOverrides": [],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"aggregator": "sum",
|
||||||
|
"alias": "$tag_hostname",
|
||||||
|
"currentFilterGroupBy": false,
|
||||||
|
"currentFilterKey": "",
|
||||||
|
"currentFilterType": "literal_or",
|
||||||
|
"currentFilterValue": "",
|
||||||
|
"disableDownsampling": false,
|
||||||
|
"downsampleAggregator": "avg",
|
||||||
|
"downsampleFillPolicy": "none",
|
||||||
|
"explicitTags": false,
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"filter": "*",
|
||||||
|
"groupBy": true,
|
||||||
|
"tagk": "hostname",
|
||||||
|
"type": "wildcard"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metric": "cpu",
|
||||||
|
"refId": "A",
|
||||||
|
"shouldComputeRate": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [],
|
||||||
|
"timeRegions": [],
|
||||||
|
"title": "CPU per host",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"mode": "time",
|
||||||
|
"show": true,
|
||||||
|
"values": []
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"logBase": 1,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"logBase": 1,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"yaxis": {
|
||||||
|
"align": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "gdev-opentsdb-v2.3",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"links": []
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"fill": 1,
|
||||||
|
"fillGradient": 0,
|
||||||
|
"gridPos": {
|
||||||
|
"h": 9,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"hiddenSeries": false,
|
||||||
|
"id": 4,
|
||||||
|
"legend": {
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"show": true,
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 1,
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"options": {
|
||||||
|
"alertThreshold": true
|
||||||
|
},
|
||||||
|
"percentage": false,
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"pointradius": 2,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"seriesOverrides": [],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"aggregator": "sum",
|
||||||
|
"alias": "$tag_hostname",
|
||||||
|
"currentFilterGroupBy": false,
|
||||||
|
"currentFilterKey": "",
|
||||||
|
"currentFilterType": "literal_or",
|
||||||
|
"currentFilterValue": "",
|
||||||
|
"downsampleAggregator": "avg",
|
||||||
|
"downsampleFillPolicy": "none",
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"filter": "*",
|
||||||
|
"groupBy": true,
|
||||||
|
"tagk": "hostname",
|
||||||
|
"type": "wildcard"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metric": "logins.count",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [],
|
||||||
|
"timeRegions": [],
|
||||||
|
"title": "Login Count per host",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"mode": "time",
|
||||||
|
"show": true,
|
||||||
|
"values": []
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"logBase": 1,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"logBase": 1,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"yaxis": {
|
||||||
|
"align": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-1h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false,
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "Datasource tests - OpenTSDB v2.3",
|
||||||
|
"uid": "rZRUGik7k",
|
||||||
|
"version": 3
|
||||||
|
}
|
414
pkg/schema/testdata/devenvgoldenfiles/panel-geomap.json
vendored
Normal file
414
pkg/schema/testdata/devenvgoldenfiles/panel-geomap.json
vendored
Normal file
@ -0,0 +1,414 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"target": {
|
||||||
|
"limit": 100,
|
||||||
|
"matchAny": false,
|
||||||
|
"tags": [],
|
||||||
|
"type": "dashboard"
|
||||||
|
},
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"links": [],
|
||||||
|
"liveNow": false,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "continuous-GrYlRd"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 9,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 62,
|
||||||
|
"options": {
|
||||||
|
"basemap": {
|
||||||
|
"config": {},
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
"controls": {
|
||||||
|
"mouseWheelZoom": true,
|
||||||
|
"showAttribution": true,
|
||||||
|
"showDebug": false,
|
||||||
|
"showScale": false,
|
||||||
|
"showZoom": true
|
||||||
|
},
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"color": {
|
||||||
|
"field": "Price",
|
||||||
|
"fixed": "dark-green"
|
||||||
|
},
|
||||||
|
"fillOpacity": 0.4,
|
||||||
|
"shape": "circle",
|
||||||
|
"showLegend": true,
|
||||||
|
"size": {
|
||||||
|
"field": "Count",
|
||||||
|
"fixed": 5,
|
||||||
|
"max": 15,
|
||||||
|
"min": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"gazetteer": "public/gazetteer/usa-states.json",
|
||||||
|
"lookup": "State",
|
||||||
|
"mode": "auto"
|
||||||
|
},
|
||||||
|
"type": "markers"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"view": {
|
||||||
|
"id": "coords",
|
||||||
|
"lat": 38.297683,
|
||||||
|
"lon": -99.228359,
|
||||||
|
"shared": true,
|
||||||
|
"zoom": 3.98
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvFileName": "flight_info_by_state.csv",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Size, color mapped to different fields + share view",
|
||||||
|
"type": "geomap",
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "#EAB839",
|
||||||
|
"value": 90
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 9,
|
||||||
|
"x": 9,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 66,
|
||||||
|
"options": {
|
||||||
|
"basemap": {
|
||||||
|
"config": {},
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
"controls": {
|
||||||
|
"mouseWheelZoom": true,
|
||||||
|
"showAttribution": true,
|
||||||
|
"showDebug": false,
|
||||||
|
"showScale": false,
|
||||||
|
"showZoom": true
|
||||||
|
},
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"color": {
|
||||||
|
"field": "Price",
|
||||||
|
"fixed": "dark-green"
|
||||||
|
},
|
||||||
|
"fillOpacity": 0.4,
|
||||||
|
"shape": "circle",
|
||||||
|
"showLegend": true,
|
||||||
|
"size": {
|
||||||
|
"field": "Count",
|
||||||
|
"fixed": 5,
|
||||||
|
"max": 15,
|
||||||
|
"min": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"gazetteer": "public/gazetteer/usa-states.json",
|
||||||
|
"lookup": "State",
|
||||||
|
"mode": "auto"
|
||||||
|
},
|
||||||
|
"type": "markers"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"view": {
|
||||||
|
"id": "coords",
|
||||||
|
"lat": 38.297683,
|
||||||
|
"lon": -99.228359,
|
||||||
|
"shared": true,
|
||||||
|
"zoom": 3.98
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvFileName": "flight_info_by_state.csv",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Thresholds legend",
|
||||||
|
"type": "geomap",
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "continuous-BlYlRd"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 9,
|
||||||
|
"x": 0,
|
||||||
|
"y": 11
|
||||||
|
},
|
||||||
|
"id": 63,
|
||||||
|
"options": {
|
||||||
|
"basemap": {
|
||||||
|
"config": {},
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
"controls": {
|
||||||
|
"mouseWheelZoom": true,
|
||||||
|
"showAttribution": true,
|
||||||
|
"showDebug": false,
|
||||||
|
"showScale": false,
|
||||||
|
"showZoom": true
|
||||||
|
},
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"blur": 27,
|
||||||
|
"radius": 25,
|
||||||
|
"weight": {
|
||||||
|
"field": "Count",
|
||||||
|
"fixed": 1,
|
||||||
|
"max": 1,
|
||||||
|
"min": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"gazetteer": "public/gazetteer/usa-states.json",
|
||||||
|
"lookup": "State",
|
||||||
|
"mode": "auto"
|
||||||
|
},
|
||||||
|
"type": "heatmap"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"view": {
|
||||||
|
"id": "coords",
|
||||||
|
"lat": 38.251497,
|
||||||
|
"lon": -100.932144,
|
||||||
|
"shared": false,
|
||||||
|
"zoom": 4.15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvFileName": "flight_info_by_state.csv",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Heatmap data layer",
|
||||||
|
"transformations": [],
|
||||||
|
"type": "geomap",
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "continuous-GrYlRd"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 9,
|
||||||
|
"x": 9,
|
||||||
|
"y": 11
|
||||||
|
},
|
||||||
|
"id": 65,
|
||||||
|
"options": {
|
||||||
|
"basemap": {
|
||||||
|
"config": {
|
||||||
|
"server": "world-imagery"
|
||||||
|
},
|
||||||
|
"type": "esri-xyz"
|
||||||
|
},
|
||||||
|
"controls": {
|
||||||
|
"mouseWheelZoom": true,
|
||||||
|
"showAttribution": true,
|
||||||
|
"showDebug": false,
|
||||||
|
"showScale": false,
|
||||||
|
"showZoom": true
|
||||||
|
},
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"color": {
|
||||||
|
"fixed": "#ff001e"
|
||||||
|
},
|
||||||
|
"fillOpacity": 0.4,
|
||||||
|
"shape": "star",
|
||||||
|
"showLegend": true,
|
||||||
|
"size": {
|
||||||
|
"field": "Count",
|
||||||
|
"fixed": 5,
|
||||||
|
"max": 15,
|
||||||
|
"min": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"gazetteer": "public/gazetteer/usa-states.json",
|
||||||
|
"lookup": "State",
|
||||||
|
"mode": "auto"
|
||||||
|
},
|
||||||
|
"type": "markers"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"view": {
|
||||||
|
"id": "coords",
|
||||||
|
"lat": 40.159084,
|
||||||
|
"lon": -96.508021,
|
||||||
|
"shared": true,
|
||||||
|
"zoom": 3.83
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvFileName": "flight_info_by_state.csv",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Base layer ArcGIS wold imagery + star shape + share view",
|
||||||
|
"type": "geomap",
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": "",
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"panel-tests"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-6h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"refresh_intervals": [
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
],
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "Panel Tests - Geomap",
|
||||||
|
"uid": "2xuwrgV7z",
|
||||||
|
"version": 5
|
||||||
|
}
|
688
pkg/schema/testdata/devenvgoldenfiles/rows-to-fields.json
vendored
Normal file
688
pkg/schema/testdata/devenvgoldenfiles/rows-to-fields.json
vendored
Normal file
@ -0,0 +1,688 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"target": {
|
||||||
|
"limit": 100,
|
||||||
|
"matchAny": false,
|
||||||
|
"tags": [],
|
||||||
|
"type": "dashboard"
|
||||||
|
},
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "left",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 5,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 8,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 2,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Raw data",
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "left",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"matcher": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "Value"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "custom.width",
|
||||||
|
"value": 82
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matcher": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "Unit"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "custom.width",
|
||||||
|
"value": 108
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 5,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 7,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false,
|
||||||
|
"sortBy": []
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 3,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Raw data",
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 5
|
||||||
|
},
|
||||||
|
"id": 2,
|
||||||
|
"options": {
|
||||||
|
"colorMode": "value",
|
||||||
|
"graphMode": "none",
|
||||||
|
"justifyMode": "auto",
|
||||||
|
"orientation": "auto",
|
||||||
|
"reduceOptions": {
|
||||||
|
"calcs": [
|
||||||
|
"lastNotNull"
|
||||||
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"text": {},
|
||||||
|
"textMode": "auto"
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name,Value,Unit,Color\nTemperature,10,degree,green\nPressure,100,bar,blue\nSpeed,30,km/h,red",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Unit and color from data",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "rowsToFields",
|
||||||
|
"options": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "stat",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"min": 0,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 5
|
||||||
|
},
|
||||||
|
"id": 3,
|
||||||
|
"options": {
|
||||||
|
"orientation": "auto",
|
||||||
|
"reduceOptions": {
|
||||||
|
"calcs": [
|
||||||
|
"lastNotNull"
|
||||||
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"showThresholdLabels": true,
|
||||||
|
"showThresholdMarkers": true,
|
||||||
|
"text": {}
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name,Value,Unit,min,max, threshold1\nTemperature,10,degree,0,50,30\nPressure,100,Pa,0,300,200\nSpeed,30,km/h,0,150,110",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Min, Max & Thresholds from data",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "rowsToFields",
|
||||||
|
"options": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "gauge",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "left",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 5,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 12
|
||||||
|
},
|
||||||
|
"id": 10,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 9,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Raw data",
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "-- Dashboard --",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"align": "left",
|
||||||
|
"displayMode": "auto"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"matcher": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "Value"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "custom.width",
|
||||||
|
"value": 82
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matcher": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "Unit"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "custom.width",
|
||||||
|
"value": 108
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 5,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 12
|
||||||
|
},
|
||||||
|
"id": 12,
|
||||||
|
"options": {
|
||||||
|
"frameIndex": 0,
|
||||||
|
"showHeader": true,
|
||||||
|
"showTypeIcons": false,
|
||||||
|
"sortBy": []
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"panelId": 11,
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Raw data (Custom mapping)",
|
||||||
|
"type": "table",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "continuous-GrYlRd"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 17
|
||||||
|
},
|
||||||
|
"id": 9,
|
||||||
|
"options": {
|
||||||
|
"displayMode": "gradient",
|
||||||
|
"orientation": "auto",
|
||||||
|
"reduceOptions": {
|
||||||
|
"calcs": [
|
||||||
|
"lastNotNull"
|
||||||
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"showUnfilled": true,
|
||||||
|
"text": {}
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name,Value,Unit,Min,Max\nTemperature,20,degree,0,50\nPressure,150,Pa,0,300\nSpeed,100,km/h,0,110",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Min max from data",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "rowsToFields",
|
||||||
|
"options": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "bargauge",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"min": 0,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 17
|
||||||
|
},
|
||||||
|
"id": 11,
|
||||||
|
"options": {
|
||||||
|
"orientation": "auto",
|
||||||
|
"reduceOptions": {
|
||||||
|
"calcs": [
|
||||||
|
"lastNotNull"
|
||||||
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"showThresholdLabels": true,
|
||||||
|
"showThresholdMarkers": true,
|
||||||
|
"text": {}
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name,Value,Type,Quota, Warning\nTemperature,25,degree,50,30\nPressure,100,Pa,300,200\nSpeed,30,km/h,150,130",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Custom mapping",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "rowsToFields",
|
||||||
|
"options": {
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"configProperty": "unit",
|
||||||
|
"fieldName": "Type",
|
||||||
|
"handlerKey": "unit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"configProperty": "max",
|
||||||
|
"fieldName": "Quota",
|
||||||
|
"handlerKey": "max"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"configProperty": "threshold1",
|
||||||
|
"fieldName": "Warning",
|
||||||
|
"handlerKey": "threshold1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "gauge",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 24
|
||||||
|
},
|
||||||
|
"id": 13,
|
||||||
|
"options": {
|
||||||
|
"colorMode": "value",
|
||||||
|
"graphMode": "none",
|
||||||
|
"justifyMode": "auto",
|
||||||
|
"orientation": "horizontal",
|
||||||
|
"reduceOptions": {
|
||||||
|
"calcs": [
|
||||||
|
"lastNotNull"
|
||||||
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"text": {},
|
||||||
|
"textMode": "auto"
|
||||||
|
},
|
||||||
|
"pluginVersion": "8.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"csvContent": "Name, City, Country, Value\nSensorA, Stockholm, Sweden, 20\nSensorB, London, England, 50\nSensorC, New York, USA,100",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_content"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Extra string fields to labels",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "rowsToFields",
|
||||||
|
"options": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "stat",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": "",
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"transform"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-6h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false,
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "Transforms - Rows to fields",
|
||||||
|
"uid": "PMtIInink",
|
||||||
|
"version": 1
|
||||||
|
}
|
486
pkg/schema/testdata/devenvgoldenfiles/timeline-demo.json
vendored
Normal file
486
pkg/schema/testdata/devenvgoldenfiles/timeline-demo.json
vendored
Normal file
@ -0,0 +1,486 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"target": {
|
||||||
|
"limit": 100,
|
||||||
|
"matchAny": false,
|
||||||
|
"tags": [],
|
||||||
|
"type": "dashboard"
|
||||||
|
},
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"CRITICAL": {
|
||||||
|
"color": "red",
|
||||||
|
"index": 3
|
||||||
|
},
|
||||||
|
"HIGH": {
|
||||||
|
"color": "orange",
|
||||||
|
"index": 2
|
||||||
|
},
|
||||||
|
"LOW": {
|
||||||
|
"color": "blue",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
"NORMAL": {
|
||||||
|
"color": "green",
|
||||||
|
"index": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "value"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 24,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 9,
|
||||||
|
"options": {
|
||||||
|
"alignValue": "center",
|
||||||
|
"colWidth": 0.9,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"mergeValues": true,
|
||||||
|
"rowHeight": 0.98,
|
||||||
|
"showValue": "always",
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pluginVersion": "7.5.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"alias": "SensorA",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "LOW,HIGH,NORMAL,NORMAL,NORMAL,LOW,LOW,NORMAL,HIGH,CRITICAL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "SensorB",
|
||||||
|
"hide": false,
|
||||||
|
"refId": "B",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "NORMAL,LOW,LOW,CRITICAL,CRITICAL,LOW,LOW,NORMAL,HIGH,CRITICAL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "SensorA",
|
||||||
|
"hide": false,
|
||||||
|
"refId": "C",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "NORMAL,NORMAL,NORMAL,NORMAL,CRITICAL,LOW,NORMAL,NORMAL,NORMAL,LOW"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "State changes strings",
|
||||||
|
"type": "state-timeline",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 70,
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"match": "true",
|
||||||
|
"result": {
|
||||||
|
"color": "semi-dark-green",
|
||||||
|
"index": 0,
|
||||||
|
"text": "ON"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "special"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"match": "false",
|
||||||
|
"result": {
|
||||||
|
"color": "red",
|
||||||
|
"index": 1,
|
||||||
|
"text": "OFF"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "special"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 13,
|
||||||
|
"x": 0,
|
||||||
|
"y": 8
|
||||||
|
},
|
||||||
|
"id": 13,
|
||||||
|
"options": {
|
||||||
|
"alignValue": "center",
|
||||||
|
"colWidth": 1,
|
||||||
|
"legend": {
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false,
|
||||||
|
"calcs": []
|
||||||
|
},
|
||||||
|
"mergeValues": true,
|
||||||
|
"mode": "changes",
|
||||||
|
"rowHeight": 0.98,
|
||||||
|
"showValue": "always",
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"alias": "",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "true,false,true,true,true,true,false,false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hide": false,
|
||||||
|
"refId": "B",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "false,true,false,true,true,false,false,false,true,true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hide": false,
|
||||||
|
"refId": "C",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "true,false,true,true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hide": false,
|
||||||
|
"refId": "D",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "false,true,false,true,true"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "State changes with boolean values",
|
||||||
|
"type": "state-timeline",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Should show gaps",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 80,
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"match": "true",
|
||||||
|
"result": {
|
||||||
|
"color": "semi-dark-green",
|
||||||
|
"index": 0,
|
||||||
|
"text": "ON"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "special"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"options": {
|
||||||
|
"match": "false",
|
||||||
|
"result": {
|
||||||
|
"color": "red",
|
||||||
|
"index": 1,
|
||||||
|
"text": "OFF"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "special"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 11,
|
||||||
|
"x": 13,
|
||||||
|
"y": 8
|
||||||
|
},
|
||||||
|
"id": 12,
|
||||||
|
"options": {
|
||||||
|
"alignValue": "center",
|
||||||
|
"colWidth": 1,
|
||||||
|
"legend": {
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false,
|
||||||
|
"calcs": []
|
||||||
|
},
|
||||||
|
"mergeValues": true,
|
||||||
|
"mode": "changes",
|
||||||
|
"rowHeight": 0.98,
|
||||||
|
"showValue": "always",
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "true,false,true,true,true,true,false,false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hide": false,
|
||||||
|
"refId": "B",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "false,true,false,true,true,false,false,false,true,true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hide": false,
|
||||||
|
"refId": "C",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "true,false,null,true,true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hide": false,
|
||||||
|
"refId": "D",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "false,null,null,false,true,true"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "State changes with nulls",
|
||||||
|
"type": "state-timeline",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "continuous-GrYlRd"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 96,
|
||||||
|
"lineWidth": 0
|
||||||
|
},
|
||||||
|
"decimals": 0,
|
||||||
|
"mappings": [],
|
||||||
|
"max": 30,
|
||||||
|
"min": -10,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "short"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 12,
|
||||||
|
"w": 24,
|
||||||
|
"x": 0,
|
||||||
|
"y": 19
|
||||||
|
},
|
||||||
|
"id": 4,
|
||||||
|
"maxDataPoints": 20,
|
||||||
|
"options": {
|
||||||
|
"alignValue": "center",
|
||||||
|
"colWidth": 0.96,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"rowHeight": 0.98,
|
||||||
|
"showValue": "always",
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pluginVersion": "7.5.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"alias": "",
|
||||||
|
"csvWave": {
|
||||||
|
"timeStep": 60,
|
||||||
|
"valuesCSV": "0,0,2,2,1,1"
|
||||||
|
},
|
||||||
|
"lines": 10,
|
||||||
|
"max": 30,
|
||||||
|
"min": -10,
|
||||||
|
"noise": 2,
|
||||||
|
"points": [],
|
||||||
|
"pulseWave": {
|
||||||
|
"offCount": 3,
|
||||||
|
"offValue": 1,
|
||||||
|
"onCount": 3,
|
||||||
|
"onValue": 2,
|
||||||
|
"timeStep": 60
|
||||||
|
},
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "random_walk",
|
||||||
|
"seriesCount": 4,
|
||||||
|
"spread": 15,
|
||||||
|
"startValue": 5,
|
||||||
|
"stream": {
|
||||||
|
"bands": 1,
|
||||||
|
"noise": 2.2,
|
||||||
|
"speed": 250,
|
||||||
|
"spread": 3.5,
|
||||||
|
"type": "signal"
|
||||||
|
},
|
||||||
|
"stringInput": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Status map",
|
||||||
|
"type": "status-history",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": false,
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"demo"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-1h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false,
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "utc",
|
||||||
|
"title": "Timeline Demo",
|
||||||
|
"uid": "mIJjFy8Kz",
|
||||||
|
"version": 3
|
||||||
|
}
|
424
pkg/schema/testdata/devenvgoldenfiles/timeline-modes.json
vendored
Normal file
424
pkg/schema/testdata/devenvgoldenfiles/timeline-modes.json
vendored
Normal file
@ -0,0 +1,424 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": "-- Grafana --",
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"target": {
|
||||||
|
"limit": 100,
|
||||||
|
"matchAny": false,
|
||||||
|
"tags": [],
|
||||||
|
"type": "dashboard"
|
||||||
|
},
|
||||||
|
"showIn": 0,
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"id": 329,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 70,
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 10,
|
||||||
|
"w": 24,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 8,
|
||||||
|
"options": {
|
||||||
|
"alignValue": "left",
|
||||||
|
"colWidth": 0.9,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"mergeValues": true,
|
||||||
|
"rowHeight": 0.9,
|
||||||
|
"showValue": "always",
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pluginVersion": "7.5.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"alias": "",
|
||||||
|
"csvWave": {
|
||||||
|
"timeStep": 60,
|
||||||
|
"valuesCSV": "0,0,2,2,1,1"
|
||||||
|
},
|
||||||
|
"lines": 10,
|
||||||
|
"points": [
|
||||||
|
[
|
||||||
|
0,
|
||||||
|
1616551651000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1,
|
||||||
|
1616556554000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
2,
|
||||||
|
1616559873000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0,
|
||||||
|
1616561077000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
3,
|
||||||
|
1616563090000
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"pulseWave": {
|
||||||
|
"offCount": 3,
|
||||||
|
"offValue": 1,
|
||||||
|
"onCount": 3,
|
||||||
|
"onValue": 2,
|
||||||
|
"timeStep": 60
|
||||||
|
},
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "manual_entry",
|
||||||
|
"stream": {
|
||||||
|
"bands": 1,
|
||||||
|
"noise": 2.2,
|
||||||
|
"speed": 250,
|
||||||
|
"spread": 3.5,
|
||||||
|
"type": "signal"
|
||||||
|
},
|
||||||
|
"stringInput": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "",
|
||||||
|
"csvWave": {
|
||||||
|
"timeStep": 60,
|
||||||
|
"valuesCSV": "0,0,2,2,1,1"
|
||||||
|
},
|
||||||
|
"hide": false,
|
||||||
|
"lines": 10,
|
||||||
|
"points": [
|
||||||
|
[
|
||||||
|
4,
|
||||||
|
1616555060000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
5,
|
||||||
|
1616560081000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
4,
|
||||||
|
1616562217000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
5,
|
||||||
|
1616565458000
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"pulseWave": {
|
||||||
|
"offCount": 3,
|
||||||
|
"offValue": 1,
|
||||||
|
"onCount": 3,
|
||||||
|
"onValue": 2,
|
||||||
|
"timeStep": 60
|
||||||
|
},
|
||||||
|
"refId": "B",
|
||||||
|
"scenarioId": "manual_entry",
|
||||||
|
"stream": {
|
||||||
|
"bands": 1,
|
||||||
|
"noise": 2.2,
|
||||||
|
"speed": 250,
|
||||||
|
"spread": 3.5,
|
||||||
|
"type": "signal"
|
||||||
|
},
|
||||||
|
"stringInput": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"points": [
|
||||||
|
[
|
||||||
|
4,
|
||||||
|
1616557148000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1616558756000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
4,
|
||||||
|
1616561658000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1616562446000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
4,
|
||||||
|
1616564104000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1616564548000
|
||||||
|
],
|
||||||
|
[
|
||||||
|
4,
|
||||||
|
1616564871000
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"refId": "C",
|
||||||
|
"scenarioId": "manual_entry"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "State timeline",
|
||||||
|
"type": "state-timeline",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 70,
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 24,
|
||||||
|
"x": 0,
|
||||||
|
"y": 10
|
||||||
|
},
|
||||||
|
"id": 9,
|
||||||
|
"options": {
|
||||||
|
"alignValue": "left",
|
||||||
|
"colWidth": 0.9,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"mergeValues": true,
|
||||||
|
"rowHeight": 0.9,
|
||||||
|
"showValue": "always",
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pluginVersion": "7.5.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"alias": "",
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "a,a,b,b,b,b,c,a,a,d,d,d,d,d"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "",
|
||||||
|
"refId": "B",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "null,null,e,e,e,null,null,e,null,null,e,null,e,e,e,e"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"refId": "C",
|
||||||
|
"scenarioId": "csv_metric_values",
|
||||||
|
"stringInput": "true,null,false,null,true,false"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "State timeline (strings & booleans)",
|
||||||
|
"type": "state-timeline",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"fillOpacity": 70,
|
||||||
|
"lineWidth": 1
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "percentage",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "#EAB839",
|
||||||
|
"value": 60
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "short"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 11,
|
||||||
|
"w": 24,
|
||||||
|
"x": 0,
|
||||||
|
"y": 21
|
||||||
|
},
|
||||||
|
"id": 4,
|
||||||
|
"maxDataPoints": 20,
|
||||||
|
"options": {
|
||||||
|
"colWidth": 0.9,
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "list",
|
||||||
|
"placement": "bottom",
|
||||||
|
"asTable": false,
|
||||||
|
"isVisible": false
|
||||||
|
},
|
||||||
|
"rowHeight": 0.9,
|
||||||
|
"showValue": "always",
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
},
|
||||||
|
"alignValue": "left"
|
||||||
|
},
|
||||||
|
"pluginVersion": "7.5.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"alias": "",
|
||||||
|
"csvWave": {
|
||||||
|
"timeStep": 60,
|
||||||
|
"valuesCSV": "0,0,2,2,1,1"
|
||||||
|
},
|
||||||
|
"lines": 10,
|
||||||
|
"points": [],
|
||||||
|
"pulseWave": {
|
||||||
|
"offCount": 3,
|
||||||
|
"offValue": 1,
|
||||||
|
"onCount": 3,
|
||||||
|
"onValue": 2,
|
||||||
|
"timeStep": 60
|
||||||
|
},
|
||||||
|
"refId": "A",
|
||||||
|
"scenarioId": "random_walk",
|
||||||
|
"seriesCount": 4,
|
||||||
|
"spread": 14.9,
|
||||||
|
"stream": {
|
||||||
|
"bands": 1,
|
||||||
|
"noise": 2.2,
|
||||||
|
"speed": 250,
|
||||||
|
"spread": 3.5,
|
||||||
|
"type": "signal"
|
||||||
|
},
|
||||||
|
"stringInput": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Status grid",
|
||||||
|
"type": "status-history",
|
||||||
|
"panelSchema": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"transparent": false,
|
||||||
|
"repeatDirection": "h",
|
||||||
|
"transformations": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": false,
|
||||||
|
"schemaVersion": 30,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"gdev",
|
||||||
|
"panel-tests"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "2021-03-24T03:00:00.000Z",
|
||||||
|
"to": "2021-03-24T07:00:00.000Z"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"collapse": false,
|
||||||
|
"enable": true,
|
||||||
|
"hidden": false,
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "utc",
|
||||||
|
"title": "Timeline Modes",
|
||||||
|
"uid": "mIJjFy8Gz",
|
||||||
|
"version": 13
|
||||||
|
}
|
@ -33,7 +33,7 @@ Verifies common usecases for trimdefault/applydefault functions:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Trimed --
|
-- Trimmed --
|
||||||
{
|
{
|
||||||
"timepicker": {
|
"timepicker": {
|
||||||
"collapse": true
|
"collapse": true
|
@ -17,19 +17,19 @@ Verifies common usecases for trimdefault/applydefault functions:
|
|||||||
|
|
||||||
-- Full --
|
-- Full --
|
||||||
{
|
{
|
||||||
"id": 42,
|
|
||||||
"uid": "emal8gQMz",
|
|
||||||
"style": "light",
|
|
||||||
"editable": true,
|
"editable": true,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"id": 42,
|
||||||
"schemaVersion": 27,
|
"schemaVersion": 27,
|
||||||
"version": 2,
|
"style": "light",
|
||||||
"graphTooltip": 0
|
"uid": "emal8gQMz",
|
||||||
|
"version": 2
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Trimed --
|
-- Trimmed --
|
||||||
{
|
{
|
||||||
"id": 42,
|
"id": 42,
|
||||||
"uid": "emal8gQMz",
|
|
||||||
"schemaVersion": 27,
|
"schemaVersion": 27,
|
||||||
|
"uid": "emal8gQMz",
|
||||||
"version": 2
|
"version": 2
|
||||||
}
|
}
|
71
pkg/schema/testdata/trimapplydefaults/disjuctList.txtar
vendored
Normal file
71
pkg/schema/testdata/trimapplydefaults/disjuctList.txtar
vendored
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
Verifies common usecases for trimdefault/applydefault functions:
|
||||||
|
* open structure should be kept when fields not present
|
||||||
|
|
||||||
|
-- CUE --
|
||||||
|
#ListA: {
|
||||||
|
datasource: "gdev-postgres"
|
||||||
|
hide: number | *0
|
||||||
|
includeAll : bool | *true
|
||||||
|
label: string | *"Datacenter"
|
||||||
|
}
|
||||||
|
#ListB: {
|
||||||
|
datasource: "gdev-mysql"
|
||||||
|
hide: number | *1
|
||||||
|
includeAll : bool | *false
|
||||||
|
label: string | *"Datacenter"
|
||||||
|
}
|
||||||
|
#ListC: {
|
||||||
|
datasource: !=""
|
||||||
|
hide: number | *2
|
||||||
|
includeAll : bool | *false
|
||||||
|
label: string | *"Awesome"
|
||||||
|
}
|
||||||
|
{
|
||||||
|
templating?: list: [...#ListA | #ListB | #ListC]
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Full --
|
||||||
|
{
|
||||||
|
"templating": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"datasource": "gdev-postgres",
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": false,
|
||||||
|
"label": "Datacenter"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "gdev-mysql",
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": false,
|
||||||
|
"label": "Datacenter"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "gdev-random",
|
||||||
|
"hide": 2,
|
||||||
|
"includeAll": false,
|
||||||
|
"label": "Datacenter"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Trimmed --
|
||||||
|
{
|
||||||
|
"templating": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"datasource": "gdev-postgres",
|
||||||
|
"includeAll": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "gdev-mysql",
|
||||||
|
"hide": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"datasource": "gdev-random",
|
||||||
|
"label": "Datacenter"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
5749
pkg/schema/testdata/trimapplydefaults/fullDashboard.txtar
vendored
Normal file
5749
pkg/schema/testdata/trimapplydefaults/fullDashboard.txtar
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -20,27 +20,27 @@ Verifies common usecases for trimdefault/applydefault functions:
|
|||||||
-- Full --
|
-- Full --
|
||||||
{
|
{
|
||||||
"annotations": {
|
"annotations": {
|
||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"builtIn": 1,
|
"builtIn": 1,
|
||||||
"datasource": "-- Grafana --",
|
"datasource": "-- Grafana --",
|
||||||
"name": "Annotations & Alerts",
|
"name": "Annotations & Alerts",
|
||||||
"type": "dashboard",
|
"showIn": 0,
|
||||||
"showIn": 0
|
"type": "dashboard"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Trimed --
|
-- Trimmed --
|
||||||
{
|
{
|
||||||
"annotations": {
|
"annotations": {
|
||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"builtIn": 1,
|
"builtIn": 1,
|
||||||
"datasource": "-- Grafana --",
|
"datasource": "-- Grafana --",
|
||||||
"name": "Annotations & Alerts"
|
"name": "Annotations & Alerts"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -39,7 +39,7 @@ Verifies common usecases for trimdefault/applydefault functions:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Trimed --
|
-- Trimmed --
|
||||||
{
|
{
|
||||||
"templating": {
|
"templating": {
|
||||||
"list": [
|
"list": [
|
@ -73,11 +73,11 @@ func (rs *SchemaLoaderService) DashboardTrimDefaults(input simplejson.Json) (sim
|
|||||||
val = removeNils(val)
|
val = removeNils(val)
|
||||||
data, _ := json.Marshal(val)
|
data, _ := json.Marshal(val)
|
||||||
|
|
||||||
dsSchema, err := schema.SearchAndValidate(rs.DashFamily, data)
|
dsSchema, err := schema.SearchAndValidate(rs.DashFamily, string(data))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return input, err
|
return input, err
|
||||||
}
|
}
|
||||||
// spew.Dump(dsSchema)
|
|
||||||
result, err := schema.TrimDefaults(schema.Resource{Value: data}, dsSchema.CUE())
|
result, err := schema.TrimDefaults(schema.Resource{Value: data}, dsSchema.CUE())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return input, err
|
return input, err
|
||||||
|
Loading…
Reference in New Issue
Block a user