AlertingNG/SSE: Datasource UID and UID/ID only (drop name) (#33039)

SSE still will support ID until dashboard/frontend always requests UID
update *.http examples

Co-authored-by: gotjosh <josue@grafana.com>
This commit is contained in:
Kyle Brandt
2021-04-16 15:29:19 +02:00
committed by GitHub
co-authored by gotjosh
parent 5d1ec39224
commit 2c862678ab
11 changed files with 40 additions and 71 deletions
+13 -1
View File
@@ -30,7 +30,7 @@ type rawNode struct {
func (rn *rawNode) GetDatasourceName() (string, error) {
rawDs, ok := rn.Query["datasource"]
if !ok {
return "", fmt.Errorf("no datasource in query for refId %v", rn.RefID)
return "", nil
}
dsName, ok := rawDs.(string)
if !ok {
@@ -39,6 +39,18 @@ func (rn *rawNode) GetDatasourceName() (string, error) {
return dsName, nil
}
func (rn *rawNode) GetDatasourceUid() (string, error) {
rawDs, ok := rn.Query["datasourceUid"]
if !ok {
return "", nil
}
dsUID, ok := rawDs.(string)
if !ok {
return "", fmt.Errorf("expected datasource identifier to be a string, got %T", rawDs)
}
return dsUID, nil
}
func (rn *rawNode) GetCommandType() (c CommandType, err error) {
rawType, ok := rn.Query["type"]
if !ok {