Merge pull request #5423 from vvlladd28/bug/map-utils/parse-data-index

[3.3.2]UI: Fixed map-utils parse data - not correct index (timeseries without aggregation)
This commit is contained in:
Igor Kulikov 2021-10-21 17:23:12 +03:00 committed by GitHub
commit 266ab23380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -330,12 +330,12 @@ export function parseData(input: DatasourceData[], dataIndex?: number): Formatte
deviceType: null deviceType: null
}; };
entityArray.filter(el => el.data.length).forEach(el => { entityArray.filter(el => el.data.length).forEach(el => {
dataIndex = isDefined(dataIndex) ? dataIndex : el.data.length - 1; const index = isDefined(dataIndex) ? dataIndex : el.data.length - 1;
if (!obj.hasOwnProperty(el.dataKey.label) || el.data[dataIndex][1] !== '') { if (!obj.hasOwnProperty(el.dataKey.label) || el.data[index][1] !== '') {
obj[el.dataKey.label] = el.data[dataIndex][1]; obj[el.dataKey.label] = el.data[index][1];
obj[el.dataKey.label + '|ts'] = el.data[dataIndex][0]; obj[el.dataKey.label + '|ts'] = el.data[index][0];
if (el.dataKey.label.toLowerCase() === 'type') { if (el.dataKey.label.toLowerCase() === 'type') {
obj.deviceType = el.data[dataIndex][1]; obj.deviceType = el.data[index][1];
} }
} }
}); });