From 4cdb037177564c5393b9566096c2536bb5eeabed Mon Sep 17 00:00:00 2001 From: Boris Krivonog Date: Thu, 20 Oct 2022 21:01:24 +0200 Subject: [PATCH] Fix parsing arrays - cache being overwritten. Remove redundant array evaluate. (#1531) Signed-off-by: Boris Krivonog --- .../widgets/chart/series/oh-data-series.js | 18 +----------------- .../web/src/components/widgets/widget-mixin.js | 2 +- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/chart/series/oh-data-series.js b/bundles/org.openhab.ui/web/src/components/widgets/chart/series/oh-data-series.js index e5bb9616f..bed908f58 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/chart/series/oh-data-series.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/chart/series/oh-data-series.js @@ -8,22 +8,6 @@ export default { if (!component.config || typeof component.config !== 'object') return {} const dataSeriesId = ComponentId.get(component) - let series = chart.evaluateExpression(dataSeriesId, component.config) - - if (series.data && Array.isArray(series.data)) { - series.data = series.data.map((v, index) => { - const item = chart.evaluateExpression(dataSeriesId + 'data.' + index, v) - return Number.isNaN(item.value) ? {} : item - }) - } - - if (series.axisLine && series.axisLine.lineStyle && series.axisLine.lineStyle.color && Array.isArray(series.axisLine.lineStyle.color)) { - series.axisLine.lineStyle.color = series.axisLine.lineStyle.color.map((v, index) => { - if (!Array.isArray(v)) return v - return v.map((s, subindex) => chart.evaluateExpression(dataSeriesId + 'axisLine.lineStyle.color.' + index + '.' + subindex, s)) - }) - } - - return series + return chart.evaluateExpression(dataSeriesId, component.config) } } diff --git a/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js b/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js index fa50ca521..5de96f7c1 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js @@ -155,7 +155,7 @@ export default { } else if (typeof value === 'object' && Array.isArray(value)) { const evalArr = [] for (let i = 0; i < value.length; i++) { - this.$set(evalArr, i, this.evaluateExpression(i, value[i])) + this.$set(evalArr, i, this.evaluateExpression(key + '.' + i, value[i])) } return evalArr } else {