From 7ba4fbf165a5416088ad85ca84d85ff4a1d9a280 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 21 Oct 2021 17:20:49 +0300 Subject: [PATCH] UI: Fixed map-utils parse data - not correct index (timeseries without aggregation) --- .../components/widget/lib/maps/common-maps-utils.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts index 6d10e154b0..9f1810f82f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts @@ -330,12 +330,12 @@ export function parseData(input: DatasourceData[], dataIndex?: number): Formatte deviceType: null }; entityArray.filter(el => el.data.length).forEach(el => { - dataIndex = isDefined(dataIndex) ? dataIndex : el.data.length - 1; - if (!obj.hasOwnProperty(el.dataKey.label) || el.data[dataIndex][1] !== '') { - obj[el.dataKey.label] = el.data[dataIndex][1]; - obj[el.dataKey.label + '|ts'] = el.data[dataIndex][0]; + const index = isDefined(dataIndex) ? dataIndex : el.data.length - 1; + if (!obj.hasOwnProperty(el.dataKey.label) || el.data[index][1] !== '') { + obj[el.dataKey.label] = el.data[index][1]; + obj[el.dataKey.label + '|ts'] = el.data[index][0]; if (el.dataKey.label.toLowerCase() === 'type') { - obj.deviceType = el.data[dataIndex][1]; + obj.deviceType = el.data[index][1]; } } });