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 b88b55e16f189e1ca44dffa10ad322bafe2f982b Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue Feb 24 17:54:20 2015 +0100 clicking on status on the navbar now puts the right status filter --- static/js/controllers/mainCtrl.js | 92 +++++---------------------------------- views/dashboard.html | 6 +-- views/index.html | 8 ++-- 3 files changed, 17 insertions(+), 89 deletions(-) diff --git a/static/js/controllers/mainCtrl.js b/static/js/controllers/mainCtrl.js index 6762f89..5a29c00 100644 --- a/static/js/controllers/mainCtrl.js +++ b/static/js/controllers/mainCtrl.js @@ -10,6 +10,10 @@ mumApp.config(function($routeProvider){ templateUrl : 'dashboard.html', controller : 'mainController' }) + .when('/dashboard/:param',{ + templateUrl : 'dashboard.html', + controller : 'mainController' + }) .when('/groups',{ templateUrl : 'groups.html', controller : 'mainController' @@ -73,7 +77,14 @@ mumApp.controller('mainController', ['$scope', 'toastr', '$interval', '$filter', $scope.addr_filter = ''; $scope.name_filter = ''; - $scope.status_filter = ''; + + if($routeParams.param == null){ + $scope.status_filter = ''; + } + else{ + $scope.status_filter = $routeParams.param; + } + $scope.group_filter = ''; $scope.items = []; @@ -295,85 +306,6 @@ mumApp.controller('mainController', ['$scope', 'toastr', '$interval', '$filter', }; }]); -mumApp.controller('DetectController', ['$scope', 'toastr', '$interval', function($scope, toastr, $interval) { - $scope.master = {}; - $scope.ip_range = "198.116.0.1-10" // la plage d'ip entree dans le champ - $scope.state = ""; // l'etat general du scan en cours - $scope.validated = false; // pour afficher ou non certaines parties de la page - $scope.scan_is_over = false; // pour afficher ou non certaines parties de la page - $scope.ip_scanned = {}; - var ws = new WebSocket("ws://0.0.0.0:1337/websocket"); - - /*ws.onopen = function() { - ws.send("Hello, world"); - };*/ - - // actions effectuees lors de la reception d'un message via la websocket - ws.onmessage = function (evt) { - JSON.parse(evt.data, function (key, value) { - switch(parseInt(key)){ - case 20: // Success of a module execution - $scope.$apply(function(){ - $scope.state = "Success!"; - $scope.ip_scanned = value; - }); - toastr.success(value, "Success on module execution"); - case 21: // Informations concerning one host - break; - case 22: // List of hosts under monitoring - break; - case 30: - $scope.$apply(function(){ - $scope.state = value; - }); - toastr.info(value, "Current status is :"); - /* - $scope.$apply(function(){ - $scope.state = value - });*/ - break; - case 31: - params = value.split(','); - if(params[0]=='success'){ - $scope.pop_success("Success on " + params[1], params[2]); - } - else if(params[0] == 'warning'){ - $scope.pop_warning("Warning on " + params[1], params[2]); - } - else if(params[0] == 'danger'){ - $scope.pop_danger("Danger on "+ params[1], params[2]); - } - break; - case 40: - toastr.error(value, "Server error"); - break; - default: - break; - } - }); - - }; - - $scope.pop_success = function(title, msg){ - toastr.success(msg, title); - }; - - $scope.pop_warning = function(title, msg){ - toastr.success(msg, title); - }; - - $scope.pop_danger = function(title, msg){ - toastr.error(msg, title); - }; - - //lace la detection apres remplissage du champ et validation du formulaire - $scope.post_val = function(){ - var request = '{"10" : "' + $scope.ip_range + '"}'; - ws.send(request); - } -}]); - - mumApp.$inject = ['$scope', '$filter']; mumApp.directive("customSort", function() { diff --git a/views/dashboard.html b/views/dashboard.html index c7e739b..d405482 100644 --- a/views/dashboard.html +++ b/views/dashboard.html @@ -23,11 +23,7 @@ </div> <div class="col-xs-2"> <label for="group_f">Group filter</label> - <select class="form-control input-sm" id="group_f" ng-model="group_filter"> - <option>all</option> - <option>mygroup1</option> - <option>mygroup2</option> - <option>mygroup3</option> + <select class="form-control input-sm" id="group_f" ng-model="group_filter" ng-options="item for item in allGroups() | unique:'group'"> </select> </div> <table class="table table-condensed table-hover"> diff --git a/views/index.html b/views/index.html index 35b0712..bce6dea 100644 --- a/views/index.html +++ b/views/index.html @@ -41,13 +41,13 @@ <span class="icon-bar"></span> </button> <a class="navbar-brand" href="dashboard.html">Mum</a> - <p class="navbar-text navbar-left"><a href="dashboard.html" style="color:green">OK : {{stateNumber()[0]}}</a></p> - <p class="navbar-text navbar-left"><a href="dashboard.html" style="color:orange">Warning : {{stateNumber()[1]}}</a></p> - <p class="navbar-text navbar-left"><a href="dashboard.html" style="color:red">KO : {{stateNumber()[2]}}</a></p> + <p class="navbar-text navbar-left"><a href="#dashboard/success" style="color:green">OK : {{stateNumber()[0]}}</a></p> + <p class="navbar-text navbar-left"><a href="#dashboard/warning" style="color:orange">Warning : {{stateNumber()[1]}}</a></p> + <p class="navbar-text navbar-left"><a href="#dashboard/danger" style="color:red">KO : {{stateNumber()[2]}}</a></p> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> - <li><a href="profile.html">Profile</a></li> + <li><a href="#profile">Profile</a></li> <li><a href="signin.html">Logout</a></li> </ul> </div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.