mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Make template variables work in row titles, #1956
This commit is contained in:
@@ -105,6 +105,8 @@ function (angular, _) {
|
||||
|
||||
_.each(selected, function(option, index) {
|
||||
copy = self.getRowClone(row, index);
|
||||
copy.scopedVars = {};
|
||||
copy.scopedVars[variable.name] = option;
|
||||
|
||||
for (i = 0; i < copy.panels.length; i++) {
|
||||
panel = copy.panels[i];
|
||||
|
||||
@@ -22,7 +22,6 @@ function (angular, app, _, config) {
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.editor = {index: 0};
|
||||
$scope.reset_panel();
|
||||
};
|
||||
|
||||
$scope.togglePanelMenu = function(posX) {
|
||||
@@ -64,8 +63,18 @@ function (angular, app, _, config) {
|
||||
};
|
||||
|
||||
$scope.add_panel_default = function(type) {
|
||||
$scope.reset_panel(type);
|
||||
$scope.add_panel($scope.panel);
|
||||
var defaultSpan = 12;
|
||||
var _as = 12 - $scope.dashboard.rowSpan($scope.row);
|
||||
|
||||
var panel = {
|
||||
title: config.new_panel_title,
|
||||
error: false,
|
||||
span: _as < defaultSpan && _as > 0 ? _as : defaultSpan,
|
||||
editable: true,
|
||||
type: type
|
||||
};
|
||||
|
||||
$scope.add_panel(panel);
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$broadcast('render');
|
||||
@@ -105,31 +114,6 @@ function (angular, app, _, config) {
|
||||
});
|
||||
};
|
||||
|
||||
$scope.reset_panel = function(type) {
|
||||
var defaultSpan = 12;
|
||||
var _as = 12 - $scope.dashboard.rowSpan($scope.row);
|
||||
|
||||
$scope.panel = {
|
||||
title: config.new_panel_title,
|
||||
error: false,
|
||||
span: _as < defaultSpan && _as > 0 ? _as : defaultSpan,
|
||||
editable: true,
|
||||
type: type
|
||||
};
|
||||
|
||||
function fixRowHeight(height) {
|
||||
if (!height) {
|
||||
return '200px';
|
||||
}
|
||||
if (!_.isString(height)) {
|
||||
return height + 'px';
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
$scope.row.height = fixRowHeight($scope.row.height);
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user