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 925de3c9026164584ad6f479f06c4b1379029ed7 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Mon Mar 30 11:11:15 2015 +0200 hostpage: le champ pour corriger l'os détecté est un menu déroulant. --- app/module_loader.py | 17 ++++++++++++++++- app/mum.py | 3 +-- static/js/controllers/hostPageCtrl.js | 6 +++++- views/hostpage.html | 4 +++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/module_loader.py b/app/module_loader.py index 638692a..bfde9ca 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -33,6 +33,7 @@ class ModuleLoader: self.loaded_mod_detect = {} # See load_all_detection_modules self.loaded_mod_conn = {} # See load_all_connection_modules self.loaded_mod_notif = {} # See load_all_notification_modules + self.compatible_os_list = ['other'] # Will contain the list of os compatibles for every monitoring module loaded def load_db(self, add_func, rem_func, key_loc): """ @@ -113,6 +114,9 @@ class ModuleLoader: infos_mod['imported'] = loaded_mod infos_mod['class_name'] = getattr(mod_inst, 'get_name')() infos_mod['compatible_os'] = getattr(mod_inst, 'get_compatible_os')() + for os in infos_mod['compatible_os']: + if os not in self.compatible_os_list: + self.compatible_os_list.append(os) self.loaded_mod_detect[mod_name] = infos_mod except AttributeError: print "Error : internal detection module " + mod_name + " could not have been loaded. " @@ -153,6 +157,9 @@ class ModuleLoader: infos_mod['imported'] = loaded_mod infos_mod['class_name'] = getattr(mod_inst, 'get_name')() infos_mod['compatible_os'] = getattr(mod_inst, 'get_compatible_os')() + for os in infos_mod['compatible_os']: + if os not in self.compatible_os_list: + self.compatible_os_list.append(os) infos_mod['block'] = getattr(mod_inst, 'get_block')() infos_mod['unit'] = getattr(mod_inst, 'get_unit')() infos_mod['external'] = False @@ -172,6 +179,9 @@ class ModuleLoader: infos_mod['imported'] = loaded_mod infos_mod['class_name'] = getattr(mod_inst, 'get_name')() infos_mod['compatible_os'] = getattr(mod_inst, 'get_compatible_os')() + for os in infos_mod['compatible_os']: + if os not in self.compatible_os_list: + self.compatible_os_list.append(os) infos_mod['block'] = getattr(mod_inst, 'get_block')() infos_mod['unit'] = getattr(mod_inst, 'get_unit')() infos_mod['external'] = True @@ -396,4 +406,9 @@ class ModuleLoader: self.db.config_mod_activation(args, self.get_monitoring_modules_list()) def get_public_keys_list(self): - return os.listdir(self.conf['keys_location']) \ No newline at end of file + return os.listdir(self.conf['keys_location']) + + def get_host_info(self, addr_host): + host_info = self.db.get_host_informations(addr_host) + host_info['compatible_os_list'] = self.compatible_os_list + return host_info \ No newline at end of file diff --git a/app/mum.py b/app/mum.py index ca09f2e..ed5add2 100755 --- a/app/mum.py +++ b/app/mum.py @@ -133,8 +133,7 @@ def receive(ws): db = ml.get_db() ws.send(json.dumps({"RES_GET_HOSTS": db.get_hosts()})) elif code == "GET_HOST_INFO": # asked from hostpage - db = ml.get_db() - ws.send(json.dumps({"RES_INFO_HOST": db.get_host_informations(msg["GET_HOST_INFO"])})) + ws.send(json.dumps({"RES_INFO_HOST": ml.get_host_info(msg["GET_HOST_INFO"])})) elif code == "CALL_FUNC_DB": # asked when the request can directly pass by database res = ml.launch_db_function(msg["CALL_FUNC_DB"]) msg = json.dumps({"RES_CALL_FUNC_DB": { diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 61a3b01..90963f2 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -32,6 +32,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar mod_name: bool }, "custom_infos":val + "compatible_os_list": [os1, os2, ...] } */ $scope.update_os_name = function(){ @@ -53,7 +54,9 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar } }); - $scope.model = {custom_infos : '', new_os : ''}; + $scope.model = {custom_infos : '', + new_os : '', + compatible_os_list: []}; $scope.check = function(modname){ var args = {}; @@ -81,6 +84,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar $scope.items = args; $scope.model.custom_infos = args.custom_infos; $scope.loaded = true; + $scope.model['compatible_os_list'] = args['compatible_os_list']; } else{ // we takes only monitoring updates $scope.items.monitoring = args.monitoring; diff --git a/views/hostpage.html b/views/hostpage.html index 7359ec9..ef15943 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -40,7 +40,9 @@ <td>{{key}}</td> <td>{{val}}</td> <td ng-show="(key == 'os')"> - <input type="text" ng-model="model.new_os"> + <select ng-model="model.new_os" + ng-options="os for os in model.compatible_os_list"> + </select> <button type="button" class="btn btn-info btn-xs" ng-click="update_os_name()" ng-disabled="model.new_os==''">Correct OS name</button> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.