SSE: Add functions that determine NodeType by UID and construct a data source struct from NodeType (#70106)
* add NodeTypeFromDatasourceUID and DataSourceModelFromNodeType() * deprecate expr.DataSourceModel * replace usages of IsDataSource to NodeTypeFromDatasourceUID * replace usages of DataSourceModel to DataSourceModelFromNodeType()
This commit is contained in:
@@ -62,7 +62,7 @@ func TestService(t *testing.T) {
|
||||
},
|
||||
{
|
||||
RefID: "B",
|
||||
DataSource: DataSourceModel(),
|
||||
DataSource: dataSourceModel(),
|
||||
JSON: json.RawMessage(`{ "datasource": { "uid": "__expr__", "type": "__expr__"}, "type": "math", "expression": "$A * 2" }`),
|
||||
},
|
||||
}
|
||||
@@ -124,3 +124,8 @@ func (me *mockEndpoint) QueryData(ctx context.Context, req *backend.QueryDataReq
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func dataSourceModel() *datasources.DataSource {
|
||||
d, _ := DataSourceModelFromNodeType(TypeCMDNode)
|
||||
return d
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user