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 350dcba6b3065fb304668d921798862f46e8edf6 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Mar 4 17:04:28 2015 +0100 frontend : passage du javascript de bootstrap (qui nécessite JQuery) à un AngularJS bootstrap (pour les modals, accordion, etc.) hostpage : affichage de la conf d'un module --- app/app.py | 9 +- app/module_loader.py | 31 +- app/modules/storage_modules/shelve_db.py | 50 ++- bower.json | 3 +- conf.txt | 2 + static/css/dashboard.css | 2 + static/js/controllers/dashboardCtrl.js | 19 +- static/js/controllers/headCtrl.js | 14 +- static/js/controllers/hostPageCtrl.js | 76 +++- static/js/mumApp.js | 16 +- views/hostpage.html | 597 ++++++++++++++++--------------- views/index.html | 22 +- 12 files changed, 516 insertions(+), 325 deletions(-) diff --git a/app/app.py b/app/app.py index 8745224..b8dfe5c 100755 --- a/app/app.py +++ b/app/app.py @@ -16,11 +16,12 @@ DETECTION_DEMAND = "11" MONITORING_DEMAND = "12" HOST_INFO_DEMAND = "13" GET_HOSTS_DEMAND = "14" -CONF_CHANGE_DEMAND = "15" +CALL_FUNC_DB = "15" SUCCESS_MODULE = "20" INFO_HOST = "21" GET_HOSTS_RESPONSE = "22" +RES_CALL_FUNC_DB = "23" CURRENT_STATE_INFO = "30" BROWSER_NOTIFICATION = "31" @@ -147,6 +148,12 @@ def receive(ws): db = module_loader.load_db() ws.send(json.dumps({INFO_HOST: db.get_host_informations(msg[HOST_INFO_DEMAND])})) del db + elif code == CALL_FUNC_DB: + res = module_loader.launch_db_function(msg[CALL_FUNC_DB]) + if res is not None: + ws.send(json.dumps({RES_CALL_FUNC_DB: res})) + else: + print 'res is None' else: break except: # Should be WebSocketError when closing the connection diff --git a/app/module_loader.py b/app/module_loader.py index b232840..f0e9bfd 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -10,6 +10,8 @@ import modules.HostNotFoundException import json import re +import pkgutil +import sys """ Loads dynamically modules from packages connection_modules, detection_modules, monitoring_modules, storage_modules. @@ -84,7 +86,7 @@ def run_all_detection_modules(os, conn, db, ws): ws.send(json.dumps({"40": cnfe.__str__()})) -def run_all_monitoring_modules(os, conn, db, ws): +def run_all_monitoring_modules():#os, conn, db, ws): """ Instanciates and runs every monitoring_modules listed in the __init__.py file of the package corresponding to the operating system entered in parameters. @@ -93,6 +95,15 @@ def run_all_monitoring_modules(os, conn, db, ws): :param db: an instance of a storage module :param ws: a websocket connection if the function have been called from a client. Is None otherwise """ + mod_list = [] + for importer, package_name, _ in pkgutil.iter_modules(["modules/monitoring_modules/"]): + full_package_name = "modules/monitoring_modules." + package_name + if full_package_name not in sys.modules: + mod = importer.find_module(package_name).load_module(full_package_name) + mod_list.append(mod) + return mod_list + +""" __import__("modules.monitoring_modules." + os) pack_mod_os = __import__("modules.monitoring_modules." + os, fromlist=modules.monitoring_modules.__all__) for mod_name in pack_mod_os.__all__: @@ -108,6 +119,7 @@ def run_all_monitoring_modules(os, conn, db, ws): print cnfe.__str__() if ws is not None: ws.send(json.dumps({"40": cnfe.__str__()})) +""" def run_one_monitoring_module(mod_name, addr_host, os, conn, db, ws): @@ -196,4 +208,19 @@ def get_all_monitoring_instructions(db): for addr_host in db.get_list_addr_hosts(): for instr in db.get_monitoring_instructions(addr_host): res.append(instr) - return res \ No newline at end of file + return res + + +def launch_db_function(dict_instr): + """ + Calls a function of the database with the parametters sent. Used to each function which is not module dependant : + remove host, create/remove group, add/remove to group, save settings, etc. + :param dict_instr: a dictionary containing : + { + "func" : func_name, + "args" : [arg1, ...] + } + :return: the result of the called function. Or None if the function does not returns a value. + """ + db = load_db() + return getattr(db, dict_instr['func'])(dict_instr['args']) \ No newline at end of file diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 361cb1b..5439e1d 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -39,9 +39,6 @@ class shelve_db: self.db.close() self.db = None - # Add and save a new host after its first nmap detection - # It also preconfigure with the default configuration, add the host to the group "all" and - # creates empty structures for the monitoring and archive data. def add_host(self, addr_host, nmap_res, list_mod_conn, dict_mod_info): """ Called by the nmap_detection module. @@ -389,6 +386,53 @@ class shelve_db: finally: self.close_db() + def get_conf_mod(self, args):#, mod_name): + """ + Returns a structure containing informations about the settings of a monitoring module. + :param args: a list containing the arguments : + {'addr_host': val, 'mod_name':val] + :return: a structure containing : + { + 'unit' : val, // the unit of the value + 'minor_limit' : val, + 'major_limit' : val, + 'freq' : val + } + """ + addr_host = args['addr_host'] + mod_name = args['mod_name'] + self.open_db() + res = {} + try: + res['unit'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['unit'] + res['minor_limit'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['minor_limit'] + res['major_limit'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['major_limit'] + res['freq'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['check_frequency'] + except Exception as e: + print e.__str__() + finally: + self.close_db() + return json.dumps(res) + + def set_conf_mod(self, addr_host, mod_name, data): + """ + Save a new configuration for a monitoring module + :param addr_host: the IP address of the host + :param mod_name: the name of the module + :param data: a structure containing the new values : + { + 'minor_limit' : val, + 'major_limit' : val + } + """ + self.open_db() + try: + self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['minor_limit'] = data['minor_limit'] + self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['major_limit'] = data['major_limit'] + self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['check_frequency'] = data['freq'] + finally: + self.close_db() + def add_check(self, addr_host, mod_name, val): """ Called by a monitoring module. diff --git a/bower.json b/bower.json index d0d8be9..542acde 100644 --- a/bower.json +++ b/bower.json @@ -6,6 +6,7 @@ "angular-latest": "~1.3.9", "angular": "~1.3.13", "angular-toastr": "~0.5.2", - "angular-route": "~1.3.13" + "angular-route": "~1.3.13", + "angular-bootstrap": "~0.12.1" } } diff --git a/conf.txt b/conf.txt new file mode 100644 index 0000000..1077e84 --- /dev/null +++ b/conf.txt @@ -0,0 +1,2 @@ +db_location=~/mum.db +external_modules_location=~/external/ \ No newline at end of file diff --git a/static/css/dashboard.css b/static/css/dashboard.css index c958c18..c85aa71 100644 --- a/static/css/dashboard.css +++ b/static/css/dashboard.css @@ -1,3 +1,5 @@ +.nav, .pagination, .carousel, .panel-title a { cursor: pointer; } + /* * Base structure */ diff --git a/static/js/controllers/dashboardCtrl.js b/static/js/controllers/dashboardCtrl.js index 31c9e33..f09c76d 100644 --- a/static/js/controllers/dashboardCtrl.js +++ b/static/js/controllers/dashboardCtrl.js @@ -10,6 +10,8 @@ mumApp.controller('dashboardCtrl', function($scope, $filter, $routeParams, DataH $scope.items = DataHosts.Items; + + $scope.$on("hostsUpdate", function (event) { $scope.items = DataHosts.Items; }); @@ -36,11 +38,6 @@ mumApp.controller('dashboardCtrl', function($scope, $filter, $routeParams, DataH $scope.grp = "all"; - $scope.toto = function(){ - $scope.items = DataHosts.Items; - alert(DataHosts.Items[0].status); - }; - // Concerning the table manipulation var searchMatch = function (haystack, needle) { if (!needle) { @@ -138,4 +135,16 @@ mumApp.controller('dashboardCtrl', function($scope, $filter, $routeParams, DataH } return res; }; + + $scope.checkAll = function(){ + if($scope.selectedAll){ + $scope.selectedAll = true; + } + else{ + $scope.selectedAll = false; + } + angular.forEach($scope.items, function(item){ + item.Selected = $scope.selectedAll; + }); + }; }); \ No newline at end of file diff --git a/static/js/controllers/headCtrl.js b/static/js/controllers/headCtrl.js index 8366485..1a1e748 100644 --- a/static/js/controllers/headCtrl.js +++ b/static/js/controllers/headCtrl.js @@ -39,6 +39,9 @@ mumApp.controller('headCtrl', function($scope, $rootScope, toastr, $interval, $r $scope.items = DataHosts.Items; }); break; + case 23: // Get a result after calling a funcion on the db + $rootScope.$broadcast("resCall", JSON.parse(value)); + break; case 30: $scope.$apply(function(){ $scope.state = value; @@ -103,15 +106,4 @@ mumApp.controller('headCtrl', function($scope, $rootScope, toastr, $interval, $r return res; }; - $scope.checkAll = function(){ - if($scope.selectedAll){ - $scope.selectedAll = true; - } - else{ - $scope.selectedAll = false; - } - angular.forEach($scope.items, function(item){ - item.Selected = $scope.selectedAll; - }); - }; }); \ No newline at end of file diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index ec4dce0..bab4040 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -1,4 +1,4 @@ -mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams) { +mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $modal) { $scope.host_informations = null; $scope.addr_host = $routeParams.param @@ -8,6 +8,15 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams) { $scope.custom_infos = ''; + $scope.get_addr_host = function(){ + return($scope.addr_host); + }; + + $scope.call_func = function(func, args){ + dict_instr = {'func': func, 'args': args}; + //$rootScope.$broadcast("sendViaWs", JSON.stringify({"15": dict_instr})); + }; + $scope.$on("hostInfos", function (event, args) { $scope.$apply(function(){ $scope.items = args; @@ -16,4 +25,69 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams) { }); + $scope.open = function (mod_name) { + var modalInstance = $modal.open({ + templateUrl: 'modal_conf_label.html', + controller: 'ModalConfInstanceCtrl', + resolve: { + conf_args: function(){ + return {'addr_host' : $scope.addr_host, 'mod_name': mod_name}; + } + } + }); + }; +}); + +// modals controllers + +mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalInstance, conf_args) { + $scope.conf_args = conf_args; // {'addr_host' : val, 'mod_name', val} + + $rootScope.$broadcast("sendViaWs", JSON.stringify({"15": {'func': 'get_conf_mod', 'args': conf_args}})); + + $scope.items = {} /* { + 'unit' : val, // the unit of the value + 'minor_limit' : val, + 'major_limit' : val, + 'freq' : val + } + */ + + $scope.freq = 0; + + $scope.minor_limit_percent = 0; + $scope.major_limit_percent = 0; + + $scope.minor_limit_unit = 0; + $scope.major_limit_unit = 0; + + $scope.limit_bool = 'minor'; + + $scope.$on("resCall", function (event, args) { + $scope.$apply(function(){ + $scope.items = args; + $scope.freq = args.freq; + if(args.unit == 'bool'){ + if(args.major_limit){ + $scope.limit_bool = 'major'; + } + } + else if(args.unit == '%'){ + $scope.minor_limit_percent = args.minor_limit; + $scope.major_limit_percent = args.major_limit; + } + else{ + $scope.minor_limit_unit = args.minor_limit; + $scope.major_limit_unit = args.major_limit; + } + }); + }); + + $scope.ok = function () { + $modalInstance.close($scope.selected.item); + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; }); \ No newline at end of file diff --git a/static/js/mumApp.js b/static/js/mumApp.js index e4dfd70..a3a0f4e 100644 --- a/static/js/mumApp.js +++ b/static/js/mumApp.js @@ -1,4 +1,4 @@ -var mumApp = angular.module('mumApp', ['ngRoute', 'toastr']); +var mumApp = angular.module('mumApp', ['ui.bootstrap', 'ngRoute', 'toastr']); mumApp.factory('DataHosts', function(){ return {Items: []}; @@ -20,18 +20,18 @@ mumApp.config(function($routeProvider){ }) .when('/groups',{ templateUrl : 'groups.html', - //controller : 'mainController' + controller : 'dashboardCtrl' }) .when('/hostpage/:param',{ templateUrl : 'hostpage.html', controller : 'hostPageCtrl' }) .when('/notifications',{ - templateUrl : 'notifications.html', + templateUrl : 'notifications.html' //controller : 'mainController' }) .when('/profile',{ - templateUrl : 'profile.html', + templateUrl : 'profile.html' //controller : 'mainController' }) .when('/scan',{ @@ -39,19 +39,19 @@ mumApp.config(function($routeProvider){ controller : 'scanCtrl' }) .when('/settings',{ - templateUrl : 'settings.html', + templateUrl : 'settings.html' //controller : 'mainController' }) .when('/signin',{ - templateUrl : 'signin.html', + templateUrl : 'signin.html' //controller : 'mainController' }) .when('/stats',{ - templateUrl : 'stats.html', + templateUrl : 'stats.html' //controller : 'mainController' }) .when('/users',{ - templateUrl : 'users.html', + templateUrl : 'users.html' //controller : 'mainController' }) .otherwise({ diff --git a/views/hostpage.html b/views/hostpage.html index 3469968..cc97937 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -4,7 +4,7 @@ <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#modal_block">Activate/Deactivate</button> <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#modal_conn">Connection settings</button> <button type="button" class="btn btn-info btn-xs">Launch a new detection</button> - <button type="button" class="btn btn-danger btn-xs">Remove this host</button> + <button type="button" class="btn btn-danger btn-xs" ng-click="call_func('remove_host', [addr_host])">Remove this host</button> {{host_informations}} <table class="table table-condensed table-hover"> <thead> @@ -23,322 +23,353 @@ <td>{{item.value}}</td> <td>{{item.state}}</td> <td>{{item.date}}</td> - <td><button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#modal_conf"> - Configure - </button> - </td> - <td><button type="button" class="btn btn-info btn-xs"> - Check now - </button> - </td> + <td><button type="button" class="btn btn-primary btn-xs" ng-click="open(itemname)">Configure</button></td> + <td><button type="button" class="btn btn-info btn-xs">Check now</button></td> </tr> </tbody> </table> - <h2>Detected Configuration</h2> - <!--<div ng-repeat-start="(modname, mod) in items.detected"> - <h3>{{modname}}</h3> - <table class="table table-bordered table-hover"> - <tbody> - <tr> - <th ng-repeat-end - ng-repeat="(key,val) in mod">{{key}}</th> - </tr> - </tbody> - </table> - {{mod}} - - </div>--> - <table class="table table-bordered table-hover"> - <tr ng-repeat-start="(modname, mod) in items.detected"> - <th>{{modname}}</th> - </tr> - <tr ng-repeat-end - ng-repeat="(key, val) in mod"> - <td>{{key}}</td> - <td>{{val}}</td> - </tr> - </table> - - - <h2>Custom informations</h2> - <label for="custom_info">Add any information here :</label> - <textarea class="form-control" rows="3" id="custom_info" ng-model="custom_infos"></textarea> - <button type="button" class="btn btn-info btn-xs">Save</button> - - <h2>Interventions done</h2> - <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#modal_interv">Add a new intervention</button> - <div ng-show="items.interventions != ''"> + <accordion close-others="false"> + <accordion-group heading="Detected Configuration"> <table class="table table-bordered table-hover"> - <thead> - <tr> - <th>Date </th> - <th>Person </th> - <th>Details </th> + <tr ng-repeat-start="(modname, mod) in items.detected"> + <th>{{modname}}</th> </tr> - </thead> - <tbody> - <tr ng-repeat="interv in items.interventions"> - <td>{{interv.date}}</td> - <td>{{interv.person}}</td> - <td>{{interv.details}}</td> + <tr ng-repeat-end + ng-repeat="(key, val) in mod"> + <td>{{key}}</td> + <td>{{val}}</td> </tr> - </tbody> </table> - </div> + </accordion-group> + <accordion-group heading="Custom informations"> + <label for="custom_info">Add any information here :</label> + <textarea class="form-control" rows="3" id="custom_info" ng-model="custom_infos"></textarea> + <button type="button" class="btn btn-info btn-xs">Save</button> + </accordion-group> + <accordion-group heading="Interventions done"> + <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#modal_interv">Add a new intervention</button> + <div ng-show="items.interventions != ''"> + <table class="table table-bordered table-hover"> + <thead> + <tr> + <th>Date </th> + <th>Person </th> + <th>Details </th> + </tr> + </thead> + <tbody> + <tr ng-repeat="interv in items.interventions"> + <td>{{interv.date}}</td> + <td>{{interv.person}}</td> + <td>{{interv.details}}</td> + </tr> + </tbody> + </table> + </div> + </accordion-group> + </accordion> - <div class="modal fade" id="modal_conf" tabindex="-1" role="dialog" aria-labelledby="modal_conf_label" aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="modal_conf_label">Configure</h4> - </div> - <div class="modal-body"> - <form> - <div class="form-group"> - <h3>HTTP</h3> - <label for="http_freq">Frequency check</label> - <select type="http_freq" class="form-control" id="http_freq"> - <option>Every minute</option> - <option selected>Every hour (default)</option> - <option>Every day</option> - </select> - </div> - </form> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> - <button type="button" class="btn btn-primary">Save changes</button> - </div> - </div> - </div> - </div> - - <div class="modal fade" id="modal_interv" tabindex="-1" role="dialog" aria-labelledby="modal_interv_label" aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> + <script type="text/ng-template" id="modal_conf_label.html"> <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="modal_interv_label">Add an intervention</h4> + <h3 class="modal-title">Configure</h3> </div> <div class="modal-body"> <form> <div class="form-group"> - <div class="row"> - <div class="col-xs-4"> - <label for="username">Person</label> - <input type="text" class="form-control" id="username" placeholder="G.G."> - </div> - <div class="col-xs-4"> - <label for="date">Date</label> - <input type="date" class="form-control" id="date" placeholder="2015-02-11"> + <h3>{{conf_args.mod_name}}</h3> + <label for="freq">Frequency check (d:hh:mm)</label> + <input type="text" class="form-control" id="freq" ng-model="freq"> + <div ng-show="items.unit == '%'"> + <label for="minor_%">Minor notification at {{minor_limit}}% of charge</label> + <input type="range" name="cpu_warn" min="0" max="99" id="minor_%" ng-model="minor_limit_percent"> + <label for="major_%">Major notification at {{major_limit}}% of charge</label> + <input type="range" name="cpu_danger" min="{{minor_limit}}" max="100" id="major_%" ng-model="major_limit_percent"> + </div> + <div ng-show="items.unit == 'bool'"> + <label for="minor_bool">If down, send a </label> + <div class="radio"> + <label> + <input type="radio" name="http_crit" id="minor_bool" value="minor" ng-model="limit_bool"> + minor notification + </label> </div> - <div class="col-xs-4"> - <label for="date">Time</label> - <input type="time" class="form-control" id="time" placeholder="16:28:00"> + <div class="radio"> + <label> + <input type="radio" name="http_crit" id="major_bool" value="major" ng-model="limit_bool"> + major notification + </label> </div> </div> - <label for="interv_detail">Details of this intervention</label> - <textarea class="form-control" rows="3" id="interv_detail"></textarea> + <div ng-show="items.unit != '%' && items.unit != 'bool'"> + <label for="minor_unit">Minor notif at {{items.unit}}</label> + <input type="number" class="form-control" id="minor_unit" min="0" ng-model="minor_limit_unit"> + <label for="maj_pack">Major notif at {{items.unit}}</label> + <input type="number" class="form-control" id="maj_pack" min="0" ng-model="major_limit_unit"> + </div> </div> </form> </div> <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> - <button type="button" class="btn btn-primary">Save changes</button> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="cancel()">Close</button> + <button type="button" class="btn btn-primary" ng-click="ok()">Save changes</button> </div> - </div> - </div> - </div> + </script> - <div class="modal fade" id="modal_conn" tabindex="-1" role="dialog" aria-labelledby="modal_conn_label" aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="modal_conn_label">Connection configuration</h4> + <!-- + <div class="modal fade" id="modal_conf" tabindex="-1" role="dialog" aria-labelledby="modal_conf_label" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="modal_conf_label">Configure</h4> + </div> + <div class="modal-body"> + <form> + <div class="form-group"> + <h3>HTTP</h3> + <label for="http_freq">Frequency check</label> + <select type="http_freq" class="form-control" id="http_freq"> + <option>Every minute</option> + <option selected>Every hour (default)</option> + <option>Every day</option> + </select> + </div> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> </div> - <div class="modal-body"> - <form> - <div class="form-group"> - <h3>Choose the priority of each avaliable connection</h3> - <table class="table table-bordered table-hover"> - <thead> - <tr> - <th>Protocol </th> - <th>Priority </th> - <th>Options </th> - </tr> - </thead> - <tbody> - <tr> - <td>SSH</td> - <td><input type="number" min="0" placeholder=1></td> - <td> - <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_conf_conn">Advanced configuration</button> - <button type="button" class="btn btn-success">Test</button> - </td> - - </tr> - <tr> - <td>SNMP</td> - <td><input type="number" min="0" placeholder=0 disabled></td> - <td> - <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_conf_conn">Advanced configuration</button> - <button type="button" class="btn btn-success">Test</button> - </td> - </tr> - <tr> - <td>Nagios</td> - <td><input type="number" min="0" placeholder=0 disabled></td> - <td> - <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_conf_conn">Advanced configuration</button> - <button type="button" class="btn btn-success">Test</button> - </td> - </tr> - </tbody> - </table> + <div class="modal fade" id="modal_interv" tabindex="-1" role="dialog" aria-labelledby="modal_interv_label" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="modal_interv_label">Add an intervention</h4> + </div> + <div class="modal-body"> + <form> + <div class="form-group"> + <div class="row"> + <div class="col-xs-4"> + <label for="username">Person</label> + <input type="text" class="form-control" id="username" placeholder="G.G."> + </div> + <div class="col-xs-4"> + <label for="date">Date</label> + <input type="date" class="form-control" id="date" placeholder="2015-02-11"> + </div> + <div class="col-xs-4"> + <label for="date">Time</label> + <input type="time" class="form-control" id="time" placeholder="16:28:00"> + </div> + </div> + <label for="interv_detail">Details of this intervention</label> + <textarea class="form-control" rows="3" id="interv_detail"></textarea> + </div> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> </div> - </form> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> - <button type="button" class="btn btn-primary">Save changes</button> + </div> </div> - </div> - </div> - </div> - <div class="modal fade bs-example-modal-lg" id="modal_conf_conn" tabindex="-1" role="dialog" aria-labelledby="modal_conf_conn_label" aria-hidden="true"> - <div class="modal-dialog modal-lg"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="modal_conf_conn_label">Advanced settings for SSH</h4> - </div> - <div class="modal-body"> - <div class="row"> - <div class="col-xs-2"> - <label for="port">Port used</label> - <input type="number" id="port" min="0" placeholder="22"> - </div> - </div> - <div class="row"> - <div class="col-xs-3"> - <label for="usrname">Login</label> - <input type="text" id="usrname" placeholder="mylogin"> - </div> - </div> - <div class="row"> - <div class="col-xs-3"> - <label for="publickey">Public key</label> - <select class="form-control" id="publickey"> - <option>mykey1</option> - <option>mykey2</option> - </select> + <div class="modal fade" id="modal_conn" tabindex="-1" role="dialog" aria-labelledby="modal_conn_label" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="modal_conn_label">Connection configuration</h4> + </div> + <div class="modal-body"> + <form> + <div class="form-group"> + <h3>Choose the priority of each avaliable connection</h3> + <table class="table table-bordered table-hover"> + <thead> + <tr> + <th>Protocol </th> + <th>Priority </th> + <th>Options </th> + </tr> + </thead> + <tbody> + <tr> + <td>SSH</td> + <td><input type="number" min="0" placeholder=1></td> + <td> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_conf_conn">Advanced configuration</button> + <button type="button" class="btn btn-success">Test</button> + </td> + + </tr> + <tr> + <td>SNMP</td> + <td><input type="number" min="0" placeholder=0 disabled></td> + <td> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_conf_conn">Advanced configuration</button> + <button type="button" class="btn btn-success">Test</button> + </td> + + </tr> + <tr> + <td>Nagios</td> + <td><input type="number" min="0" placeholder=0 disabled></td> + <td> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_conf_conn">Advanced configuration</button> + <button type="button" class="btn btn-success">Test</button> + </td> + </tr> + </tbody> + </table> + </div> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> </div> - <button type="button" class="btn btn-primary btn-xs">Add public key</button> - <button type="button" class="btn btn-danger btn-xs">Remove selected</button> </div> - <div class="row"> - <div class="col-xs-3"> - <label for="privatekey">Private key</label> - <select class="form-control" id="privatekey"> - <option>mypkey1</option> - <option>mypkey2</option> - </select> + </div> + + <div class="modal fade bs-example-modal-lg" id="modal_conf_conn" tabindex="-1" role="dialog" aria-labelledby="modal_conf_conn_label" aria-hidden="true"> + <div class="modal-dialog modal-lg"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="modal_conf_conn_label">Advanced settings for SSH</h4> + </div> + <div class="modal-body"> + <div class="row"> + <div class="col-xs-2"> + <label for="port">Port used</label> + <input type="number" id="port" min="0" placeholder="22"> + </div> + </div> + <div class="row"> + <div class="col-xs-3"> + <label for="usrname">Login</label> + <input type="text" id="usrname" placeholder="mylogin"> + </div> + </div> + <div class="row"> + <div class="col-xs-3"> + <label for="publickey">Public key</label> + <select class="form-control" id="publickey"> + <option>mykey1</option> + <option>mykey2</option> + </select> + </div> + <button type="button" class="btn btn-primary btn-xs">Add public key</button> + <button type="button" class="btn btn-danger btn-xs">Remove selected</button> + </div> + <div class="row"> + <div class="col-xs-3"> + <label for="privatekey">Private key</label> + <select class="form-control" id="privatekey"> + <option>mypkey1</option> + <option>mypkey2</option> + </select> + </div> + <button type="button" class="btn btn-primary btn-xs">Add private key</button> + <button type="button" class="btn btn-danger btn-xs">Remove selected</button> + </div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> </div> - <button type="button" class="btn btn-primary btn-xs">Add private key</button> - <button type="button" class="btn btn-danger btn-xs">Remove selected</button> </div> </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> - <button type="button" class="btn btn-primary">Save changes</button> - </div> - </div> - </div> - </div> - <div class="modal fade" id="modal_block" tabindex="-1" role="dialog" aria-labelledby="modal_block_label" aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="modal_block_label">Activate/Deactivate monitoring blocks</h4> - </div> - <div class="modal-body"> - <form> - <div class="form-group"> - <h3>Network</h3> - <button type="button" class="btn btn-defaule">Select all</button> - <button type="button" class="btn btn-defaule">Select none</button> - <table class="table table-bordered table-hover"> - <thead> - <tr> - <th>Part </th> - <th>Activated </th> - </tr> - </thead> - <tbody> - <tr> - <td>HTTP</td> - <td><input type="checkbox" value="http" checked></td> - </tr> - <tr> - <td>SMTP</td> - <td><input type="checkbox" value="smtp" checked></td> - </tr> - </tbody> - </table> - <h3>Hardware</h3> - <button type="button" class="btn btn-defaule">Select all</button> - <button type="button" class="btn btn-defaule">Select none</button> - <table class="table table-bordered table-hover"> - <thead> - <tr> - <th>Part </th> - <th>Activated </th> - </tr> - </thead> - <tbody> - <tr> - <td>CPU</td> - <td><input type="checkbox" value="http" checked></td> - </tr> - <tr> - <td>Drive</td> - <td><input type="checkbox" value="smtp" checked></td> - </tr> - </tbody> - </table> - <h3>Software</h3> - <button type="button" class="btn btn-defaule">Select all</button> - <button type="button" class="btn btn-defaule">Select none</button> - <table class="table table-bordered table-hover"> - <thead> - <tr> - <th>Part </th> - <th>Activated </th> - </tr> - </thead> - <tbody> - <tr> - <td>Packages updated</td> - <td><input type="checkbox" value="http"></td> - </tr> - </tbody> - </table> + <div class="modal fade" id="modal_block" tabindex="-1" role="dialog" aria-labelledby="modal_block_label" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="modal_block_label">Activate/Deactivate monitoring blocks</h4> + </div> + <div class="modal-body"> + <form> + <div class="form-group"> + <h3>Network</h3> + <button type="button" class="btn btn-defaule">Select all</button> + <button type="button" class="btn btn-defaule">Select none</button> + <table class="table table-bordered table-hover"> + <thead> + <tr> + <th>Part </th> + <th>Activated </th> + </tr> + </thead> + <tbody> + <tr> + <td>HTTP</td> + <td><input type="checkbox" value="http" checked></td> + </tr> + <tr> + <td>SMTP</td> + <td><input type="checkbox" value="smtp" checked></td> + </tr> + </tbody> + </table> + <h3>Hardware</h3> + <button type="button" class="btn btn-defaule">Select all</button> + <button type="button" class="btn btn-defaule">Select none</button> + <table class="table table-bordered table-hover"> + <thead> + <tr> + <th>Part </th> + <th>Activated </th> + </tr> + </thead> + <tbody> + <tr> + <td>CPU</td> + <td><input type="checkbox" value="http" checked></td> + </tr> + <tr> + <td>Drive</td> + <td><input type="checkbox" value="smtp" checked></td> + </tr> + </tbody> + </table> + <h3>Software</h3> + <button type="button" class="btn btn-defaule">Select all</button> + <button type="button" class="btn btn-defaule">Select none</button> + <table class="table table-bordered table-hover"> + <thead> + <tr> + <th>Part </th> + <th>Activated </th> + </tr> + </thead> + <tbody> + <tr> + <td>Packages updated</td> + <td><input type="checkbox" value="http"></td> + </tr> + </tbody> + </table> + </div> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> </div> - </form> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> - <button type="button" class="btn btn-primary">Save changes</button> + </div> </div> - </div> - </div> - </div> + --> \ No newline at end of file diff --git a/views/index.html b/views/index.html index a1a5a60..706f22b 100644 --- a/views/index.html +++ b/views/index.html @@ -8,7 +8,7 @@ <meta name="author" content=""> <link rel="icon" href="favicon.ico"> - <title>Mum : Dashboard</title> + <title>Mum</title> <!-- Bootstrap core CSS --> <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> @@ -17,17 +17,19 @@ <link href="static/css/dashboard.css" rel="stylesheet"> <link href="bower_components/angular-toastr/dist/angular-toastr.min.css" rel="stylesheet"/> + <!-- AngularJS --> <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="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script> + <script src="bower_components/angular-route/angular-route.min.js"></script> - <script src="static/js/mumApp.js"></script> - <script src="static/js/controllers/dashboardCtrl.js"></script> - <script src="static/js/controllers/headCtrl.js"></script> - <script src="static/js/controllers/scanCtrl.js"></script> - <script src="static/js/controllers/hostPageCtrl.js"></script> + <script src="static/js/mumApp.js"></script> + <script src="static/js/controllers/dashboardCtrl.js"></script> + <script src="static/js/controllers/headCtrl.js"></script> + <script src="static/js/controllers/scanCtrl.js"></script> + <script src="static/js/controllers/hostPageCtrl.js"></script> - <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> + <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]><!-- <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> @@ -76,9 +78,9 @@ </div> <!-- Bootstrap core JavaScript ================================================== --> - <!-- Placed at the end of the document so the pages load faster --> + <!-- Placed at the end of the document so the pages load faster <script src="bower_components/jquery/dist/jquery.min.js"></script> - <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> + <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>--> </body> </html> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.