From e5f85c931c034698de24eb5b59060c51211c7496 Mon Sep 17 00:00:00 2001 From: Benjamin Gamard Date: Wed, 21 Mar 2018 12:19:44 +0100 Subject: [PATCH] stop polling for errors --- .../src/app/docs/controller/Navigation.js | 38 +------------------ docs-web/src/main/webapp/src/index.html | 6 --- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/docs-web/src/main/webapp/src/app/docs/controller/Navigation.js b/docs-web/src/main/webapp/src/app/docs/controller/Navigation.js index 20c75b19..a7a45c8f 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/Navigation.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/Navigation.js @@ -3,47 +3,11 @@ /** * Navigation controller. */ -angular.module('docs').controller('Navigation', function($scope, $state, $rootScope, User, Restangular) { +angular.module('docs').controller('Navigation', function($scope, $state, $rootScope, User) { User.userInfo().then(function(data) { $rootScope.userInfo = data; }); - // Last time when the errors logs was checked - $scope.lastLogCheck = new Date().getTime(); - - // Number of errors logs - $scope.errorNumber = 0; - - // Check repeatedly if there is a new error log - setInterval(function() { - $scope.$apply(function() { - Restangular.one('app/log').get({ - // Error count will be wrong if there is more than 10 errors in 60 seconds - limit: 10, - level: 'ERROR' - }).then(function(data) { - // Add new errors - $scope.errorNumber += _.reduce(data.logs, function(number, log) { - if (log.date > $scope.lastLogCheck) { - return ++number; // It's a new error - } - return number; // Not a new error - }, 0); - - // Update last check timestamp - $scope.lastLogCheck = new Date().getTime(); - }); - }) - }, 60000); - - /** - * Navigate to error logs. - */ - $scope.openLogs = function() { - $scope.errorNumber = 0; - $state.go('settings.log'); - }; - /** * User logout. */ diff --git a/docs-web/src/main/webapp/src/index.html b/docs-web/src/main/webapp/src/index.html index f6b70f99..9230d5af 100644 --- a/docs-web/src/main/webapp/src/index.html +++ b/docs-web/src/main/webapp/src/index.html @@ -139,12 +139,6 @@