Expressions: Fixes the issue showing expressions editor (#62510)

* Use suggested value for uid

* update the snapshot

* use __expr__

* replace all -100 with __expr__

* update snapshot

* more changes

* revert redundant change

* Use expr.DatasourceUID where it's possible

* generate files
This commit is contained in:
ismail simsek
2023-01-31 18:50:10 +01:00
committed by GitHub
parent fdb1a47ca2
commit 91221bc436
54 changed files with 259 additions and 242 deletions

View File

@@ -719,13 +719,13 @@ func withQueryForState(t *testing.T, evalResult eval.State) models.AlertRuleMuta
switch evalResult {
case eval.Normal:
expression = `{
"datasourceUid": "-100",
"datasourceUid": "__expr__",
"type":"math",
"expression":"2 + 1 < 1"
}`
case eval.Pending, eval.Alerting:
expression = `{
"datasourceUid": "-100",
"datasourceUid": "__expr__",
"type":"math",
"expression":"2 + 2 > 1"
}`
@@ -734,7 +734,7 @@ func withQueryForState(t *testing.T, evalResult eval.State) models.AlertRuleMuta
}
case eval.Error:
expression = `{
"datasourceUid": "-100",
"datasourceUid": "__expr__",
"type":"math",
"expression":"$A"
}`
@@ -746,7 +746,7 @@ func withQueryForState(t *testing.T, evalResult eval.State) models.AlertRuleMuta
rule.Condition = "A"
rule.Data = []models.AlertQuery{
{
DatasourceUID: "-100",
DatasourceUID: expr.DatasourceUID,
Model: json.RawMessage(expression),
RelativeTimeRange: models.RelativeTimeRange{
From: models.Duration(5 * time.Hour),