Commit 9eb7b192 by Torkel Ödegaard

Merge branch 'master' of github.com:grafana/grafana

parents 06d63dda 441682b5
...@@ -75,7 +75,7 @@ function (angular, _, require, config) { ...@@ -75,7 +75,7 @@ function (angular, _, require, config) {
$scope.iframeHtml = '<iframe src="' + soloUrl + '" width="450" height="200" frameborder="0"></iframe>'; $scope.iframeHtml = '<iframe src="' + soloUrl + '" width="450" height="200" frameborder="0"></iframe>';
$scope.imageUrl = soloUrl.replace('/dashboard-solo/', '/render/dashboard-solo/'); $scope.imageUrl = soloUrl.replace(config.appSubUrl + '/dashboard-solo/', config.appSubUrl + '/render/dashboard-solo/');
$scope.imageUrl += '&width=1000'; $scope.imageUrl += '&width=1000';
$scope.imageUrl += '&height=500'; $scope.imageUrl += '&height=500';
}; };
......
...@@ -256,23 +256,14 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS ...@@ -256,23 +256,14 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS
return this.renderTemplate(options.legendFormat, labelData) || '{}'; return this.renderTemplate(options.legendFormat, labelData) || '{}';
}; };
this.renderTemplate = function(format, data) { this.renderTemplate = function(aliasPattern, aliasData) {
var originalSettings = _.templateSettings; var aliasRegex = /\{\{\s*(.+?)\s*\}\}/g;
_.templateSettings = { return aliasPattern.replace(aliasRegex, function(match, g1) {
interpolate: /\{\{(.+?)\}\}/g if (aliasData[g1]) {
}; return aliasData[g1];
}
var template = _.template(templateSrv.replace(format)); return g1;
var result; });
try {
result = template(data);
} catch (e) {
result = null;
}
_.templateSettings = originalSettings;
return result;
}; };
this.getOriginalMetricName = function(labelData) { this.getOriginalMetricName = function(labelData) {
......
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