Fixed bugs in multiquery receive

This commit is contained in:
Rashid Khan
2013-02-25 09:32:54 -07:00
parent c0273d887a
commit 7b5c1a6761
4 changed files with 67 additions and 23 deletions
+14
View File
@@ -17,7 +17,14 @@ angular.module('kibana.stringquery', [])
$scope.panel.group : [$scope.panel.group];
$scope.init = function() {
// I don't like this compromise. I'm not totally sure what this panel
// Should do if its in multi query mode and receives a query. For now, just
// replace the first one, though I feel like that isn't right.
eventBus.register($scope,'query',function(event,query) {
if (_.isArray($scope.panel.query))
$scope.panel.query[0] = query
else
$scope.panel.query = query;
});
}
@@ -40,6 +47,13 @@ angular.module('kibana.stringquery', [])
new Array($scope.panel.query) : $scope.panel.query[0];
}
$scope.set_sort = function(field) {
if($scope.panel.sort[0] === field)
$scope.panel.sort[1] = $scope.panel.sort[1] == 'asc' ? 'desc' : 'asc';
else
$scope.panel.sort[0] = field;
}
$scope.remove_query = function(index) {
$scope.panel.query.splice(index,1);
console.log($scope.panel.query)