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 475471624be023f21b8a8a977a568041be08d4f9 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 17 14:48:21 2015 +0200 bug on external module loading corrected + hostpage select all avaliable on block selection --- app/module_loader.py | 13 ++++++++++--- static/js/controllers/hostPageCtrl.js | 23 +++++++++++++++-------- views/hostpage.html | 2 ++ 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/app/module_loader.py b/app/module_loader.py index 0d43201..57bc377 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -232,13 +232,20 @@ class ModuleLoader: else: # otherwise, load the external module normally try: part = getattr(loaded_mod, 'part') + if part not in self.loaded_mod_moni: + self.loaded_mod_moni[part] = {} + self.loaded_mod_moni[part]['compatible_os'] = [] + self.loaded_mod_moni[part]['compatible_conn'] = [] + self.loaded_mod_moni[part]['modules'] = {} if mod_name not in self.loaded_mod_moni[part]['modules']: self.loaded_mod_moni[part]['modules'][mod_name] = {} self.loaded_mod_moni[part]['modules'][mod_name]['imported'] = loaded_mod - self.loaded_mod_moni[part]['compatible_os'] = \ - list(set(self.loaded_mod_moni[part]['compatible_os'] + - getattr(loaded_mod, 'compatible_os'))) self.loaded_mod_moni[part]['modules'][mod_name]['external'] = True + self.loaded_mod_moni[part]['compatible_os'] = \ + list(set(self.loaded_mod_moni[part]['compatible_os'] + getattr(loaded_mod, 'compatible_os'))) + self.loaded_mod_moni[part]['compatible_conn'].append(getattr(loaded_mod, 'connection')) + self.loaded_mod_moni[part]['compatible_conn'] = \ + list(set(self.loaded_mod_moni[part]['compatible_conn'])) except AttributeError: print "Error : external monitoring module " + mod_name + " could not have been loaded. " diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 348f781..a2077fd 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -470,7 +470,7 @@ mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $mo }; }); -mumApp.controller('ModalBlockInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, block_args) { +mumApp.controller('ModalBlockInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, $timeout, block_args) { $scope.block_args = block_args; /* {'addr_host': val, 'activated_mod':{ mod_name: bool @@ -483,7 +483,8 @@ mumApp.controller('ModalBlockInstanceCtrl', function ($scope, $rootScope, $modal 'compatible_os': [val1, val2, ...], => a list containing the compatibles os 'unit': val, => the unit type of return ('%', 'bool' or other) 'block': val, => the monitoring block of the module - 'part':val => the part checked by the moni mod + 'part':val, => the part checked by the moni mod + 'compatible_conn': [val1, val2, ...] => a list containing the compatibles connection modules } } } @@ -515,15 +516,21 @@ mumApp.controller('ModalBlockInstanceCtrl', function ($scope, $rootScope, $modal } $scope.select_all = function(block){ - for(mod in block){ - mod.activated = true; - } + $timeout(function() { // to prevent "inprog" angular error + for(var i=0; i<block.length; i++){ + if(!$scope.is_not_compatible(block[i].modname)){ + block[i].activated = true; + } + } + }, 0); }; $scope.select_none = function(block){ - for(mod in block){ - mod.activated = false; - } + $timeout(function() { // to prevent "inprog" angular error + for(var i=0; i<block.length; i++){ + block[i].activated = false; + } + }, 0); }; $scope.is_not_compatible = function(modname){ diff --git a/views/hostpage.html b/views/hostpage.html index a737f66..ce5b837 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -300,6 +300,7 @@ <button type="button" class="btn" ng-click="select_none(block)">Select none</button> </th> <th>Compatible Connections</th> + <th>Compatible OS</th> </tr> <tr ng-repeat-end ng-repeat="mod in block"> @@ -308,6 +309,7 @@ ng-model="mod.activated" ng-disabled="is_not_compatible(mod.modname)"></td> <td>{{block_args.loaded_moni_mod[mod.modname].compatible_conn}}</td> + <td>{{block_args.loaded_moni_mod[mod.modname].compatible_os}}</td> </tr> </table> </div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.