branch develop updated (7b9d4f3 -> fc9ba1a)
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 7b9d4f3 routing is now managed with angularjs (index.html is main template) new fc9ba1a changing a page doesn't close websocket anymore + scan page fixed (now use the same controller as other pages) 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 fc9ba1a26e82840b7ce078f6cd44fd943d61ed4b Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue Feb 24 10:28:54 2015 +0100 changing a page doesn't close websocket anymore + scan page fixed (now use the same controller as other pages) Summary of changes: static/js/controllers/detectCtrl.js | 79 ------------------------------------- static/js/controllers/mainCtrl.js | 41 +++++++++++-------- views/index.html | 2 + views/scan.html | 2 +- 4 files changed, 28 insertions(+), 96 deletions(-) delete mode 100644 static/js/controllers/detectCtrl.js -- 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 fc9ba1a26e82840b7ce078f6cd44fd943d61ed4b Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue Feb 24 10:28:54 2015 +0100 changing a page doesn't close websocket anymore + scan page fixed (now use the same controller as other pages) --- static/js/controllers/detectCtrl.js | 79 ------------------------------------- static/js/controllers/mainCtrl.js | 41 +++++++++++-------- views/index.html | 2 + views/scan.html | 2 +- 4 files changed, 28 insertions(+), 96 deletions(-) diff --git a/static/js/controllers/detectCtrl.js b/static/js/controllers/detectCtrl.js deleted file mode 100644 index 344182f..0000000 --- a/static/js/controllers/detectCtrl.js +++ /dev/null @@ -1,79 +0,0 @@ -var formExample = angular.module('detectModule', ['toastr']); - -formExample.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); - } -}]); diff --git a/static/js/controllers/mainCtrl.js b/static/js/controllers/mainCtrl.js index 9ca081e..dc7c4f2 100644 --- a/static/js/controllers/mainCtrl.js +++ b/static/js/controllers/mainCtrl.js @@ -1,54 +1,43 @@ -var mumApp = angular.module('mumApp', ['ngRoute']); +var mumApp = angular.module('mumApp', ['ngRoute', 'toastr']); mumApp.config(function($routeProvider){ $routeProvider .when('/',{ templateUrl : 'dashboard.html', - controller : 'mainController' }) .when('/dashboard',{ templateUrl : 'dashboard.html', - controller : 'mainController' }) .when('/groups',{ templateUrl : 'groups.html', - controller : 'mainController' }) .when('/hostpage',{ templateUrl : 'hostpage.html', - controller : 'mainController' }) .when('/notifications',{ templateUrl : 'notifications.html', - controller : 'mainController' }) .when('/profile',{ templateUrl : 'profile.html', - controller : 'mainController' }) .when('/scan',{ templateUrl : 'scan.html', - controller : 'DetectController' }) .when('/settings',{ templateUrl : 'settings.html', - controller : 'mainController' }) .when('/signin',{ templateUrl : 'signin.html', - controller : 'mainController' }) .when('/stats',{ templateUrl : 'stats.html', - controller : 'mainController' }) .when('/users',{ templateUrl : 'users.html', - controller : 'mainController' }) }); -mumApp.controller('mainController', function ($scope, $filter) { +mumApp.controller('mainController', ['$scope', 'toastr', '$interval', '$filter', function($scope, toastr, $interval, $filter) { // init $scope.sort = { @@ -75,6 +64,20 @@ mumApp.controller('mainController', function ($scope, $filter) { $scope.grp = "all"; + // Concerning the scan form + + $scope.ip_range = "" // 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 = {}; + + $scope.post_val = function(){ //lace la detection apres remplissage du champ et validation du formulaire + var request = '{"10" : "' + $scope.ip_range + '"}'; + ws.send(request); + } + + // Concerning WebSocket var ws = new WebSocket("ws://0.0.0.0:1337/websocket"); ws.onopen = function() { @@ -82,11 +85,15 @@ mumApp.controller('mainController', function ($scope, $filter) { ws.send(request); }; - // actions effectuees lors de la reception d'un message via la websocket - ws.onmessage = function (evt) { + + ws.onmessage = function (evt) { // actions effectuees lors de la reception d'un message via la websocket 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; @@ -139,6 +146,8 @@ mumApp.controller('mainController', function ($scope, $filter) { toastr.error(msg, title); }; + + // Concerning the table manipulation var searchMatch = function (haystack, needle) { if (!needle) { return true; @@ -266,7 +275,7 @@ mumApp.controller('mainController', function ($scope, $filter) { item.Selected = $scope.selectedAll; }); }; -}); +}]); mumApp.controller('DetectController', ['$scope', 'toastr', '$interval', function($scope, toastr, $interval) { $scope.master = {}; diff --git a/views/index.html b/views/index.html index eab9323..35b0712 100644 --- a/views/index.html +++ b/views/index.html @@ -15,8 +15,10 @@ <!-- 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"/> <script src="bower_components/angular/angular.min.js"></script> + <script src="bower_components/angular-toastr/dist/angular-toastr.min.js"></script> <script src="bower_components/angular-route/angular-route.min.js"></script> <script src="static/js/controllers/mainCtrl.js"></script> diff --git a/views/scan.html b/views/scan.html index 5c9ecdc..0618a35 100644 --- a/views/scan.html +++ b/views/scan.html @@ -4,7 +4,7 @@ <div ng-show="validated == false" class="ng-hide"> <form class="form-inline" ng_submit="post_val()"> <label for="input_ip_range">IP range to scan (example : 198.116.0.1-10)</label> - <input type="ip_range" class="form-control" id="input_ip_range" ng-model="ip_range" placeholder="198.116.0.1-10"/> + <input type="ip_range" class="form-control" id="input_ip_range" ng-model="ip_range"/> <button type="submit" class="btn btn-primary" ng-click="validated = true">Scan now</button> </form> </div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm