From b0f18ad736a7c4319fa73477e70e13ed861c90d3 Mon Sep 17 00:00:00 2001 From: jesmg Date: Mon, 12 Sep 2016 14:02:53 +0000 Subject: [PATCH] kbnDis and kbnVis compatibility (filters dont work properly) --- public/controllers/disLoader.js | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/public/controllers/disLoader.js b/public/controllers/disLoader.js index 1874d4b56..34cbdf034 100644 --- a/public/controllers/disLoader.js +++ b/public/controllers/disLoader.js @@ -160,9 +160,9 @@ require('ui/modules').get('app/wazuh', []).controller('discoverW', function ($sc $state.index = $scope.indexPattern.id; $state.sort = getSort.array($state.sort, $scope.indexPattern); - $scope.$watchCollection('state.columns', function () { + /*$scope.$watchCollection('state.columns', function () { $state.save(); - }); + });*/ $scope.opts = { // number of records to fetch, then paginate through @@ -187,9 +187,9 @@ require('ui/modules').get('app/wazuh', []).controller('discoverW', function ($sc $scope.updateDataSource() .then(function () { - $scope.$listen(timefilter, 'fetch', function () { + $scope.$listen(timefilter, 'fetch', function () { $scope.fetch(); - }); + }); $scope.$watchCollection('state.sort', function (sort) { if (!sort) return; @@ -202,16 +202,9 @@ require('ui/modules').get('app/wazuh', []).controller('discoverW', function ($sc }); // update data source when filters update - $scope.$listen(queryFilter, 'update', function () { - return $scope.updateDataSource().then(function () { - $state.save(); - }); - }); - - // update data source when hitting forward/back and the query changes - $scope.$listen($state, 'fetch_with_changes', function (diff) { - if (diff.indexOf('query') >= 0) $scope.fetch(); - }); + $scope.$listen(queryFilter, 'update', function () { + return $scope.updateDataSource(); + }); // fetch data when filters fire fetch event $scope.$listen(queryFilter, 'fetch', $scope.fetch); @@ -316,7 +309,6 @@ require('ui/modules').get('app/wazuh', []).controller('discoverW', function ($sc if (id) { notify.info('Saved Data Source "' + savedSearch.title + '"'); if (savedSearch.id !== $route.current.params.id) { - kbnUrl.change('/discover/{{id}}', { id: savedSearch.id }); } else { // Update defaults so that "reload saved query" functions correctly $state.setDefaults(getStateDefaults()); @@ -336,7 +328,7 @@ require('ui/modules').get('app/wazuh', []).controller('discoverW', function ($sc $scope.updateDataSource() .then(setupVisualization) .then(function () { - $state.save(); + //$state.save(); return courier.fetch(); }) .catch(notify.error); @@ -453,14 +445,6 @@ require('ui/modules').get('app/wazuh', []).controller('discoverW', function ($sc }; }; - $scope.resetQuery = function () { - kbnUrl.change('/discover/{{id}}', { id: $route.current.params.id }); - }; - - $scope.newQuery = function () { - kbnUrl.change('/discover'); - }; - $scope.updateDataSource = Promise.method(function () { $scope.searchSource .size($scope.opts.sampleSize)