Skip to content

Commit

Permalink
#60 cerebro索引超一定数自动刷新改为30分钟
Browse files Browse the repository at this point in the history
  • Loading branch information
gier.cai committed May 24, 2019
1 parent 3d96f9d commit 2ba9004
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions pallas-plus-web/cerebro/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,12 @@ angular.module('cerebro').controller('NavbarController', ['$scope', '$http',
$scope.currentUrl = $location.path();
});

$scope.$on("isResetInterval", function(e, m){
if(m) {
$scope.setRefreshInterval(1800000);
}
});

$scope.$on("destroy",function(){
locationChangeSuccess();
});
Expand Down Expand Up @@ -828,9 +834,9 @@ angular.module('cerebro').factory('NodesDataService', ['DataService',

angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
'$window', '$location', 'OverviewDataService', 'AlertService', 'ModalService',
'RefreshService', 'DataService',
'RefreshService', 'DataService', '$rootScope',
function($scope, $http, $window, $location, OverviewDataService, AlertService,
ModalService, RefreshService, DataService) {
ModalService, RefreshService, DataService, $rootScope) {

$scope.data = undefined;

Expand Down Expand Up @@ -865,6 +871,20 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
});
});

$scope.setup = function() {
OverviewDataService.getOverview(
function(data) {
var indicesLength = data.indices.length;
if(indicesLength > 50) {
$rootScope.$broadcast('isResetInterval', true);
}
},
function(error) {
AlertService.error('Error while loading data', error);
}
);
};

$scope.$watch(
function() {
return RefreshService.lastUpdate();
Expand Down

0 comments on commit 2ba9004

Please sign in to comment.