branch develop updated (1fbeb70 -> aad9726)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository mum. See http://git.chorem.org/mum.git from 1fbeb70 commented snmp modules + smtp module do helo request using smtplib new aad9726 dashboard: multiple params separated by ',' on URL for status_filter + hostpage: modal for modifying the detected open ports The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit aad97268587b0d56370de0e0658f88dabe8d97a0 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Mon Apr 27 14:19:40 2015 +0200 dashboard: multiple params separated by ',' on URL for status_filter + hostpage: modal for modifying the detected open ports Summary of changes: app/modules/storage_modules/shelve_db.py | 2 +- static/js/controllers/dashboardCtrl.js | 7 ++- static/js/controllers/hostPageCtrl.js | 81 +++++++++++++++++++++++++++++++- views/hostpage.html | 68 +++++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 3 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 aad97268587b0d56370de0e0658f88dabe8d97a0 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Mon Apr 27 14:19:40 2015 +0200 dashboard: multiple params separated by ',' on URL for status_filter + hostpage: modal for modifying the detected open ports --- app/modules/storage_modules/shelve_db.py | 2 +- static/js/controllers/dashboardCtrl.js | 7 ++- static/js/controllers/hostPageCtrl.js | 81 +++++++++++++++++++++++++++++++- views/hostpage.html | 68 +++++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 3 deletions(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 0bee1c9..0dba636 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -495,7 +495,7 @@ class shelve_db: self.open_db() try: nmap_detection = json.loads(self.db['hosts'][args['addr_host']]['detected']['nmap']) - nmap_detection[args['attribute']] = args['new_value'].lower() + nmap_detection[args['attribute']] = args['new_value'] self.db['hosts'][args['addr_host']]['detected']['nmap'] = json.dumps(nmap_detection) except Exception: print traceback.format_exc() diff --git a/static/js/controllers/dashboardCtrl.js b/static/js/controllers/dashboardCtrl.js index 8fab9e6..33b1711 100644 --- a/static/js/controllers/dashboardCtrl.js +++ b/static/js/controllers/dashboardCtrl.js @@ -43,7 +43,12 @@ mumApp.controller('dashboardCtrl', function($scope, $filter, $routeParams, DataH $scope.status_filter = ["success", "warning", "danger", "idling", ""]; } else{ - $scope.status_filter = [$routeParams.param]; + // multiple params should be separated by ',' + $scope.status_filter = []; + tab_params = $routeParams.param.split(','); + for(var i = 0; i<tab_params.length; i++){ + $scope.status_filter.push(tab_params[i]); + } } $scope.group_filter = ''; diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index b7f3e4c..d1783ba 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -84,7 +84,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar } $scope.$on("resCall", function (event, args) { - if(args.func == 'update_os_name'){ + if(args.func == 'update_nmap_attribute'){ $route.reload(); } if(args.func == 'update_custom_informations'){ @@ -216,6 +216,19 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar } }); }; + + $scope.open_modal_port_config = function (port_list) { + var modalInstance = $modal.open({ + templateUrl: 'modal_port_config.html', + controller: 'ModalPortConfigInstanceCtrl', + resolve: { + port_config_args: function(){ + return {'addr_host' : $scope.addr_host, + 'port_list': port_list}; + } + } + }); + }; }); // modals controllers @@ -592,4 +605,70 @@ mumApp.controller('ModalConfirmDeleteInstanceCtrl', function ($scope, $rootScope $scope.cancel = function () { $modalInstance.close(); }; +}); + +mumApp.controller('ModalPortConfigInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, $timeout, port_config_args) { + $scope.port_config_args = port_config_args; /* + { 'addr_host': str, + 'port_list': [{'portname':str, 'portid':int}, ...] + } + */ + + $scope.new_portname = null; + + $scope.new_portid = null; + + $scope.remove_port = function(port_dict){ + var i = 0; + var port_found = false; + while(i<$scope.port_config_args.port_list.length && !port_found){ + if($scope.port_config_args.port_list[i].portname == port_dict.portname && + $scope.port_config_args.port_list[i].portid == port_dict.portid){ + port_found = true; + $scope.port_config_args.port_list.splice(i, 1); + } + i++; + } + }; + + $scope.add_port = function(){ + var i = 0; + var port_found = false; + while(i<$scope.port_config_args.port_list.length && !port_found){ + if($scope.port_config_args.port_list[i].portname == $scope.new_portname && + $scope.port_config_args.port_list[i].portid == $scope.new_portid){ + port_found = true; + } + i++; + } + if(!port_found){ + // avoiding the same value twice in the list + var new_dict_port = {}; + new_dict_port['portname'] = $scope.new_portname; + new_dict_port['portid'] = $scope.new_portid; + $scope.port_config_args.port_list.push(new_dict_port); + $scope.new_portname = null; + $scope.new_portid = null; + } + } + + $scope.ok = function () { + var args = {}; + args['attribute'] = 'openports'; + args['addr_host'] = $scope.port_config_args.addr_host; + args['new_value'] = $scope.port_config_args.port_list; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_nmap_attribute', 'args': args}})); + }; + + $scope.$on("resCall", function (event, args) { + if(args.func == 'update_nmap_attribute'){ + $route.reload(); + $modalInstance.close(); + } + }); + + $scope.cancel = function () { + $modalInstance.close(); + $route.reload(); + }; }); \ No newline at end of file diff --git a/views/hostpage.html b/views/hostpage.html index 24aa4e2..9a5e32c 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -79,6 +79,12 @@ ng-click="update_nmap_attribute('hostname', model.new_hostname)" ng-disabled="model.new_hostname==''">Correct hostname</button> </td> + <td ng-show="(key == 'openports')"> + <button type="button" class="btn btn-primary btn-xs" + ng-click="open_modal_port_config(val)"> + Add/remove detected ports + </button> + </td> </tr> </table> </accordion-group> @@ -347,4 +353,66 @@ ng-click="ok()">Delete this host</button> </div> </script> + + <script type="text/ng-template" id="modal_port_config.html"> + <div class="modal-header"> + <h3 class="modal-title">Add or delete the ports detected</h3> + </div> + <div class="modal-body"> + {{port_config_args.port_list}} + <table class="table table-condensed table-hover"> + <thead> + + <tr> + <th>Portname </th> + <th>Portid </th> + </tr> + </thead> + + <tbody> + <tr ng-repeat="port_dict in port_config_args.port_list"> + <td>{{port_dict.portname}}</td> + <td>{{port_dict.portid}}</td> + <td> + <button type="button" + class="btn btn-danger" + aria-label="Remove port" + ng-click="remove_port(port_dict)"> + <span class="glyphicon glyphicon-minus" aria-hidden="true"></span> + </button> + </td> + </tr> + </tbody> + </table> + <div class="row"> + <div class="col-xs-3"> + <label for="new_portname">Port name</label> + <input type="text" class="form-control" id="new_portname" + ng-model="new_portname"> + </div> + <div class="col-xs-3"> + <label for="new_portid">Port number</label> + <input type="number" min="0" max="65535" class="form-control" id="new_portid" + ng-model="new_portid"> + </div> + <div class="col-xs-3"> + <label for="add_port_btn">Add a new port</label> + <button type="button" + class="btn btn-success" + aria-label="Add port" + id="add_port_btn" + ng-click="add_port()" + ng-disabled="new_portname == null || new_portid == null"> + <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> + </button> + </div> + </div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" + ng-click="cancel()">Discard</button> + <button type="button" class="btn btn-primary" + ng-click="ok()">Save changes</button> + </div> + </script> </div> \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm