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 3e312ae0f34cc32c79619dc75a08ccb53389ef63 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Mar 25 11:19:38 2015 +0100 js : tous les appels websocket ont une réponse appropriée --- static/js/controllers/groupCtrl.js | 17 ++++++++++--- static/js/controllers/hostPageCtrl.js | 39 +++++++++++++++++++++++------- static/js/controllers/notificationsCtrl.js | 18 ++++++++++---- 3 files changed, 56 insertions(+), 18 deletions(-) diff --git a/static/js/controllers/groupCtrl.js b/static/js/controllers/groupCtrl.js index 5c40294..f4596a6 100644 --- a/static/js/controllers/groupCtrl.js +++ b/static/js/controllers/groupCtrl.js @@ -75,6 +75,12 @@ mumApp.controller('groupCtrl', function($scope, $rootScope, $filter, $route, $ro } }; + $scope.$on("resCall", function (event, args) { + if(args.func == 'remove_host_list_to_group'){ + $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_HOSTS": ""})); + } + }); + $scope.remove_host_list = function(){ var args = {}; args['host_list'] = []; @@ -86,7 +92,6 @@ mumApp.controller('groupCtrl', function($scope, $rootScope, $filter, $route, $ro args['group'] = $scope.grp; $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'remove_host_list_to_group','args': args}})); - $route.reload(); } @@ -119,6 +124,13 @@ mumApp.controller('ModalGroupInstanceCtrl', function ($scope, $rootScope, $route $scope.new_grp_name = ""; $scope.selected_grp = "all"; + $scope.$on("resCall", function (event, args) { + if(args.func == 'add_host_list_to_group'){ + $modalInstance.close(); + $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_HOSTS": ""})); + } + }); + $scope.ok = function () { var args = {}; args['host_list'] = $scope.group_args['selected']; @@ -130,9 +142,6 @@ mumApp.controller('ModalGroupInstanceCtrl', function ($scope, $rootScope, $route } $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'add_host_list_to_group','args': args}})); - - $modalInstance.close(); - $route.reload(); }; diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index a1d9669..f3289aa 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -1,4 +1,4 @@ -mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $modal) { +mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routeParams, $modal) { $scope.loaded = false; // indicates if this is the first loading of the page @@ -41,6 +41,18 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $mo $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_os_name', 'args': args}})); } + $scope.$on("resCall", function (event, args) { + if(args.func == 'update_os_name'){ + $route.reload(); + } + if(args.func == 'update_custom_informations'){ + $route.reload(); + } + if(args.func == 'remove_host'){ + $route.reload(); + } + }); + $scope.model = {custom_infos : '', new_os : ''}; $scope.check = function(modname){ @@ -238,6 +250,13 @@ mumApp.controller('ModalIntervInstanceCtrl', function ($scope, $rootScope, $moda $scope.date = $filter('date')(new Date(), 'yyyy-MM-dd HH:mm'); $scope.details = ''; + $scope.$on("resCall", function (event, args) { + if(args.func == 'add_intervention'){ + $modalInstance.close(); + $route.reload(); + } + }); + $scope.ok = function () { var args = {}; args.addr_host = $scope.interv_args.addr_host; @@ -246,10 +265,6 @@ mumApp.controller('ModalIntervInstanceCtrl', function ($scope, $rootScope, $moda args.details = $scope.details; $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'add_intervention', 'args': args}})); - - $modalInstance.close(); - - $route.reload(); }; $scope.cancel = function () { @@ -286,6 +301,10 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI } }); } + if(args.func == 'set_prio_conn'){ + $modalInstance.close(); + $route.reload(); + } }); $scope.ok = function () { @@ -294,10 +313,6 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI args['priorities'] = $scope.priorities; $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'set_prio_conn','args': args}})); - - $modalInstance.close(); - - $route.reload(); }; $scope.cancel = function () { @@ -380,6 +395,12 @@ mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $mo }); + $scope.$on("resCall", function (event, args) { + if(args.func == 'set_conf_conn'){ + $modalInstance.close(); + $route.reload(); + } + }); $scope.ok = function () { var args = conf_conn_args; diff --git a/static/js/controllers/notificationsCtrl.js b/static/js/controllers/notificationsCtrl.js index 7b0d559..71764f2 100644 --- a/static/js/controllers/notificationsCtrl.js +++ b/static/js/controllers/notificationsCtrl.js @@ -1,4 +1,4 @@ -mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, DataHosts) { +mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, $route, DataHosts) { $scope.items = DataHosts.Items; /* [ { "addr":"192.168.74.1", @@ -77,7 +77,7 @@ mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, Data { notif_mod: priority }, ... }}} */ - if(args.func == 'get_host_subscribers'){ + if(args.func == 'get_host_subscribers' || args.func == 'get_group_subscribers'){ $scope.$apply(function(){ var sd = {}; for(user in args.res){ @@ -103,6 +103,12 @@ mumApp.controller('notificationsCtrl', function($scope, $rootScope, $modal, Data $scope.subscriber_data_unchanged = sd; }); } + if(args.func == 'update_subscription_to_group' || args.func == 'update_subscription_to_host'){ + $route.reload(); + } + if(args.func == 'unsubscribe_to_group' || args.func == 'unsubscribe_to_host'){ + $route.reload(); + } }); $scope.discard = function(){ @@ -173,6 +179,11 @@ mumApp.controller('ModalAddSubscriberInstanceCtrl', function ($scope, $rootScope $scope.users = args.res; }); } + + if(args.func == 'subscribe_to_group' || args.func == 'subscribe_to_host'){ + $modalInstance.close(); + $route.reload(); + } }); $scope.ok = function () { @@ -186,9 +197,6 @@ mumApp.controller('ModalAddSubscriberInstanceCtrl', function ($scope, $rootScope args['addr_host'] = $scope.add_subscriber_args['host']['addr']; $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'subscribe_to_host', 'args': args}})); } - $modalInstance.close(); - - $route.reload(); }; $scope.cancel = function () { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.