Add templated items and apps search.

This commit is contained in:
Alexander Zobnin
2015-05-23 17:08:12 +03:00
parent 841b47edb5
commit 7bc24fc2a0
2 changed files with 150 additions and 25 deletions

View File

@@ -8,7 +8,7 @@ function (angular, _) {
var module = angular.module('grafana.controllers');
var targetLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
module.controller('ZabbixAPIQueryCtrl', function($scope) {
module.controller('ZabbixAPIQueryCtrl', function($scope, $sce, templateSrv) {
$scope.init = function() {
$scope.targetLetters = targetLetters;
@@ -162,6 +162,14 @@ function (angular, _) {
$scope.datasource.performHostSuggestQuery(groupid).then(function (series) {
$scope.metric.hostList = series;
// Add templated variables
_.each(templateSrv.variables, function(variable) {
$scope.metric.hostList.push({
'name': '$' + variable.name,
'hostid': 0
})
});
if ($scope.target.host) {
$scope.target.host = $scope.metric.hostList.filter(function (item, index, array) {
// Find selected host in metric.hostList