This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit 4727ac1ba63db144afc20b3e14e35db75ba2b6fb Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 17 15:27:01 2015 +0200 changed all asynchronous $scope.$apply on js to $timeout in order to prevent "inprog" angular errors --- static/js/controllers/hostPageCtrl.js | 32 +++++++++++++++--------------- static/js/controllers/notificationsCtrl.js | 20 +++++++++---------- static/js/controllers/profileCtrl.js | 16 +++++++-------- static/js/controllers/settingsCtrl.js | 6 +++--- static/js/controllers/usersCtrl.js | 10 +++++----- views/settings.html | 4 ++-- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index a2077fd..8a86c2a 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -1,4 +1,4 @@ -mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routeParams, $location, $modal) { +mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routeParams, $location, $modal, $timeout) { $scope.loaded = false; // indicates if this is the first loading of the page @@ -107,7 +107,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar // receiving the host informations $scope.$on("hostInfos", function (event, args) { - $scope.$apply(function(){ + $timeout(function() { if(!$scope.loaded){ // we take all the fields of information $scope.items = args; $scope.model.custom_infos = args.custom_infos; @@ -118,7 +118,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar $scope.items.monitoring = args.monitoring; $scope.items.status = args.status; } - }); + }, 0); }); // refresh after full detection @@ -134,10 +134,10 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar }); $scope.$on("remHost", function (event, args) { - $scope.$apply(function(){ + $timeout(function() { $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_HOSTS": ""})); $location.path('/'); - }); + }, 0); }); // save custom informations @@ -210,7 +210,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar // modals controllers -mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, conf_args) { +mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, $timeout, conf_args) { $scope.conf_args = conf_args; // {'addr_host' : val, 'mod_name', val} $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_conf_mod', 'args': conf_args}})); @@ -239,7 +239,7 @@ mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalI // when the actual conf of the module is received $scope.$on("resCall", function (event, args) { if(args.func == 'get_conf_mod'){ - $scope.$apply(function(){ + $timeout(function() { $scope.items = args.res; $scope.freq_days = Math.floor(args.res.freq / 86400); $scope.freq_hours = Math.floor((args.res.freq - $scope.freq_days * 86400) / 3600); @@ -258,7 +258,7 @@ mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalI $scope.minor_limit_unit = args.res.minor_limit; $scope.major_limit_unit = args.res.major_limit; } - }); + }, 0); } }); @@ -321,7 +321,7 @@ mumApp.controller('ModalIntervInstanceCtrl', function ($scope, $rootScope, $moda }; }); -mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalInstance, $modal, $route, conn_args) { +mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalInstance, $modal, $route, $timeout, conn_args) { $scope.conn_args = conn_args; // {'addr_host' : val} $scope.current_config = {}; @@ -343,12 +343,12 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI // when the configuration of the connection is received $scope.$on("resCall", function (event, args) { if(args.func == 'get_conn_param'){ - $scope.$apply(function(){ + $timeout(function() { $scope.current_config = args.res; for(mod in args.res){ $scope.priorities[mod] = args.res[mod]['priority'] } - }); + }, 0); $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_LOADED_CONN_MOD": ""})); } if(args.func == 'set_prio_conn'){ @@ -358,7 +358,7 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI }); $scope.$on("resGetLoadedConnMod", function (event, args) { - $scope.$apply(function(){ + $timeout(function() { $scope.loaded_conn_mods = args; for(mod in $scope.loaded_conn_mods){ if(!$scope.current_config.hasOwnProperty(mod)){ @@ -366,7 +366,7 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI $scope.current_config[mod]['priority'] = 0; } } - }); + }, 0); }); $scope.testConn = function(connModName){ @@ -405,7 +405,7 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI }; }); -mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, conf_conn_args, FileUploader) { +mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, $timeout, conf_conn_args, FileUploader) { $scope.uploader = new FileUploader({ url: '/upload' }); @@ -439,9 +439,9 @@ mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $mo $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_KEYS_LIST": ""})); $scope.$on("keysList", function (event, args) { - $scope.$apply(function(){ + $timeout(function() { $scope.keys_list = args; - }); + }, 0); }); $scope.$on("resCall", function (event, args) { diff --git a/static/js/controllers/notificationsCtrl.js b/static/js/controllers/notificationsCtrl.js index dc85a7e..0a24ed3 100644 --- a/static/js/controllers/notificationsCtrl.js +++ b/static/js/controllers/notificationsCtrl.js @@ -1,4 +1,4 @@ -mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, $route, DataHosts) { +mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, $route, $timeout, DataHosts) { $scope.items = DataHosts.Items; /* [ { "addr":"192.168.74.1", @@ -26,16 +26,16 @@ mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, $rou $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_ALL_SUBSCRIPTIONS": ""})); $scope.$on("resGetAllSubscriptions", function (event, args) { - $scope.$apply(function(){ + $timeout(function() { $scope.all_subscriptions = args; - }); + }, 0); $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_LOADED_NOTIF_MOD": ""})); }); $scope.$on("resGetLoadedNotifMod", function (event, args) { - $scope.$apply(function(){ + $timeout(function() { $scope.notif_mods = args; - }); + }, 0); }); $scope.subscriber_data = {}; /* {username:{"minor":{mod_notif:{"activated":bool,"priority":int}, ...}, @@ -109,7 +109,7 @@ mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, $rou ... }}} */ if(args.func == 'get_host_subscribers' || args.func == 'get_group_subscribers'){ - $scope.$apply(function(){ + $timeout(function() { var sd = {}; for(user in args.res){ sd[user] = {}; @@ -132,7 +132,7 @@ mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, $rou } $scope.subscriber_data = sd; $scope.subscriber_data_unchanged = sd; - }); + }, 0); } if(args.func == 'update_subscription_to_group' || args.func == 'update_subscription_to_host'){ $route.reload(); @@ -186,7 +186,7 @@ mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, $rou }; }); -mumApp.controller('ModalAddSubscriberInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, add_subscriber_args) { +mumApp.controller('ModalAddSubscriberInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, $timeout, add_subscriber_args) { $scope.add_subscriber_args = add_subscriber_args; /* {'grp': val, 'host': val */ $scope.modal_title = "Add users to "; @@ -206,9 +206,9 @@ mumApp.controller('ModalAddSubscriberInstanceCtrl', function ($scope, $rootScope // receiving the user list $scope.$on("resCall", function (event, args) { if(args.func == 'get_users'){ - $scope.$apply(function(){ + $timeout(function() { $scope.users = args.res; - }); + }, 0); } if(args.func == 'subscribe_to_group' || args.func == 'subscribe_to_host'){ diff --git a/static/js/controllers/profileCtrl.js b/static/js/controllers/profileCtrl.js index 1fc49e2..24b0d94 100644 --- a/static/js/controllers/profileCtrl.js +++ b/static/js/controllers/profileCtrl.js @@ -1,4 +1,4 @@ -mumApp.controller('profileCtrl', function($scope, $rootScope, $route, $modal){ +mumApp.controller('profileCtrl', function($scope, $rootScope, $route, $modal, $timeout){ $scope.users = {}; @@ -12,15 +12,15 @@ mumApp.controller('profileCtrl', function($scope, $rootScope, $route, $modal){ // after calling db functions $scope.$on("resCall", function (event, args) { if(args.func == 'get_users'){ - $scope.$apply(function(){ + $timeout(function() { $scope.users = args.res; - }); + }, 0); } if(args.func == 'get_user_settings'){ - $scope.$apply(function(){ + $timeout(function() { $scope.email = args.res.settings.email; $scope.sms_url = args.res.settings.sms_url; - }); + }, 0); } if(args.func == 'update_user_settings'){ $route.reload(); @@ -60,7 +60,7 @@ mumApp.controller('profileCtrl', function($scope, $rootScope, $route, $modal){ }; }); -mumApp.controller('ModalSubscriptionsInstanceCtrl', function ($scope, $rootScope, $modalInstance, subs_args) { +mumApp.controller('ModalSubscriptionsInstanceCtrl', function ($scope, $rootScope, $modalInstance, $timeout, subs_args) { $scope.subs_args = subs_args; // { 'username': string } $scope.user_subscriptions = {}; /* @@ -85,9 +85,9 @@ mumApp.controller('ModalSubscriptionsInstanceCtrl', function ($scope, $rootScope $scope.$on("resCall", function (event, args) { if(args.func == 'get_user_subscriptions'){ - $scope.$apply(function(){ + $timeout(function() { $scope.user_subscriptions = args.res; - }); + }, 0); } }); diff --git a/static/js/controllers/settingsCtrl.js b/static/js/controllers/settingsCtrl.js index 6e06a8f..3c5fdb2 100644 --- a/static/js/controllers/settingsCtrl.js +++ b/static/js/controllers/settingsCtrl.js @@ -1,13 +1,13 @@ -mumApp.controller('settingsCtrl', function($scope, $rootScope, $modal) { +mumApp.controller('settingsCtrl', function($scope, $rootScope, $modal, $timeout) { $scope.settings = {}; // { mod_name: {'check_frequency': 60, 'minor_limit': True, 'activated': False, 'major_limit': False, 'block': 'software', 'unit': 'bool'}} $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_global_settings','args': null}})); $scope.$on("resCall", function (event, args) { if(args.func == 'get_global_settings'){ - $scope.$apply(function(){ + $timeout(function() { $scope.settings = args.res; - }); + }, 0); } }); diff --git a/static/js/controllers/usersCtrl.js b/static/js/controllers/usersCtrl.js index 5abc4a3..2f61e47 100644 --- a/static/js/controllers/usersCtrl.js +++ b/static/js/controllers/usersCtrl.js @@ -1,4 +1,4 @@ -mumApp.controller('usersCtrl', function($scope, $rootScope, $route) { +mumApp.controller('usersCtrl', function($scope, $rootScope, $route, $timeout) { $scope.users = {}; $scope.selected_user = ""; @@ -29,17 +29,17 @@ mumApp.controller('usersCtrl', function($scope, $rootScope, $route) { // receiving the user list $scope.$on("resCall", function (event, args) { if(args.func == 'get_users'){ - $scope.$apply(function(){ + $timeout(function() { $scope.users = args.res; - }); + }, 0); } if(args.func == 'create_user' || args.func == 'remove_user'){ $route.reload(); } if(args.func == 'get_user_subscriptions'){ - $scope.$apply(function(){ + $timeout(function() { $scope.user_subscriptions = args.res; - }); + }, 0); } }); diff --git a/views/settings.html b/views/settings.html index 9428423..a0c06b7 100644 --- a/views/settings.html +++ b/views/settings.html @@ -58,10 +58,10 @@ </div> </div> <div ng-show="global_conf_args.conf_mod.unit != '%' && global_conf_args.conf_mod.unit != 'bool'"> - <label for="minor_unit">Minor notif at {{minor_limit_unit}}</label> + <label for="minor_unit">Minor notif at {{minor_limit_unit}} {{global_conf_args.conf_mod.unit}}</label> <input type="number" class="form-control" id="minor_unit" min="0" ng-model="minor_limit_unit"> - <label for="maj_pack">Major notif at {{major_limit_unit}}</label> + <label for="maj_pack">Major notif at {{major_limit_unit}} {{global_conf_args.conf_mod.unit}}</label> <input type="number" class="form-control" id="maj_pack" min="0" ng-model="major_limit_unit"> </div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.