Commit 1e7ced2a by Torkel Ödegaard

fix for template targets

parent cef4349b
...@@ -81,23 +81,21 @@ function (angular, _, config, graphiteFuncs, Parser) { ...@@ -81,23 +81,21 @@ function (angular, _, config, graphiteFuncs, Parser) {
} }
$scope.segments = _.map(astNode.segments, function(segment) { $scope.segments = _.map(astNode.segments, function(segment) {
return { var node = {
type: segment.type, type: segment.type,
val: segment.value, val: segment.value,
html: getSegmentHtml(segment) html: segment.value
}; };
});
}
}
function getSegmentHtml(segment) {
if (segment.value === '*') { if (segment.value === '*') {
return '<i class="icon-asterisk"><i>'; node.html = '<i class="icon-asterisk"><i>';
} }
if (segment.type === 'template') { if (segment.type === 'template') {
return "<span style='color: #ECEC09'>[[" + segment.value + "]]</span>"; node.val = node.html = '[[' + segment.value + ']]';
node.html = "<span style='color: #ECEC09'>" + node.html + "</span>";
}
return node;
});
} }
return segment.value;
} }
function getSegmentPathUpTo(index) { function getSegmentPathUpTo(index) {
......
...@@ -332,7 +332,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -332,7 +332,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
var data = []; var data = [];
if(results.length === 0 ) { if(results.length === 0 ) {
throw { message: 'no data in response from graphite' }; return [];
} }
var tsOpts = { var tsOpts = {
...@@ -662,10 +662,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -662,10 +662,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
}); });
} }
/* var totalDataPoints = _.reduce(data, function(num, series) { return series.data.length + num; }, 0);
console.log('Datapoints[0] count:', data[0].data.length);
console.log('Datapoints.Total count:', totalDataPoints);*/
plot = $.plot(elem, data, options); plot = $.plot(elem, data, options);
if (scope.panel.leftYAxisLabel) { if (scope.panel.leftYAxisLabel) {
...@@ -678,7 +674,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -678,7 +674,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
} else if (elem.css('margin-left')) { } else if (elem.css('margin-left')) {
elem.css('margin-left', ''); elem.css('margin-left', '');
} }
} }
function time_format(interval) { function time_format(interval) {
......
...@@ -61,6 +61,7 @@ define([ ...@@ -61,6 +61,7 @@ define([
expect(rootNode.message).to.be(undefined) expect(rootNode.message).to.be(undefined)
expect(rootNode.params[0].type).to.be('metric'); expect(rootNode.params[0].type).to.be('metric');
expect(rootNode.params[0].segments[1].type).to.be('template'); expect(rootNode.params[0].segments[1].type).to.be('template');
expect(rootNode.params[0].segments[1].value).to.be('server');
}); });
it('invalid metric expression', function() { it('invalid metric expression', function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment