Merge pull request #3218 from vvlladd28/bug/road-map

[3.0] Change get index date for map widget
This commit is contained in:
Igor Kulikov 2020-08-03 15:49:27 +03:00 committed by GitHub
commit 02bfc07182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -249,10 +249,11 @@ export function parseData(input: DatasourceData[]): FormattedData[] {
deviceType: null deviceType: null
}; };
entityArray.filter(el => el.data.length).forEach(el => { entityArray.filter(el => el.data.length).forEach(el => {
obj[el?.dataKey?.label] = el?.data[0][0] ? el?.data[0][1] : null; const indexDate = el?.data?.length ? el.data.length - 1 : 0;
obj[el?.dataKey?.label + '|ts'] = el?.data[0][0] || null; obj[el?.dataKey?.label] = el?.data[indexDate][0] ? el?.data[indexDate][1] : null;
obj[el?.dataKey?.label + '|ts'] = el?.data[indexDate][0] || null;
if (el?.dataKey?.label === 'type') { if (el?.dataKey?.label === 'type') {
obj.deviceType = el?.data[0][1]; obj.deviceType = el?.data[indexDate][1];
} }
}); });
return obj; return obj;