Linted, moved shared functions to kbn object

This commit is contained in:
Rashid Khan
2013-07-20 14:56:59 -07:00
parent 7c9f14ad5e
commit 5a3028f784
17 changed files with 955 additions and 920 deletions
+20 -16
View File
@@ -1,3 +1,5 @@
/*jshint globalstrict:true */
/*global angular:true */
/*
## query
@@ -11,6 +13,8 @@
one element
*/
'use strict';
angular.module('kibana.query', [])
.controller('query', function($scope, query, $rootScope) {
@@ -22,39 +26,39 @@ angular.module('kibana.query', [])
group : "default",
history : [],
remember: 10 // max: 100, angular strap can't take a variable for items param
}
};
_.defaults($scope.panel,_d);
$scope.queries = query;
$scope.init = function() {
}
};
$scope.refresh = function(query) {
$rootScope.$broadcast('refresh')
}
$rootScope.$broadcast('refresh');
};
$scope.render = function(query) {
$rootScope.$broadcast('render')
}
$rootScope.$broadcast('render');
};
$scope.add_query = function() {
if (_.isArray($scope.panel.query))
$scope.panel.query.push("")
else {
$scope.panel.query = new Array($scope.panel.query)
$scope.panel.query.push("")
if (_.isArray($scope.panel.query)) {
$scope.panel.query.push("");
} else {
$scope.panel.query = new Array($scope.panel.query);
$scope.panel.query.push("");
}
}
};
var update_history = function(query) {
if($scope.panel.remember > 0) {
$scope.panel.history = _.union(query.reverse(),$scope.panel.history)
var _length = $scope.panel.history.length
$scope.panel.history = _.union(query.reverse(),$scope.panel.history);
var _length = $scope.panel.history.length;
if(_length > $scope.panel.remember) {
$scope.panel.history = $scope.panel.history.slice(0,$scope.panel.remember)
$scope.panel.history = $scope.panel.history.slice(0,$scope.panel.remember);
}
}
}
};
});