mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix for template targets
This commit is contained in:
parent
cef4349b2a
commit
1e7ced2ac6
@ -81,25 +81,23 @@ function (angular, _, config, graphiteFuncs, Parser) {
|
||||
}
|
||||
|
||||
$scope.segments = _.map(astNode.segments, function(segment) {
|
||||
return {
|
||||
var node = {
|
||||
type: segment.type,
|
||||
val: segment.value,
|
||||
html: getSegmentHtml(segment)
|
||||
html: segment.value
|
||||
};
|
||||
if (segment.value === '*') {
|
||||
node.html = '<i class="icon-asterisk"><i>';
|
||||
}
|
||||
if (segment.type === 'template') {
|
||||
node.val = node.html = '[[' + segment.value + ']]';
|
||||
node.html = "<span style='color: #ECEC09'>" + node.html + "</span>";
|
||||
}
|
||||
return node;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getSegmentHtml(segment) {
|
||||
if (segment.value === '*') {
|
||||
return '<i class="icon-asterisk"><i>';
|
||||
}
|
||||
if (segment.type === 'template') {
|
||||
return "<span style='color: #ECEC09'>[[" + segment.value + "]]</span>";
|
||||
}
|
||||
return segment.value;
|
||||
}
|
||||
|
||||
function getSegmentPathUpTo(index) {
|
||||
var arr = $scope.segments.slice(0, index);
|
||||
|
||||
|
@ -332,7 +332,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
||||
var data = [];
|
||||
|
||||
if(results.length === 0 ) {
|
||||
throw { message: 'no data in response from graphite' };
|
||||
return [];
|
||||
}
|
||||
|
||||
var tsOpts = {
|
||||
@ -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);
|
||||
|
||||
if (scope.panel.leftYAxisLabel) {
|
||||
@ -678,7 +674,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
||||
} else if (elem.css('margin-left')) {
|
||||
elem.css('margin-left', '');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function time_format(interval) {
|
||||
|
@ -61,6 +61,7 @@ define([
|
||||
expect(rootNode.message).to.be(undefined)
|
||||
expect(rootNode.params[0].type).to.be('metric');
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user