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 75634f507277ea1d7b13f3d8a1e7cf82e3c60ce0 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Mar 4 17:30:26 2015 +0100 hostpage : modifs de la conf d'un module sauvegardées sur bdd --- app/modules/storage_modules/shelve_db.py | 17 ++++++++++------- static/js/controllers/hostPageCtrl.js | 22 ++++++++++++++++++++-- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 5439e1d..9da7e16 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -414,22 +414,25 @@ class shelve_db: self.close_db() return json.dumps(res) - def set_conf_mod(self, addr_host, mod_name, data): + def set_conf_mod(self, args): """ Save a new configuration for a monitoring module - :param addr_host: the IP address of the host - :param mod_name: the name of the module - :param data: a structure containing the new values : + :param args: a structure containing the values : { + 'addr_host': val, + 'mod_name': val, + 'freq' : val, 'minor_limit' : val, 'major_limit' : val } """ + addr_host = args['addr_host'] + mod_name = args['mod_name'] self.open_db() try: - self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['minor_limit'] = data['minor_limit'] - self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['major_limit'] = data['major_limit'] - self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['check_frequency'] = data['freq'] + self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['minor_limit'] = args['minor_limit'] + self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['major_limit'] = args['major_limit'] + self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['check_frequency'] = args['freq'] finally: self.close_db() diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index bab4040..0d218b1 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -84,10 +84,28 @@ mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalI }); $scope.ok = function () { - $modalInstance.close($scope.selected.item); + args = {}; + args.addr_host = $scope.conf_args.addr_host; + args.mod_name = $scope.conf_args.mod_name; + args.freq = $scope.freq; + if($scope.items.unit == 'bool'){ + args.minor_limit = ($scope.limit_bool == 'minor'); + args.major_limit = ($scope.limit_bool == 'major'); + } + else if($scope.items.unit == '%'){ + args.minor_limit = $scope.minor_limit_percent; + args.major_limit = $scope.major_limit_percent; + } + else{ + args.minor_limit = $scope.minor_limit_unit; + args.major_limit = $scope.major_limit_unit; + } + $rootScope.$broadcast("sendViaWs", JSON.stringify({"15": {'func': 'set_conf_mod', 'args': args}})); + + $modalInstance.close(); }; $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + $modalInstance.close(); }; }); \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.