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 4d7d99f13b57a5e6314bf490c66f1807a8a21d7b Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Mon Mar 2 18:05:59 2015 +0100 hostpage : detection (ràf mettre en forme) --- app/modules/storage_modules/shelve_db.py | 3 +- static/js/controllers/hostPageCtrl.js | 7 ++ views/hostpage.html | 152 +++++++------------------------ 3 files changed, 40 insertions(+), 122 deletions(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 19120e3..9cfac2a 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -302,7 +302,8 @@ class shelve_db: res['detected'] = {} for mod in self.db['hosts'][addr_host]['detected']: res['detected'][mod] = json.loads(self.db['hosts'][addr_host]['detected'][mod]) - res['custom_info'] = self.db['hosts'][addr_host]['conf']['custom_info'] + res['detected'][mod]['name'] = mod + res['custom_infos'] = self.db['hosts'][addr_host]['conf']['custom_info'] res['interventions'] = self.db['hosts'][addr_host]['conf']['interventions'] except Exception as e: print e.__str__() diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 8d9bd9c..d5ad3ef 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -6,9 +6,16 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, Dat $scope.items = []; + $scope.custom_infos = ''; + $scope.$on("hostInfos", function (event, args) { $scope.$apply(function(){ $scope.items = args; + $scope.custom_infos = args.custom_infos; }); }); + + $scope.toto = function(item){ + return(Object.keys($scope.items.detected)); + } }); \ No newline at end of file diff --git a/views/hostpage.html b/views/hostpage.html index 709acea..aaa6588 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -34,128 +34,38 @@ </tr> </tbody> </table> - <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> - <div class="panel panel-default"> - <div class="panel-heading" role="tab" id="headingOne"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> - Detected configuration - </a> - </h4> - </div> - <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne"> - <div class="panel-body"> - <p>Date of this detection : Sat, 07 Feb 2015 12:00:00 </p> - <h2>Global informations</h2> - <table class="table table-bordered table-hover"> - <tr> - <td>addr</td> - <td>192.168.74.1</td> - </tr> - <tr> - <td>hostname</td> - <td>www.example.com</td> - </tr> - </table> - <h2>Open ports</h2> - <table class="table table-bordered table-hover"> - <tr> - <th>portid </th> - <th>portname </th> - </tr> - <tr> - <td>22</td> - <td>ssh</td> - </tr> - <tr> - <td>25</td> - <td>smtp</td> - </tr> - <tr> - <td>111</td> - <td>rpcbind</td> - </tr> - <tr> - <td>631</td> - <td>ipp</td> - </tr> - <tr> - <td>8080</td> - <td>http</td> - </tr> - </table> - <h2>Operating system</h2> - <table class="table table-bordered table-hover"> - <tr> - <td>os-name</td> - <td>Debian GNU/Linux</td> - </tr> - <tr> - <td>version</td> - <td>7 (wheezy)</td> - </tr> - <tr> - <td>kernel</td> - <td>Linux version 3.16.0-0.bpo.4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) )</td> - </tr> - </table> - </div> - </div> - </div> - <div class="panel panel-default"> - <div class="panel-heading" role="tab" id="headingTwo"> - <h4 class="panel-title"> - <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> - Custom informations - </a> - </h4> - </div> - <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo"> - <div class="panel-body"> - <label for="custom_info">Add any information here :</label> - <textarea class="form-control" rows="3" id="custom_info"></textarea> - <button type="button" class="btn btn-info btn-xs">Save</button> - </div> - </div> - </div> - <div class="panel panel-default"> - <div class="panel-heading" role="tab" id="headingThree"> - <h4 class="panel-title"> - <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> - Interventions done - </a> - </h4> - </div> - <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree"> - <div class="panel-body"> - <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#modal_interv">Add a new intervention</button> - <table class="table table-bordered table-hover"> - <thead> - <tr> - <th>Date </th> - <th>Person </th> - <th>Details </th> - </tr> - </thead> - <tbody> - <tr> - <td>Mon, 01 Feb 2015 10:01:57</td> - <td>J.C.</td> - <td>Package update.</td> - </tr> - <tr> - <td>Thu, 11 Dec 2014 16:54:17</td> - <td>G.G.</td> - <td>Database backup.</td> - </tr> - </tbody> - </table> - </div> - </div> - </div> - </div> + <h2>Detected Configuration</h2> + <div ng-repeat="mod in items.detected"> + <h3>{{mod.name}}</h3> + {{mod}} + + </div> + + + <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> + <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> <div class="modal fade" id="modal_conf" tabindex="-1" role="dialog" aria-labelledby="modal_conf_label" aria-hidden="true"> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.