branch develop updated (0251b6b -> 598bc58)
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 0251b6b scan conf can contain informations about the options + changes on scanpage new 598bc58 angular-ui-select dependency added + group tagging on dashboard 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 598bc5891869d7fc509683e78d798cb593ad46e9 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Mon Jun 1 11:47:55 2015 +0200 angular-ui-select dependency added + group tagging on dashboard Summary of changes: bower.json | 4 ++- mum.conf | 2 +- static/js/controllers/dashboardCtrl.js | 35 +++++++++++++++++++++- static/js/controllers/headCtrl.js | 6 +++- static/js/mumApp.js | 35 ++++++++++++++++++++-- views/dashboard.html | 53 ++++++++++++++++++++++++++++------ views/index.html | 14 +++++++++ 7 files changed, 134 insertions(+), 15 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 598bc5891869d7fc509683e78d798cb593ad46e9 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Mon Jun 1 11:47:55 2015 +0200 angular-ui-select dependency added + group tagging on dashboard --- bower.json | 4 ++- mum.conf | 2 +- static/js/controllers/dashboardCtrl.js | 35 +++++++++++++++++++++- static/js/controllers/headCtrl.js | 6 +++- static/js/mumApp.js | 35 ++++++++++++++++++++-- views/dashboard.html | 53 ++++++++++++++++++++++++++++------ views/index.html | 14 +++++++++ 7 files changed, 134 insertions(+), 15 deletions(-) diff --git a/bower.json b/bower.json index de2f50b..f6eac69 100644 --- a/bower.json +++ b/bower.json @@ -8,7 +8,9 @@ "angular-route": "~1.2.28", "angular-bootstrap": "~0.12.1", "angular-file-upload": "~1.1.5", - "angular-charts": "~0.2.7" + "angular-charts": "~0.2.7", + "angular-ui-select": "~0.12.0", + "angular-sanitize": "1.2.28" }, "resolutions": { "angular": "~1.2.28", diff --git a/mum.conf b/mum.conf index ffaef3a..8dcfdc1 100644 --- a/mum.conf +++ b/mum.conf @@ -7,7 +7,7 @@ smtp_server= smtp_port= smtp_address= -#scan=Scan name|Scan description|Priority|Scan options +#scan=Scan name|Scan description|Priority|Nmap parameter options scan=Complete scan and detection|This scan is the most complete but the longest one. Recommended for commom server monitoring. Time necessary: from a minute to several hours depending of the host.|1|-sU -sS -p U:161,T:1-65535 -A -Pn scan=Scan only|This option is less intrusive without detection. It will only verify the open ports. Note that you will have to indicate manually the OS of the machine later. Recommended for specific machines like printers. Time necessary: several minutes.|2|-sU -sS -p U:161,T:1-65535 -Pn scan=Quick scan and detection|This scan will verify only the 100 most common ports, and will try to detect the OS of the machine. Time necessary: several minutes.|3|-sU -sS -F -O -Pn diff --git a/static/js/controllers/dashboardCtrl.js b/static/js/controllers/dashboardCtrl.js index 073616f..f0b4f79 100644 --- a/static/js/controllers/dashboardCtrl.js +++ b/static/js/controllers/dashboardCtrl.js @@ -1,4 +1,4 @@ -mumApp.controller('dashboardCtrl', function ($scope, $routeParams, $location, DataHosts) { +mumApp.controller('dashboardCtrl', function ($scope, $routeParams, $location, $rootScope, DataHosts) { $scope.param = $routeParams.param; // parameter in URL, null if none /*$scope.sort = { @@ -30,6 +30,12 @@ mumApp.controller('dashboardCtrl', function ($scope, $routeParams, $location, Da $scope.items = DataHosts.Items; }); + $scope.$on("resCall", function (event, args) { + if (args.func == 'remove_host_list_to_group' || args.func == 'add_host_list_to_group') { + $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_HOSTS": ""})); + } + }); + $scope.addr_filter = ''; // input field $scope.name_filter = ''; // input field @@ -80,4 +86,31 @@ mumApp.controller('dashboardCtrl', function ($scope, $routeParams, $location, Da } return res; }; + + $scope.update_group = function(addr_host, grp_list){ + alert(grp_list); + }; + + $scope.rem_host_to_group = function(addr_host, grp_name){ + if(grp_name != 'all'){ + var args = {}; + args['host_list'] = [addr_host]; + args['group'] = grp_name; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'remove_host_list_to_group','args': args}})); + } + else{ + $rootScope.$broadcast("popup_warning", "Hosts must be part of 'all' group.") + $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_HOSTS": ""})); + } + }; + + $scope.add_host_to_group = function(addr_host, grp_name){ + if(grp_name != 'all'){ + var args = {}; + args['host_list'] = [addr_host]; + args['group'] = grp_name; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'add_host_list_to_group','args': args}})); + } + }; + }); \ No newline at end of file diff --git a/static/js/controllers/headCtrl.js b/static/js/controllers/headCtrl.js index 7e363f0..02b7079 100644 --- a/static/js/controllers/headCtrl.js +++ b/static/js/controllers/headCtrl.js @@ -41,6 +41,10 @@ mumApp.controller('headCtrl', function ($scope, $rootScope, toastr, $interval, $ ws.send(args); }); + $scope.$on("popup_warning", function(event, args){ + $scope.pop_warning('Warning', args) + }); + ws.onmessage = function (evt) { // actions effectuees lors de la reception d'un message via la websocket var obj = JSON.parse(evt.data); for (key in obj) { @@ -130,7 +134,7 @@ mumApp.controller('headCtrl', function ($scope, $rootScope, toastr, $interval, $ }; $scope.pop_warning = function (title, msg) { - toastr.success(msg, title); + toastr.warning(msg, title); }; $scope.pop_danger = function (title, msg) { diff --git a/static/js/mumApp.js b/static/js/mumApp.js index 70080ee..1b50757 100644 --- a/static/js/mumApp.js +++ b/static/js/mumApp.js @@ -1,4 +1,4 @@ -var mumApp = angular.module('mumApp', ['angularFileUpload', 'angularCharts', 'ngRoute', 'ui.bootstrap', 'toastr']); +var mumApp = angular.module('mumApp', ['angularFileUpload', 'angularCharts', 'ngRoute', 'ui.bootstrap', 'toastr', 'ui.select', 'ngSanitize']); mumApp.factory('DataHosts', function () { return {Items: []}; @@ -107,4 +107,35 @@ return function (items, filterOn) { } return items; }; -}); \ No newline at end of file +}); + +mumApp.filter('propsFilter', function() { + return function(items, props) { + var out = []; + + if (angular.isArray(items)) { + items.forEach(function(item) { + var itemMatches = false; + + var keys = Object.keys(props); + for (var i = 0; i < keys.length; i++) { + var prop = keys[i]; + var text = props[prop].toLowerCase(); + if (item[prop].toString().toLowerCase().indexOf(text) !== -1) { + itemMatches = true; + break; + } + } + + if (itemMatches) { + out.push(item); + } + }); + } else { + // Let the output be the input untouched + out = items; + } + + return out; + } +}); diff --git a/views/dashboard.html b/views/dashboard.html index db81440..75c51c7 100644 --- a/views/dashboard.html +++ b/views/dashboard.html @@ -3,6 +3,8 @@ <h1 class="page-header">Dashboard</h1> <h2 class="sub-header">Hosts currently on monitoring</h2> + <!-- Host view --> + <div class="row" ng-show="items.length > 0"> @@ -34,7 +36,7 @@ <select class="form-control input-sm" id="group_f" ng-model="group_filter" - ng-options="item for item in allGroups() | unique:'group'"> + ng-options="group for group in allGroups() | unique:'group'"> </select> </div> @@ -50,20 +52,53 @@ </thead> <tbody> - <tr ng-repeat="item in items | + <tr ng-repeat="host in items | orderBy:order_val | filter:{addr:addr_filter, name:name_filter, group:group_filter} | filter:filtering_status" - class={{item.status}}> <!-- group.name:group_filter --> - <td><a href="#/hostpage/{{item.addr}}">{{item.addr}}</a></td> - <td>{{item.name}}</td> - <td>warning : {{item.warning}}<br/> - danger : {{item.danger}}</td> - <td>{{item.group}}</td> - <td>{{item.last_check.split('.')[0]}}</td> + class={{host.status}}> <!-- group.name:group_filter --> + <td><a href="#/hostpage/{{host.addr}}">{{host.addr}}</a></td> + <td>{{host.name}}</td> + <td>warning : {{host.warning}}<br/> + danger : {{host.danger}}</td> + <td> + <ui-select multiple + tagging="tag_transform" + tagging-label="" + ng-model="host.group" + theme="bootstrap" + sortable="true" + ng-disabled="disabled" + style="width: 300px;" + title="Add or remove to a group" + on-remove="rem_host_to_group(host.addr, $item)" + on-select="add_host_to_group(host.addr, $item)"> + <ui-select-match placeholder="Add to group...">{{$item}}</ui-select-match> + <ui-select-choices repeat="group in allGroups() | filter:$select.search"> + {{group}} + </ui-select-choices> + </ui-select> + </td> + <!--<td>{{host.group}}</td>--> + <td>{{host.last_check.split('.')[0]}}</td> </tr> </tbody> </table> + <a href="#scan"> + <button type="button" class="btn btn-success" aria-label="Add host" + popover-placement="top" + popover="Add a machine" + popover-trigger="mouseenter"> + <span class="glyphicon glyphicon-plus" aria-hidden="true"> + </span> + </button> + </a> + </div> + + <!-- Group view --> + + <div> + </div> <div ng-show="items.length == 0"> diff --git a/views/index.html b/views/index.html index 6f03c58..be0f454 100644 --- a/views/index.html +++ b/views/index.html @@ -16,6 +16,7 @@ <!-- Custom styles for this template --> <link href="static/css/dashboard.css" rel="stylesheet"> <link href="bower_components/angular-toastr/dist/angular-toastr.min.css" rel="stylesheet"/> + <link href="bower_components/angular-ui-select/dist/select.min.css" rel="stylesheet"/> <!-- AngularJS --> <script src="bower_components/angular/angular.min.js"></script> @@ -26,6 +27,8 @@ <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script> <script src="bower_components/d3/d3.min.js"></script> <script src="bower_components/angular-charts/dist/angular-charts.min.js"></script> + <script src="bower_components/angular-ui-select/dist/select.min.js"></script> + <script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script> <script src="static/js/mumApp.js"></script> @@ -65,6 +68,17 @@ <p class="navbar-text navbar-left"><a href="#dashboard/warning" style="color:orange">Warning : {{stateNumber()[2]}}</a></p> <p class="navbar-text navbar-left"><a href="#dashboard/danger" style="color:red">KO : {{stateNumber()[3]}}</a></p> <p class="navbar-text navbar-left"><a href="#dashboard/idling" style="color:grey">Idling : {{stateNumber()[4]}}</a></p> + <p class="navbar-text navbar-left"> + <a href="#scan"> + <button type="button" class="btn btn-success btn-xs" aria-label="Add host" + popover-placement="bottom" + popover="Add a machine" + popover-trigger="mouseenter"> + <span class="glyphicon glyphicon-plus" aria-hidden="true"> + </span> + </button> + </a> + </p> <p class="navbar-text navbar-left" style="colod:white" ng-show="task_list.length > 0" -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm