Skip to content

Commit a344a55

Browse files
authored
[ENHANCEMENT]: TimeSeriesChart Schema fix + additional tests (#380)
* [ENHANCEMENT]: Improve min/max validation in time-series chart schema Signed-off-by: Akshay Iyyadurai Balasundaram <akshay.iyyadurai.balasundaram@sap.com> * review comment changes Signed-off-by: Akshay Iyyadurai Balasundaram <akshay.iyyadurai.balasundaram@sap.com> --------- Signed-off-by: Akshay Iyyadurai Balasundaram <akshay.iyyadurai.balasundaram@sap.com>
1 parent 9704650 commit a344a55

3 files changed

Lines changed: 123 additions & 1 deletion

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"kind": "TimeSeriesChart",
3+
"spec": {
4+
"legend": {
5+
"mode": "list",
6+
"position": "bottom",
7+
"values": []
8+
},
9+
"visual": {
10+
"areaOpacity": 0.1,
11+
"connectNulls": false,
12+
"display": "line",
13+
"lineWidth": 1
14+
},
15+
"yAxis": {
16+
"format": {
17+
"unit": "decimal"
18+
},
19+
"max": 1
20+
}
21+
}
22+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"id": 14,
3+
"type": "timeseries",
4+
"title": "APIC endpoint accessibility",
5+
"gridPos": {
6+
"x": 0,
7+
"y": 0,
8+
"h": 8,
9+
"w": 11
10+
},
11+
"fieldConfig": {
12+
"defaults": {
13+
"custom": {
14+
"drawStyle": "line",
15+
"lineInterpolation": "linear",
16+
"barAlignment": 0,
17+
"barWidthFactor": 0.6,
18+
"lineWidth": 1,
19+
"fillOpacity": 10,
20+
"gradientMode": "none",
21+
"spanNulls": false,
22+
"insertNulls": false,
23+
"showPoints": "never",
24+
"pointSize": 5,
25+
"stacking": {
26+
"mode": "none",
27+
"group": "A"
28+
},
29+
"axisPlacement": "auto",
30+
"axisLabel": "",
31+
"axisColorMode": "text",
32+
"axisBorderShow": false,
33+
"scaleDistribution": {
34+
"type": "linear"
35+
},
36+
"axisCenteredZero": false,
37+
"hideFrom": {
38+
"tooltip": false,
39+
"viz": false,
40+
"legend": false
41+
},
42+
"thresholdsStyle": {
43+
"mode": "off"
44+
}
45+
},
46+
"color": {
47+
"mode": "palette-classic"
48+
},
49+
"mappings": [],
50+
"thresholds": {
51+
"mode": "absolute",
52+
"steps": [
53+
{
54+
"value": null,
55+
"color": "green"
56+
},
57+
{
58+
"value": 80,
59+
"color": "red"
60+
}
61+
]
62+
},
63+
"unit": "short",
64+
"max": 1
65+
},
66+
"overrides": []
67+
},
68+
"pluginVersion": "12.1.1",
69+
"targets": [
70+
{
71+
"expr": "network_apic_accessible",
72+
"interval": "",
73+
"legendFormat": "{{ apicHost }}",
74+
"refId": "A",
75+
"datasource": {
76+
"uid": "prometheus-infra-collector"
77+
}
78+
}
79+
],
80+
"datasource": {
81+
"uid": "prometheus-infra-collector"
82+
},
83+
"options": {
84+
"tooltip": {
85+
"mode": "multi",
86+
"sort": "none",
87+
"hideZeros": false
88+
},
89+
"legend": {
90+
"showLegend": true,
91+
"displayMode": "list",
92+
"placement": "bottom",
93+
"calcs": []
94+
},
95+
"dataLinks": []
96+
}
97+
}

timeserieschart/schemas/time-series.cue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ spec: close({
5252
label?: string
5353
format?: common.#format
5454
min?: number
55-
max?: number & >= min
55+
max?: number
56+
if min != _|_ && max != _|_ {
57+
max: >=min
58+
}
5659
}
5760

5861
#querySettings: [...{

0 commit comments

Comments
 (0)