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 b08765a6494538008ccc2d52a77767d8c2756001 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Mar 13 10:08:54 2015 +0100 actualisation naive du hostpage après nouveau check --- app/app.py | 2 +- static/js/controllers/hostPageCtrl.js | 39 ++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/app/app.py b/app/app.py index eda7db5..2bfb16b 100755 --- a/app/app.py +++ b/app/app.py @@ -180,6 +180,6 @@ if __name__ == '__main__': ml.load_all_connection_modules() ml.load_all_detection_modules() wsc = WebSocketContainer(ml.get_db()) - #process_monitoring.init(ml, wsc) + process_monitoring.init(ml, wsc) port = int(os.environ.get('PORT', 1337)) run(host='0.0.0.0', port=port, debug=True, server=GeventWebSocketServer) \ No newline at end of file diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 0859b17..e7a55e7 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -1,5 +1,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $modal) { + $scope.loaded = false; // indicates if this is the first loading of the page + $scope.addr_host = $routeParams.param // asks for host informations @@ -56,20 +58,21 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $mo // receiving the host informations $scope.$on("hostInfos", function (event, args) { $scope.$apply(function(){ - $scope.items = args; - $scope.model.custom_infos = args.custom_infos; + if(!$scope.loaded){ // we take all the fields of information + $scope.items = args; + $scope.model.custom_infos = args.custom_infos; + $scope.loaded = true; + } + else{ // we takes only monitoring updates + $scope.items.monitoring = args.monitoring; + } }); }); - /* // monitoring data are updated + // monitoring data are updated $scope.$on("hostsUpdate", function (event, args) { - $scope.$apply(function(){ - for(i=0 ; i<args.length()) ; i++){ - if(args[i][]) - $scope.items['monitoring'] = args['monitoring']; - } - }); - });*/ + $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_HOST_INFO": $scope.addr_host})); + }); // save custom informations $scope.save_custom_infos = function(){ @@ -139,7 +142,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $mo // modals controllers -mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalInstance, conf_args) { +mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalInstance, $location, 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}})); @@ -205,6 +208,8 @@ mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalI $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'set_conf_mod', 'args': args}})); $modalInstance.close(); + + $location.path('#hostpage/' + $scope.conf_args['addr_host']); }; $scope.cancel = function () { @@ -212,7 +217,7 @@ mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalI }; }); -mumApp.controller('ModalIntervInstanceCtrl', function ($scope, $rootScope, $modalInstance, $filter, interv_args) { +mumApp.controller('ModalIntervInstanceCtrl', function ($scope, $rootScope, $modalInstance, $filter, $location, interv_args) { $scope.interv_args = interv_args; // {'addr_host' : val} $scope.user = ''; @@ -229,6 +234,8 @@ mumApp.controller('ModalIntervInstanceCtrl', function ($scope, $rootScope, $moda $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'add_intervention', 'args': args}})); $modalInstance.close(); + + $location.path('#hostpage/' + $scope.interv_args['addr_host']); }; $scope.cancel = function () { @@ -236,7 +243,7 @@ mumApp.controller('ModalIntervInstanceCtrl', function ($scope, $rootScope, $moda }; }); -mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalInstance, $modal, conn_args) { +mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalInstance, $modal, $location, conn_args) { $scope.conn_args = conn_args; // {'addr_host' : val} $scope.current_config = {}; @@ -273,6 +280,8 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'set_prio_conn','args': args}})); $modalInstance.close(); + + $location.path('#hostpage/' + $scope.conn_args['addr_host']); }; $scope.cancel = function () { @@ -375,7 +384,7 @@ mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $mo }; }); -mumApp.controller('ModalBlockInstanceCtrl', function ($scope, $rootScope, $modalInstance, block_args) { +mumApp.controller('ModalBlockInstanceCtrl', function ($scope, $rootScope, $modalInstance, $location, block_args) { $scope.block_args = block_args; /* {'addr_host': val, 'activated_mod':{ mod_name: bool @@ -452,6 +461,8 @@ mumApp.controller('ModalBlockInstanceCtrl', function ($scope, $rootScope, $modal $rootScope.$broadcast("sendViaWs", JSON.stringify({"SET_MOD_ACTIVATION": args})); $modalInstance.close(); + + $location.path('#hostpage/' + $scope.block_args['addr_host']); }; $scope.cancel = function () { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.