Skip to content

Commit 80d7feb

Browse files
[ENHANCEMENT] TimeSeriesChart: support migration of unit overrides (#616)
* [ENHANCEMENT] TimeSeriesChart: support migration of unit overrides Signed-off-by: AntoineThebaud <antoine.thebaud@yahoo.fr> * cover fallback behavior (no format appended) Signed-off-by: AntoineThebaud <antoine.thebaud@yahoo.fr> --------- Signed-off-by: AntoineThebaud <antoine.thebaud@yahoo.fr>
1 parent 690da24 commit 80d7feb

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

timeserieschart/schemas/migrate/migrate.cue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ spec: {
212212
][0]
213213
areaOpacity: #queryFillOpacity / 100
214214
}
215+
if property.id == "unit" {
216+
#queryUnit: *commonMigrate.#mapping.unit[property.value] | null
217+
if #queryUnit != null {
218+
format: unit: #queryUnit
219+
}
220+
}
215221
}
216222
},
217223
]

timeserieschart/schemas/migrate/tests/multiple-overrides/expected.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
"queryIndex": 4,
4747
"colorMode": "fixed",
4848
"colorValue": "#fade2a",
49-
"lineStyle": "dashed"
49+
"lineStyle": "dashed",
50+
"format": {
51+
"unit": "requests/sec"
52+
}
5053
}
5154
]
5255
}

timeserieschart/schemas/migrate/tests/multiple-overrides/input.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
},
129129
{
130130
"id": "unit",
131-
"value": "tps"
131+
"value": "reqps"
132132
},
133133
{
134134
"id": "custom.lineStyle",

0 commit comments

Comments
 (0)