mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
EntityAPI: Rename references from kind to family (#62044)
This commit is contained in:
@@ -117,14 +117,19 @@ type EntitySummary struct {
|
||||
// This message is derived from the object body and can be used to search for references.
|
||||
// This does not represent a method to declare a reference to another object.
|
||||
type EntityExternalReference struct {
|
||||
// datasource (instance), dashboard (instance),
|
||||
Kind string `json:"kind,omitempty"`
|
||||
// Category of dependency
|
||||
// eg: datasource, plugin, runtime
|
||||
Family string `json:"family,omitempty"`
|
||||
|
||||
// prometheus / heatmap, heatamp|prometheus
|
||||
// datasource > prometheus|influx|...
|
||||
// plugin > panel | datasource
|
||||
// runtime > transformer
|
||||
Type string `json:"type,omitempty"` // flavor
|
||||
|
||||
// Unique ID for this object
|
||||
UID string `json:"UID,omitempty"`
|
||||
// datasource > UID
|
||||
// plugin > plugin identifier
|
||||
// runtime > name lookup
|
||||
Identifier string `json:"ID,omitempty"`
|
||||
}
|
||||
|
||||
// EntitySummaryBuilder will read an object, validate it, and return a summary, sanitized payload, or an error
|
||||
|
||||
@@ -532,10 +532,10 @@ func (s *sqlEntityServer) writeSearchInfo(
|
||||
return err
|
||||
}
|
||||
_, err = tx.Exec(ctx, `INSERT INTO entity_ref (`+
|
||||
"grn, parent_grn, kind, type, uid, "+
|
||||
"grn, parent_grn, family, type, id, "+
|
||||
"resolved_ok, resolved_to, resolved_warning, resolved_time) "+
|
||||
`VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
grn, parent_grn, ref.Kind, ref.Type, ref.UID,
|
||||
grn, parent_grn, ref.Family, ref.Type, ref.Identifier,
|
||||
resolved.OK, resolved.Key, resolved.Warning, resolved.Timestamp,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
// A reference accumulator can combine
|
||||
type ReferenceAccumulator interface {
|
||||
// Add references as we find them
|
||||
Add(kind string, subtype string, uid string)
|
||||
Add(family string, ttype string, id string)
|
||||
|
||||
// Returns the set of distinct references in a sorted order
|
||||
Get() []*entity.EntityExternalReference
|
||||
@@ -26,14 +26,14 @@ type referenceAccumulator struct {
|
||||
refs map[string]*entity.EntityExternalReference
|
||||
}
|
||||
|
||||
func (x *referenceAccumulator) Add(kind string, sub string, uid string) {
|
||||
key := fmt.Sprintf("%s/%s/%s", kind, sub, uid)
|
||||
func (x *referenceAccumulator) Add(family string, ttype string, id string) {
|
||||
key := fmt.Sprintf("%s/%s/%s", family, ttype, id)
|
||||
_, ok := x.refs[key]
|
||||
if !ok {
|
||||
x.refs[key] = &entity.EntityExternalReference{
|
||||
Kind: kind,
|
||||
Type: sub,
|
||||
UID: uid,
|
||||
Family: family,
|
||||
Type: ttype,
|
||||
Identifier: id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -36,12 +36,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -54,12 +54,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -72,24 +72,24 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -18,12 +18,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "timeseries"
|
||||
"ID": "timeseries"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -36,22 +36,22 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "xychart"
|
||||
"ID": "xychart"
|
||||
},
|
||||
{
|
||||
"kind": "runtime",
|
||||
"family": "runtime",
|
||||
"type": "transformer",
|
||||
"UID": "organize"
|
||||
"ID": "organize"
|
||||
},
|
||||
{
|
||||
"kind": "runtime",
|
||||
"family": "runtime",
|
||||
"type": "transformer",
|
||||
"UID": "seriesToColumns"
|
||||
"ID": "seriesToColumns"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -64,12 +64,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "debug"
|
||||
"ID": "debug"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -82,12 +82,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "timeseries"
|
||||
"ID": "timeseries"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -100,12 +100,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "timeseries"
|
||||
"ID": "timeseries"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -118,12 +118,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "timeseries"
|
||||
"ID": "timeseries"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -136,12 +136,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -154,49 +154,49 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "debug"
|
||||
"ID": "debug"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "timeseries"
|
||||
"ID": "timeseries"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "xychart"
|
||||
"ID": "xychart"
|
||||
},
|
||||
{
|
||||
"kind": "runtime",
|
||||
"family": "runtime",
|
||||
"type": "transformer",
|
||||
"UID": "organize"
|
||||
"ID": "organize"
|
||||
},
|
||||
{
|
||||
"kind": "runtime",
|
||||
"family": "runtime",
|
||||
"type": "transformer",
|
||||
"UID": "seriesToColumns"
|
||||
"ID": "seriesToColumns"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -18,13 +18,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -37,13 +37,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -56,13 +56,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -75,13 +75,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -94,26 +94,26 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -18,13 +18,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -37,13 +37,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -56,13 +56,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -75,13 +75,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -93,12 +93,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "text"
|
||||
"ID": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -111,13 +111,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -129,12 +129,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "text"
|
||||
"ID": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -147,13 +147,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -166,13 +166,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -184,12 +184,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "text"
|
||||
"ID": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -202,13 +202,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -220,12 +220,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "text"
|
||||
"ID": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -238,13 +238,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -256,12 +256,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "text"
|
||||
"ID": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -274,13 +274,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -292,12 +292,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "text"
|
||||
"ID": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -310,13 +310,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -329,13 +329,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -348,13 +348,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -367,13 +367,13 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -386,34 +386,34 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "ds",
|
||||
"UID": "gdev-testdata"
|
||||
"family": "ds",
|
||||
"ID": "gdev-testdata"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "text"
|
||||
"ID": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -17,12 +17,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -35,12 +35,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -53,12 +53,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -71,12 +71,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -89,12 +89,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -107,12 +107,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -125,12 +125,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -143,12 +143,12 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -161,24 +161,24 @@
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"kind": "ds"
|
||||
"family": "ds"
|
||||
},
|
||||
{
|
||||
"kind": "plugin",
|
||||
"family": "plugin",
|
||||
"type": "panel",
|
||||
"UID": "graph"
|
||||
"ID": "graph"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -37,17 +37,17 @@ func GetEntitySummaryBuilder(kind string) entity.EntitySummaryBuilder {
|
||||
Nested: nil, // ignore for now
|
||||
References: []*entity.EntityExternalReference{
|
||||
{
|
||||
Kind: "ds",
|
||||
Type: "influx",
|
||||
UID: "xyz",
|
||||
Family: "ds",
|
||||
Type: "influx",
|
||||
Identifier: "xyz",
|
||||
},
|
||||
{
|
||||
Kind: "panel",
|
||||
Type: "heatmap",
|
||||
Family: entity.StandardKindPanel,
|
||||
Type: "heatmap",
|
||||
},
|
||||
{
|
||||
Kind: "panel",
|
||||
Type: "timeseries",
|
||||
Family: entity.StandardKindPanel,
|
||||
Type: "timeseries",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ func summaryBuilder(ctx context.Context, uid string, body []byte) (*entity.Entit
|
||||
switch item.Type {
|
||||
case playlist.ItemTypeDashboardByUid:
|
||||
summary.References = append(summary.References, &entity.EntityExternalReference{
|
||||
Kind: "dashboard",
|
||||
UID: item.Value,
|
||||
Family: entity.StandardKindDashboard,
|
||||
Identifier: item.Value,
|
||||
})
|
||||
|
||||
case playlist.ItemTypeDashboardByTag:
|
||||
|
||||
@@ -43,8 +43,8 @@ func GetEntitySummaryBuilder() entity.EntitySummaryBuilder {
|
||||
|
||||
if obj.HomeDashboardUID != nil && *obj.HomeDashboardUID != "" {
|
||||
summary.References = append(summary.References, &entity.EntityExternalReference{
|
||||
Kind: entity.StandardKindDashboard,
|
||||
UID: *obj.HomeDashboardUID,
|
||||
Family: entity.StandardKindDashboard,
|
||||
Identifier: *obj.HomeDashboardUID,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ func GetEntitySummaryBuilder() entity.EntitySummaryBuilder {
|
||||
"expires": obj.Expires,
|
||||
},
|
||||
References: []*entity.EntityExternalReference{
|
||||
{Kind: entity.StandardKindDashboard, UID: obj.DashboardUID},
|
||||
{Family: entity.StandardKindDashboard, Identifier: obj.DashboardUID},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ func (r *standardReferenceResolver) Resolve(ctx context.Context, ref *entity.Ent
|
||||
return ResolutionInfo{OK: false, Timestamp: getNow()}, fmt.Errorf("ref is nil")
|
||||
}
|
||||
|
||||
switch ref.Kind {
|
||||
switch ref.Family {
|
||||
case entity.StandardKindDataSource:
|
||||
return r.resolveDatasource(ctx, ref)
|
||||
|
||||
@@ -74,7 +74,7 @@ func (r *standardReferenceResolver) Resolve(ctx context.Context, ref *entity.Ent
|
||||
}
|
||||
|
||||
func (r *standardReferenceResolver) resolveDatasource(ctx context.Context, ref *entity.EntityExternalReference) (ResolutionInfo, error) {
|
||||
ds, err := r.ds.getDS(ctx, ref.UID)
|
||||
ds, err := r.ds.getDS(ctx, ref.Identifier)
|
||||
if err != nil || ds == nil || ds.UID == "" {
|
||||
return ResolutionInfo{
|
||||
OK: false,
|
||||
@@ -100,7 +100,7 @@ func (r *standardReferenceResolver) resolveDatasource(ctx context.Context, ref *
|
||||
}
|
||||
|
||||
func (r *standardReferenceResolver) resolvePlugin(ctx context.Context, ref *entity.EntityExternalReference) (ResolutionInfo, error) {
|
||||
p, ok := r.pluginStore.Plugin(ctx, ref.UID)
|
||||
p, ok := r.pluginStore.Plugin(ctx, ref.Identifier)
|
||||
if !ok {
|
||||
return ResolutionInfo{
|
||||
OK: false,
|
||||
|
||||
@@ -58,8 +58,8 @@ func TestResolver(t *testing.T) {
|
||||
{
|
||||
name: "Missing datasource without type",
|
||||
given: &entity.EntityExternalReference{
|
||||
Kind: entity.StandardKindDataSource,
|
||||
UID: "xyz",
|
||||
Family: entity.StandardKindDataSource,
|
||||
Identifier: "xyz",
|
||||
},
|
||||
expect: ResolutionInfo{OK: false},
|
||||
ctx: ctxOrg1,
|
||||
@@ -67,9 +67,9 @@ func TestResolver(t *testing.T) {
|
||||
{
|
||||
name: "OK datasource",
|
||||
given: &entity.EntityExternalReference{
|
||||
Kind: entity.StandardKindDataSource,
|
||||
Type: "influx",
|
||||
UID: "influx-uid",
|
||||
Family: entity.StandardKindDataSource,
|
||||
Type: "influx",
|
||||
Identifier: "influx-uid",
|
||||
},
|
||||
expect: ResolutionInfo{OK: true, Key: "influx-uid"},
|
||||
ctx: ctxOrg1,
|
||||
@@ -77,7 +77,7 @@ func TestResolver(t *testing.T) {
|
||||
{
|
||||
name: "Get the default datasource",
|
||||
given: &entity.EntityExternalReference{
|
||||
Kind: entity.StandardKindDataSource,
|
||||
Family: entity.StandardKindDataSource,
|
||||
},
|
||||
expect: ResolutionInfo{
|
||||
OK: true,
|
||||
@@ -89,8 +89,8 @@ func TestResolver(t *testing.T) {
|
||||
{
|
||||
name: "Get the default datasource (with type)",
|
||||
given: &entity.EntityExternalReference{
|
||||
Kind: entity.StandardKindDataSource,
|
||||
Type: "influx",
|
||||
Family: entity.StandardKindDataSource,
|
||||
Type: "influx",
|
||||
},
|
||||
expect: ResolutionInfo{
|
||||
OK: true,
|
||||
@@ -101,8 +101,8 @@ func TestResolver(t *testing.T) {
|
||||
{
|
||||
name: "Lookup by name",
|
||||
given: &entity.EntityExternalReference{
|
||||
Kind: entity.StandardKindDataSource,
|
||||
UID: "Influx2",
|
||||
Family: entity.StandardKindDataSource,
|
||||
Identifier: "Influx2",
|
||||
},
|
||||
expect: ResolutionInfo{
|
||||
OK: true,
|
||||
|
||||
Reference in New Issue
Block a user