Skip to content

Commit 447a31e

Browse files
author
dashuser1
committed
minor bug in Historical Data Stream for parameter array
1 parent 9212abb commit 447a31e

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

plugins/eginnovations/v1/readDataSource/getHistoricalData.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ export async function getHistoricalData(context) {
1313
rejectUnauthorized: false
1414
});
1515
if (context.dataSourceConfig.descriptor != 'Not Applicable') {
16-
info = context.dataSourceConfig.descriptor;
16+
if (Array.isArray(context.dataSourceConfig.descriptor)) {
17+
info =
18+
context.dataSourceConfig.descriptor.length > 0
19+
? context.dataSourceConfig.descriptor.join(',') // or [0]
20+
: '';
21+
} else {
22+
info = context.dataSourceConfig.descriptor;
23+
}
1724
} else {
1825
info = '';
1926
}
@@ -23,9 +30,9 @@ export async function getHistoricalData(context) {
2330
timeline: context.dataSourceConfig.timeline, //'1 hour',
2431
componentName: context.dataSourceConfig.componentName, //'172.16.8.112:7077',
2532
componentType: context.dataSourceConfig.componentType, //'eG Manager',
26-
test: context.dataSourceConfig.test,
27-
info: info, //'Network',
28-
measure: context.dataSourceConfig.measure, //'Packet Loss',
33+
test: context.dataSourceConfig.test, //'HTTP',
34+
info: info, //'HomePage',
35+
measure: context.dataSourceConfig.measure, //'web availability',
2936
from: 'squaredup'
3037
};
3138
context.log.info(JSON.stringify(body));
@@ -59,7 +66,7 @@ export async function getHistoricalData(context) {
5966
}
6067

6168
let data = await response.json();
62-
69+
6370
return data.data;
6471
} catch (error) {
6572
// Catch and log any errors

0 commit comments

Comments
 (0)