From a4095994f060b9c17b013f427d531380b4b76ad7 Mon Sep 17 00:00:00 2001 From: AntoineThebaud Date: Mon, 23 Mar 2026 16:14:27 +0100 Subject: [PATCH] [BUGFIX] TimeSeriesChart: Grafana migration: handle string value for fillOpacity params Signed-off-by: AntoineThebaud --- timeserieschart/schemas/migrate/migrate.cue | 12 ++++++++++-- .../migrate/tests/basic-with-logbase/input.json | 2 +- .../migrate/tests/multiple-overrides/input.json | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/timeserieschart/schemas/migrate/migrate.cue b/timeserieschart/schemas/migrate/migrate.cue index b376a3085..ef6475c78 100644 --- a/timeserieschart/schemas/migrate/migrate.cue +++ b/timeserieschart/schemas/migrate/migrate.cue @@ -161,7 +161,11 @@ spec: { visual: lineStyle: #lineStyleMapping[#lineStyle] } - #fillOpacity: *#panel.fieldConfig.defaults.custom.fillOpacity | null + #fillOpacityRaw: *#panel.fieldConfig.defaults.custom.fillOpacity | null + #fillOpacity: [ + if (#fillOpacityRaw & string) != _|_ {strconv.Atoi(#fillOpacityRaw)}, + #fillOpacityRaw, + ][0] if #fillOpacity != null { visual: areaOpacity: #fillOpacity / 100 } @@ -202,7 +206,11 @@ spec: { lineStyle: #lineStyleMapping[property.value.fill] } if property.id == "custom.fillOpacity" { - areaOpacity: property.value / 100 + #queryFillOpacity: [ + if (property.value & string) != _|_ {strconv.Atoi(property.value)}, + property.value, + ][0] + areaOpacity: #queryFillOpacity / 100 } } }, diff --git a/timeserieschart/schemas/migrate/tests/basic-with-logbase/input.json b/timeserieschart/schemas/migrate/tests/basic-with-logbase/input.json index 9cd48f7b5..905f9a44b 100644 --- a/timeserieschart/schemas/migrate/tests/basic-with-logbase/input.json +++ b/timeserieschart/schemas/migrate/tests/basic-with-logbase/input.json @@ -14,7 +14,7 @@ "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", - "fillOpacity": 10, + "fillOpacity": "10", "gradientMode": "none", "hideFrom": { "legend": false, diff --git a/timeserieschart/schemas/migrate/tests/multiple-overrides/input.json b/timeserieschart/schemas/migrate/tests/multiple-overrides/input.json index 39272974c..f66cd75c4 100644 --- a/timeserieschart/schemas/migrate/tests/multiple-overrides/input.json +++ b/timeserieschart/schemas/migrate/tests/multiple-overrides/input.json @@ -65,7 +65,7 @@ "properties": [ { "id": "custom.fillOpacity", - "value": 0 + "value": "0" }, { "id": "custom.lineWidth",