Skip to content

Commit 36220cb

Browse files
[ENHANCEMENT] StaticListVariable: migration: handle the "no options" case (#390)
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
1 parent b2b6c73 commit 36220cb

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

staticlistvariable/schemas/migrate/migrate.cue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,10 @@ if #var.type == "custom" || #var.type == "interval" {
3333
][0]
3434
}]
3535
}
36+
if #var.options == _|_ && #var.query != _|_ {
37+
values: [for interval in strings.Split(#var.query, ",") {
38+
strings.TrimSpace(interval)
39+
}]
40+
}
3641
}
3742
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"kind": "StaticListVariable",
3+
"spec": {
4+
"values": [
5+
"15s",
6+
"30s",
7+
"1m",
8+
"5m",
9+
"10m",
10+
"30m",
11+
"1h",
12+
"6h",
13+
"1d"
14+
]
15+
}
16+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"auto": true,
3+
"auto_count": 500,
4+
"auto_min": "1m",
5+
"current": {
6+
"text": "auto",
7+
"value": "$__auto_interval_sampling"
8+
},
9+
"name": "sampling",
10+
"query": "15s,30s,1m,5m,10m,30m,1h,6h,1d",
11+
"refresh": 2,
12+
"type": "interval"
13+
}

0 commit comments

Comments
 (0)