Skip to content

Commit

Permalink
Make strings and dates displayable
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-szypulka committed Feb 5, 2018
1 parent 21e8266 commit 961ee98
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class IPMDatasource {
var self = this;
var rangeFrom = moment(options.range.from).utc().utcOffset(self.tzOffset).format('YYYYMMDDTHHmmss');
var rangeTo = moment(options.range.to).utc().utcOffset(self.tzOffset).format('YYYYMMDDTHHmmss');

//this.alertSrv.set("date range",rangeFrom + ' -- ' + rangeTo + ' -- ' + self.tzOffset,"error");

var requests = _.map(options.targets, target => {
Expand Down Expand Up @@ -255,13 +254,21 @@ class IPMDatasource {
if (target || target == 0) {
items.forEach(function (item) {
if (item.properties[2].value == target) {
series.push([parseFloat(item.properties[0][item.valueAttribute]), moment(item.properties[1].value + tzOffset).valueOf()]);
}
if (item.properties[0].valueType == "string" || item.properties[0].valueType == "isodatetime") {
series.push([item.properties[0][item.valueAttribute], moment(item.properties[1].value + tzOffset).valueOf()]);
} else {
series.push([parseFloat(item.properties[0][item.valueAttribute]), moment(item.properties[1].value + tzOffset).valueOf()]);
}
}
});
} else {
items.forEach(function (item) {
series.push([parseFloat(item.properties[0][item.valueAttribute]), moment(item.properties[1].value + tzOffset).valueOf()]);
});
if (item.properties[0].valueType == "string" || item.properties[0].valueType == "isodatetime") {
series.push([item.properties[0][item.valueAttribute], moment(item.properties[1].value + tzOffset).valueOf()]);
} else {
series.push([parseFloat(item.properties[0][item.valueAttribute]), moment(item.properties[1].value + tzOffset).valueOf()]);
}
});
}
return series;
}
Expand Down Expand Up @@ -289,7 +296,6 @@ class IPMDatasource {
url: request.url,
params: request.params,
data: request.data,

};
var urlReplaced = request.url.search(/\/items/) >= 0;

Expand Down

0 comments on commit 961ee98

Please sign in to comment.