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:
parent
f3aa058886
commit
46c828c2d8
@ -170,15 +170,15 @@ func getNonFolderDashboardDoc(dash dashboard, location string) *bluge.Document {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, ref := range dash.summary.References {
|
for _, ref := range dash.summary.References {
|
||||||
if ref.Kind == entity.StandardKindDataSource {
|
if ref.Family == entity.StandardKindDataSource {
|
||||||
if ref.Type != "" {
|
if ref.Type != "" {
|
||||||
doc.AddField(bluge.NewKeywordField(documentFieldDSType, ref.Type).
|
doc.AddField(bluge.NewKeywordField(documentFieldDSType, ref.Type).
|
||||||
StoreValue().
|
StoreValue().
|
||||||
Aggregatable().
|
Aggregatable().
|
||||||
SearchTermPositions())
|
SearchTermPositions())
|
||||||
}
|
}
|
||||||
if ref.UID != "" {
|
if ref.Identifier != "" {
|
||||||
doc.AddField(bluge.NewKeywordField(documentFieldDSUID, ref.UID).
|
doc.AddField(bluge.NewKeywordField(documentFieldDSUID, ref.Identifier).
|
||||||
StoreValue().
|
StoreValue().
|
||||||
Aggregatable().
|
Aggregatable().
|
||||||
SearchTermPositions())
|
SearchTermPositions())
|
||||||
@ -194,8 +194,8 @@ func getDashboardPanelDocs(dash dashboard, location string) []*bluge.Document {
|
|||||||
|
|
||||||
var docs []*bluge.Document
|
var docs []*bluge.Document
|
||||||
for _, panel := range dash.summary.Nested {
|
for _, panel := range dash.summary.Nested {
|
||||||
if panel.Kind == "panel-row" {
|
if panel.Fields["type"] == "row" {
|
||||||
continue // for now, we are excluding rows from the search index
|
continue // skip rows
|
||||||
}
|
}
|
||||||
idx := strings.LastIndex(panel.UID, "#")
|
idx := strings.LastIndex(panel.UID, "#")
|
||||||
panelId, err := strconv.Atoi(panel.UID[idx+1:])
|
panelId, err := strconv.Atoi(panel.UID[idx+1:])
|
||||||
@ -209,7 +209,7 @@ func getDashboardPanelDocs(dash dashboard, location string) []*bluge.Document {
|
|||||||
AddField(bluge.NewKeywordField(documentFieldKind, string(entityKindPanel)).Aggregatable().StoreValue()) // likely want independent index for this
|
AddField(bluge.NewKeywordField(documentFieldKind, string(entityKindPanel)).Aggregatable().StoreValue()) // likely want independent index for this
|
||||||
|
|
||||||
for _, ref := range dash.summary.References {
|
for _, ref := range dash.summary.References {
|
||||||
switch ref.Kind {
|
switch ref.Family {
|
||||||
case entity.StandardKindDashboard:
|
case entity.StandardKindDashboard:
|
||||||
if ref.Type != "" {
|
if ref.Type != "" {
|
||||||
doc.AddField(bluge.NewKeywordField(documentFieldDSType, ref.Type).
|
doc.AddField(bluge.NewKeywordField(documentFieldDSType, ref.Type).
|
||||||
@ -217,19 +217,19 @@ func getDashboardPanelDocs(dash dashboard, location string) []*bluge.Document {
|
|||||||
Aggregatable().
|
Aggregatable().
|
||||||
SearchTermPositions())
|
SearchTermPositions())
|
||||||
}
|
}
|
||||||
if ref.UID != "" {
|
if ref.Identifier != "" {
|
||||||
doc.AddField(bluge.NewKeywordField(documentFieldDSUID, ref.UID).
|
doc.AddField(bluge.NewKeywordField(documentFieldDSUID, ref.Identifier).
|
||||||
StoreValue().
|
StoreValue().
|
||||||
Aggregatable().
|
Aggregatable().
|
||||||
SearchTermPositions())
|
SearchTermPositions())
|
||||||
}
|
}
|
||||||
case entity.ExternalEntityReferencePlugin:
|
case entity.ExternalEntityReferencePlugin:
|
||||||
if ref.Type == entity.StandardKindPanel && ref.UID != "" {
|
if ref.Type == entity.StandardKindPanel && ref.Identifier != "" {
|
||||||
doc.AddField(bluge.NewKeywordField(documentFieldPanelType, ref.UID).Aggregatable().StoreValue())
|
doc.AddField(bluge.NewKeywordField(documentFieldPanelType, ref.Identifier).Aggregatable().StoreValue())
|
||||||
}
|
}
|
||||||
case entity.ExternalEntityReferenceRuntime:
|
case entity.ExternalEntityReferenceRuntime:
|
||||||
if ref.Type == entity.ExternalEntityReferenceRuntime_Transformer && ref.UID != "" {
|
if ref.Type == entity.ExternalEntityReferenceRuntime_Transformer && ref.Identifier != "" {
|
||||||
doc.AddField(bluge.NewKeywordField(documentFieldTransformer, ref.UID).Aggregatable())
|
doc.AddField(bluge.NewKeywordField(documentFieldTransformer, ref.Identifier).Aggregatable())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ func addEntityStoreMigrations(mg *migrator.Migrator) {
|
|||||||
},
|
},
|
||||||
Indices: []*migrator.Index{
|
Indices: []*migrator.Index{
|
||||||
{Cols: []string{"tenant_id", "uid"}, Type: migrator.UniqueIndex},
|
{Cols: []string{"tenant_id", "uid"}, Type: migrator.UniqueIndex},
|
||||||
{Cols: []string{"tenant_id", "slug_path"}, Type: migrator.UniqueIndex},
|
// {Cols: []string{"tenant_id", "slug_path"}, Type: migrator.UniqueIndex},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -111,9 +111,9 @@ func addEntityStoreMigrations(mg *migrator.Migrator) {
|
|||||||
{Name: "parent_grn", Type: migrator.DB_NVarchar, Length: grnLength, Nullable: true},
|
{Name: "parent_grn", Type: migrator.DB_NVarchar, Length: grnLength, Nullable: true},
|
||||||
|
|
||||||
// Address (defined in the body, not resolved, may be invalid and change)
|
// Address (defined in the body, not resolved, may be invalid and change)
|
||||||
{Name: "kind", Type: migrator.DB_NVarchar, Length: 255, Nullable: false},
|
{Name: "family", Type: migrator.DB_NVarchar, Length: 255, Nullable: false},
|
||||||
{Name: "type", Type: migrator.DB_NVarchar, Length: 255, Nullable: true},
|
{Name: "type", Type: migrator.DB_NVarchar, Length: 255, Nullable: true},
|
||||||
{Name: "uid", Type: migrator.DB_NVarchar, Length: 1024, Nullable: true},
|
{Name: "id", Type: migrator.DB_NVarchar, Length: 1024, Nullable: true},
|
||||||
|
|
||||||
// Runtime calcs (will depend on the system state)
|
// Runtime calcs (will depend on the system state)
|
||||||
{Name: "resolved_ok", Type: migrator.DB_Bool, Nullable: false},
|
{Name: "resolved_ok", Type: migrator.DB_Bool, Nullable: false},
|
||||||
@ -123,7 +123,8 @@ func addEntityStoreMigrations(mg *migrator.Migrator) {
|
|||||||
},
|
},
|
||||||
Indices: []*migrator.Index{
|
Indices: []*migrator.Index{
|
||||||
{Cols: []string{"grn"}, Type: migrator.IndexType},
|
{Cols: []string{"grn"}, Type: migrator.IndexType},
|
||||||
{Cols: []string{"kind"}, Type: migrator.IndexType},
|
{Cols: []string{"family"}, Type: migrator.IndexType},
|
||||||
|
{Cols: []string{"type"}, Type: migrator.IndexType},
|
||||||
{Cols: []string{"resolved_to"}, Type: migrator.IndexType},
|
{Cols: []string{"resolved_to"}, Type: migrator.IndexType},
|
||||||
{Cols: []string{"parent_grn"}, Type: migrator.IndexType},
|
{Cols: []string{"parent_grn"}, Type: migrator.IndexType},
|
||||||
},
|
},
|
||||||
@ -192,7 +193,7 @@ func addEntityStoreMigrations(mg *migrator.Migrator) {
|
|||||||
// Migration cleanups: given that this is a complex setup
|
// Migration cleanups: given that this is a complex setup
|
||||||
// that requires a lot of testing before we are ready to push out of dev
|
// that requires a lot of testing before we are ready to push out of dev
|
||||||
// this script lets us easy wipe previous changes and initialize clean tables
|
// this script lets us easy wipe previous changes and initialize clean tables
|
||||||
suffix := " (v31)" // change this when we want to wipe and reset the object tables
|
suffix := " (v010)" // change this when we want to wipe and reset the object tables
|
||||||
mg.AddMigration("EntityStore init: cleanup"+suffix, migrator.NewRawSQLMigration(strings.TrimSpace(`
|
mg.AddMigration("EntityStore init: cleanup"+suffix, migrator.NewRawSQLMigration(strings.TrimSpace(`
|
||||||
DELETE FROM migration_log WHERE migration_id LIKE 'EntityStore init%';
|
DELETE FROM migration_log WHERE migration_id LIKE 'EntityStore init%';
|
||||||
`)))
|
`)))
|
||||||
|
@ -117,14 +117,19 @@ type EntitySummary struct {
|
|||||||
// This message is derived from the object body and can be used to search for references.
|
// 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.
|
// This does not represent a method to declare a reference to another object.
|
||||||
type EntityExternalReference struct {
|
type EntityExternalReference struct {
|
||||||
// datasource (instance), dashboard (instance),
|
// Category of dependency
|
||||||
Kind string `json:"kind,omitempty"`
|
// 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
|
Type string `json:"type,omitempty"` // flavor
|
||||||
|
|
||||||
// Unique ID for this object
|
// datasource > UID
|
||||||
UID string `json:"UID,omitempty"`
|
// 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
|
// 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
|
return err
|
||||||
}
|
}
|
||||||
_, err = tx.Exec(ctx, `INSERT INTO entity_ref (`+
|
_, 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) "+
|
"resolved_ok, resolved_to, resolved_warning, resolved_time) "+
|
||||||
`VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
`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,
|
resolved.OK, resolved.Key, resolved.Warning, resolved.Timestamp,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
// A reference accumulator can combine
|
// A reference accumulator can combine
|
||||||
type ReferenceAccumulator interface {
|
type ReferenceAccumulator interface {
|
||||||
// Add references as we find them
|
// 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
|
// Returns the set of distinct references in a sorted order
|
||||||
Get() []*entity.EntityExternalReference
|
Get() []*entity.EntityExternalReference
|
||||||
@ -26,14 +26,14 @@ type referenceAccumulator struct {
|
|||||||
refs map[string]*entity.EntityExternalReference
|
refs map[string]*entity.EntityExternalReference
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *referenceAccumulator) Add(kind string, sub string, uid string) {
|
func (x *referenceAccumulator) Add(family string, ttype string, id string) {
|
||||||
key := fmt.Sprintf("%s/%s/%s", kind, sub, uid)
|
key := fmt.Sprintf("%s/%s/%s", family, ttype, id)
|
||||||
_, ok := x.refs[key]
|
_, ok := x.refs[key]
|
||||||
if !ok {
|
if !ok {
|
||||||
x.refs[key] = &entity.EntityExternalReference{
|
x.refs[key] = &entity.EntityExternalReference{
|
||||||
Kind: kind,
|
Family: family,
|
||||||
Type: sub,
|
Type: ttype,
|
||||||
UID: uid,
|
Identifier: id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -36,12 +36,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -54,12 +54,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -72,24 +72,24 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -18,12 +18,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "timeseries"
|
"ID": "timeseries"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -36,22 +36,22 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "xychart"
|
"ID": "xychart"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "runtime",
|
"family": "runtime",
|
||||||
"type": "transformer",
|
"type": "transformer",
|
||||||
"UID": "organize"
|
"ID": "organize"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "runtime",
|
"family": "runtime",
|
||||||
"type": "transformer",
|
"type": "transformer",
|
||||||
"UID": "seriesToColumns"
|
"ID": "seriesToColumns"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -64,12 +64,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "debug"
|
"ID": "debug"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -82,12 +82,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "timeseries"
|
"ID": "timeseries"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -100,12 +100,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "timeseries"
|
"ID": "timeseries"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -118,12 +118,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "timeseries"
|
"ID": "timeseries"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -136,12 +136,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -154,49 +154,49 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "debug"
|
"ID": "debug"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "timeseries"
|
"ID": "timeseries"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "xychart"
|
"ID": "xychart"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "runtime",
|
"family": "runtime",
|
||||||
"type": "transformer",
|
"type": "transformer",
|
||||||
"UID": "organize"
|
"ID": "organize"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "runtime",
|
"family": "runtime",
|
||||||
"type": "transformer",
|
"type": "transformer",
|
||||||
"UID": "seriesToColumns"
|
"ID": "seriesToColumns"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -18,13 +18,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -37,13 +37,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -56,13 +56,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -75,13 +75,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -94,26 +94,26 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -18,13 +18,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -37,13 +37,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -56,13 +56,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -75,13 +75,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -93,12 +93,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "text"
|
"ID": "text"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -111,13 +111,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -129,12 +129,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "text"
|
"ID": "text"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -147,13 +147,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -166,13 +166,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -184,12 +184,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "text"
|
"ID": "text"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -202,13 +202,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -220,12 +220,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "text"
|
"ID": "text"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -238,13 +238,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -256,12 +256,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "text"
|
"ID": "text"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -274,13 +274,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -292,12 +292,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "text"
|
"ID": "text"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -310,13 +310,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -329,13 +329,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -348,13 +348,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -367,13 +367,13 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -386,34 +386,34 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "ds",
|
"family": "ds",
|
||||||
"UID": "gdev-testdata"
|
"ID": "gdev-testdata"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "text"
|
"ID": "text"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -17,12 +17,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -35,12 +35,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -53,12 +53,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -71,12 +71,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -89,12 +89,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -107,12 +107,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -125,12 +125,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -143,12 +143,12 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -161,24 +161,24 @@
|
|||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"kind": "ds"
|
"family": "ds"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "plugin",
|
"family": "plugin",
|
||||||
"type": "panel",
|
"type": "panel",
|
||||||
"UID": "graph"
|
"ID": "graph"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -37,17 +37,17 @@ func GetEntitySummaryBuilder(kind string) entity.EntitySummaryBuilder {
|
|||||||
Nested: nil, // ignore for now
|
Nested: nil, // ignore for now
|
||||||
References: []*entity.EntityExternalReference{
|
References: []*entity.EntityExternalReference{
|
||||||
{
|
{
|
||||||
Kind: "ds",
|
Family: "ds",
|
||||||
Type: "influx",
|
Type: "influx",
|
||||||
UID: "xyz",
|
Identifier: "xyz",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Kind: "panel",
|
Family: entity.StandardKindPanel,
|
||||||
Type: "heatmap",
|
Type: "heatmap",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Kind: "panel",
|
Family: entity.StandardKindPanel,
|
||||||
Type: "timeseries",
|
Type: "timeseries",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,8 @@ func summaryBuilder(ctx context.Context, uid string, body []byte) (*entity.Entit
|
|||||||
switch item.Type {
|
switch item.Type {
|
||||||
case playlist.ItemTypeDashboardByUid:
|
case playlist.ItemTypeDashboardByUid:
|
||||||
summary.References = append(summary.References, &entity.EntityExternalReference{
|
summary.References = append(summary.References, &entity.EntityExternalReference{
|
||||||
Kind: "dashboard",
|
Family: entity.StandardKindDashboard,
|
||||||
UID: item.Value,
|
Identifier: item.Value,
|
||||||
})
|
})
|
||||||
|
|
||||||
case playlist.ItemTypeDashboardByTag:
|
case playlist.ItemTypeDashboardByTag:
|
||||||
|
@ -43,8 +43,8 @@ func GetEntitySummaryBuilder() entity.EntitySummaryBuilder {
|
|||||||
|
|
||||||
if obj.HomeDashboardUID != nil && *obj.HomeDashboardUID != "" {
|
if obj.HomeDashboardUID != nil && *obj.HomeDashboardUID != "" {
|
||||||
summary.References = append(summary.References, &entity.EntityExternalReference{
|
summary.References = append(summary.References, &entity.EntityExternalReference{
|
||||||
Kind: entity.StandardKindDashboard,
|
Family: entity.StandardKindDashboard,
|
||||||
UID: *obj.HomeDashboardUID,
|
Identifier: *obj.HomeDashboardUID,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ func GetEntitySummaryBuilder() entity.EntitySummaryBuilder {
|
|||||||
"expires": obj.Expires,
|
"expires": obj.Expires,
|
||||||
},
|
},
|
||||||
References: []*entity.EntityExternalReference{
|
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")
|
return ResolutionInfo{OK: false, Timestamp: getNow()}, fmt.Errorf("ref is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ref.Kind {
|
switch ref.Family {
|
||||||
case entity.StandardKindDataSource:
|
case entity.StandardKindDataSource:
|
||||||
return r.resolveDatasource(ctx, ref)
|
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) {
|
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 == "" {
|
if err != nil || ds == nil || ds.UID == "" {
|
||||||
return ResolutionInfo{
|
return ResolutionInfo{
|
||||||
OK: false,
|
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) {
|
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 {
|
if !ok {
|
||||||
return ResolutionInfo{
|
return ResolutionInfo{
|
||||||
OK: false,
|
OK: false,
|
||||||
|
@ -58,8 +58,8 @@ func TestResolver(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "Missing datasource without type",
|
name: "Missing datasource without type",
|
||||||
given: &entity.EntityExternalReference{
|
given: &entity.EntityExternalReference{
|
||||||
Kind: entity.StandardKindDataSource,
|
Family: entity.StandardKindDataSource,
|
||||||
UID: "xyz",
|
Identifier: "xyz",
|
||||||
},
|
},
|
||||||
expect: ResolutionInfo{OK: false},
|
expect: ResolutionInfo{OK: false},
|
||||||
ctx: ctxOrg1,
|
ctx: ctxOrg1,
|
||||||
@ -67,9 +67,9 @@ func TestResolver(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "OK datasource",
|
name: "OK datasource",
|
||||||
given: &entity.EntityExternalReference{
|
given: &entity.EntityExternalReference{
|
||||||
Kind: entity.StandardKindDataSource,
|
Family: entity.StandardKindDataSource,
|
||||||
Type: "influx",
|
Type: "influx",
|
||||||
UID: "influx-uid",
|
Identifier: "influx-uid",
|
||||||
},
|
},
|
||||||
expect: ResolutionInfo{OK: true, Key: "influx-uid"},
|
expect: ResolutionInfo{OK: true, Key: "influx-uid"},
|
||||||
ctx: ctxOrg1,
|
ctx: ctxOrg1,
|
||||||
@ -77,7 +77,7 @@ func TestResolver(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "Get the default datasource",
|
name: "Get the default datasource",
|
||||||
given: &entity.EntityExternalReference{
|
given: &entity.EntityExternalReference{
|
||||||
Kind: entity.StandardKindDataSource,
|
Family: entity.StandardKindDataSource,
|
||||||
},
|
},
|
||||||
expect: ResolutionInfo{
|
expect: ResolutionInfo{
|
||||||
OK: true,
|
OK: true,
|
||||||
@ -89,8 +89,8 @@ func TestResolver(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "Get the default datasource (with type)",
|
name: "Get the default datasource (with type)",
|
||||||
given: &entity.EntityExternalReference{
|
given: &entity.EntityExternalReference{
|
||||||
Kind: entity.StandardKindDataSource,
|
Family: entity.StandardKindDataSource,
|
||||||
Type: "influx",
|
Type: "influx",
|
||||||
},
|
},
|
||||||
expect: ResolutionInfo{
|
expect: ResolutionInfo{
|
||||||
OK: true,
|
OK: true,
|
||||||
@ -101,8 +101,8 @@ func TestResolver(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "Lookup by name",
|
name: "Lookup by name",
|
||||||
given: &entity.EntityExternalReference{
|
given: &entity.EntityExternalReference{
|
||||||
Kind: entity.StandardKindDataSource,
|
Family: entity.StandardKindDataSource,
|
||||||
UID: "Influx2",
|
Identifier: "Influx2",
|
||||||
},
|
},
|
||||||
expect: ResolutionInfo{
|
expect: ResolutionInfo{
|
||||||
OK: true,
|
OK: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user