Commit 2d41154b by Rashid Khan

Merge pull request #259 from rashidkpc/master

Fix derivequeries
parents 6203ef6c ad69ccc0
......@@ -19,7 +19,7 @@
'use strict';
angular.module('kibana.derivequeries', [])
.controller('derivequeries', function($scope, $rootScope, query, fields, dashboard, filterSrv) {
.controller('derivequeries', function($scope, $rootScope, querySrv, fields, dashboard, filterSrv) {
// Set and populate defaults
var _d = {
......@@ -87,15 +87,15 @@ angular.module('kibana.derivequeries', [])
_.each(results.facets.query.terms, function(v) {
var _q = $scope.panel.field+':"'+v.term+'"'+suffix;
// if it isn't in the list, remove it
var _iq = query.findQuery(_q);
var _iq = querySrv.findQuery(_q);
if(!_iq) {
ids.push(query.set({query:_q}));
ids.push(querySrv.set({query:_q}));
} else {
ids.push(_iq.id);
}
});
_.each(_.difference($scope.panel.ids,ids),function(id){
query.remove(id);
querySrv.remove(id);
});
$scope.panel.ids = ids;
dashboard.refresh();
......
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