branch develop updated (598bc58 -> db3de9f)
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 598bc58 angular-ui-select dependency added + group tagging on dashboard new db3de9f dashboard: subscriptions on host-view + notif page is now only for summary 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 db3de9fccdcc209859329a65208dc59fe16e9bdb Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue Jun 2 16:37:18 2015 +0200 dashboard: subscriptions on host-view + notif page is now only for summary Summary of changes: app/modules/storage_modules/shelve_db.py | 10 +- static/js/controllers/dashboardCtrl.js | 125 +++++++++++++- static/js/controllers/notificationsCtrl.js | 185 -------------------- static/js/controllers/statsCtrl.js | 3 +- views/dashboard.html | 268 ++++++++++++++++++++--------- views/index.html | 2 +- views/notifications.html | 129 ++------------ 7 files changed, 329 insertions(+), 393 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 db3de9fccdcc209859329a65208dc59fe16e9bdb Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue Jun 2 16:37:18 2015 +0200 dashboard: subscriptions on host-view + notif page is now only for summary --- app/modules/storage_modules/shelve_db.py | 10 +- static/js/controllers/dashboardCtrl.js | 125 +++++++++++++- static/js/controllers/notificationsCtrl.js | 185 -------------------- static/js/controllers/statsCtrl.js | 3 +- views/dashboard.html | 268 ++++++++++++++++++++--------- views/index.html | 2 +- views/notifications.html | 129 ++------------ 7 files changed, 329 insertions(+), 393 deletions(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 579b56f..942d66e 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -376,13 +376,14 @@ class shelve_db: "name":"www.example.com", "status":string, //"success" or "warning" or "danger" or "" "group":[ "all", ...], - "last_check":datetime + "last_check":datetime, "subscribers":{ "uid":string, "priority":int - } - "warning": [mod_name, ...] - "danger": [mod_name, ...] + }, + "warning": [mod_name, ...], + "danger": [mod_name, ...], + "nb_subscribers": int }, ... ] @@ -418,6 +419,7 @@ class shelve_db: info_host["warning"].append(mod) elif self.db["hosts"][host]["monitoring"][mod]["state"] == "danger": info_host["danger"].append(mod) + info_host['nb_subscribers'] = len(self.db['hosts'][host]['conf']['subscribers'].keys()) res.append(info_host) except Exception: print traceback.format_exc() diff --git a/static/js/controllers/dashboardCtrl.js b/static/js/controllers/dashboardCtrl.js index f0b4f79..a31292b 100644 --- a/static/js/controllers/dashboardCtrl.js +++ b/static/js/controllers/dashboardCtrl.js @@ -1,4 +1,4 @@ -mumApp.controller('dashboardCtrl', function ($scope, $routeParams, $location, $rootScope, DataHosts) { +mumApp.controller('dashboardCtrl', function ($scope, $routeParams, $location, $rootScope, $modal, DataHosts) { $scope.param = $routeParams.param; // parameter in URL, null if none /*$scope.sort = { @@ -41,6 +41,8 @@ mumApp.controller('dashboardCtrl', function ($scope, $routeParams, $location, $r $scope.order_val = 'status'; // select field + $scope.view = 'host_view'; + if ($routeParams.param == null) { // if no status filter in parameters, show all status $scope.status_filter = ["success", "warning", "danger", "idling", ""]; @@ -113,4 +115,125 @@ mumApp.controller('dashboardCtrl', function ($scope, $routeParams, $location, $r } }; + + $scope.open_modal_notif = function (addr_host, group_name) { + var modalInstance = $modal.open({ + templateUrl: 'modal_notif_label.html', + controller: 'ModalNotifInstanceCtrl', + size: 'lg', + resolve: { + notif_args: function () { + return {'addr_host' : addr_host, + 'group_name': group_name}; + } + } + }); + }; +}); + +mumApp.controller('ModalNotifInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, $timeout, notif_args) { + $scope.addr_host = null; + $scope.grp_name = null; + + $scope.option_selected = ""; // 'grp' OR 'host' + + $scope.notif_mods = []; + + $scope.subscribers = {};/* { username: + {'minor': { + { notif_mod: priority }, + ... + }, + 'major': { + { notif_mod: priority }, + ... + }}} */ + + $scope.users = {}; + + $scope.new_notif = {"priority": null, "activated": true}; + $scope.new_notif_type = ""; + $scope.new_mod_notif = ""; + $scope.new_username = ""; + + $scope.get_group_subscribers = function () { + var args = {'group': $scope.grp_name}; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_group_subscribers', 'args': args}})); + }; + + $scope.get_host_subscribers = function () { + var args = {'addr_host': $scope.addr_host}; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_host_subscribers', 'args': args}})); + }; + + if(notif_args.addr_host != null){ + $scope.addr_host = notif_args.addr_host; + $scope.option_selected = "host"; + $scope.get_host_subscribers(); + } + else{ + $scope.grp_name = notif_args.group_name; + $scope.option_selected = "grp"; + $scope.get_group_subscribers(); + } + + $scope.$on("resCall", function (event, args) { + if (args.func == 'get_host_subscribers' || args.func == 'get_group_subscribers') { + $timeout(function () { + $scope.subscribers = args.res; + }, 0); + $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_LOADED_NOTIF_MOD": ""})); + } + if (args.func == 'get_users') { + $timeout(function () { + $scope.users = args.res; + }, 0); + } + }); + + $scope.$on("resGetLoadedNotifMod", function (event, args) { + for (var notif_mod_name in args){ + $scope.notif_mods.push(notif_mod_name); + } + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_users', 'args': null}})); + }); + + $scope.add_notif = function(){ + if (!$scope.subscribers.hasOwnProperty($scope.new_username)){ + $scope.subscribers[$scope.new_username] = {}; + $scope.subscribers[$scope.new_username].minor = {}; + $scope.subscribers[$scope.new_username].major = {}; + } + $scope.subscribers[$scope.new_username][$scope.new_notif_type][$scope.new_mod_notif] = $scope.new_notif; + $scope.new_notif = {"priority": null, "activated": true}; + $scope.new_notif_type = ""; + $scope.new_mod_notif = ""; + $scope.new_username = ""; + }; + + $scope.remove_notif = function(username, notif_type, mod_notif_name){ + delete $scope.subscribers[username][notif_type][mod_notif_name]; + if (Object.keys($scope.subscribers[username].minor).length == 0 && + Object.keys($scope.subscribers[username].major).length == 0){ + delete $scope.subscribers[username]; + } + }; + + $scope.save = function () { + var args = {}; + args['subscription'] = $scope.subscribers; + if ($scope.option_selected == 'grp') { + args['group'] = $scope.grp_name; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_subscription_to_group', 'args': args}})); + } + else { + args['addr_host'] = $scope.addr_host; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_subscription_to_host', 'args': args}})); + } + $modalInstance.close(); + }; + + $scope.cancel = function () { + $modalInstance.close(); + }; }); \ No newline at end of file diff --git a/static/js/controllers/notificationsCtrl.js b/static/js/controllers/notificationsCtrl.js index 396ca72..5ccefa1 100644 --- a/static/js/controllers/notificationsCtrl.js +++ b/static/js/controllers/notificationsCtrl.js @@ -17,45 +17,16 @@ mumApp.controller('notificationsCtrl', function ($scope, $rootScope, $modal, $ro ] */ - $scope.subtitle = ""; - $scope.all_subscriptions = {}; // {user1: {'hosts': {addr_host: {'major': {}, 'minor': {}}}, 'groups': {...}}, ... } - $scope.notif_mods = {}; // {notif_mod :{param1:val1, param2:val2, ...}} - $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_ALL_SUBSCRIPTIONS": ""})); $scope.$on("resGetAllSubscriptions", function (event, args) { $timeout(function () { $scope.all_subscriptions = args; }, 0); - $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_LOADED_NOTIF_MOD": ""})); }); - $scope.$on("resGetLoadedNotifMod", function (event, args) { - $timeout(function () { - $scope.notif_mods = args; - }, 0); - }); - - $scope.subscriber_data = {}; /* {username:{"minor":{mod_notif:{"activated":bool,"priority":int}, ...}, - "major":{mod_notif:{"activated":bool,"priority":int}}}} */ - - $scope.subscriber_data_unchanged = {}; // used to discard changes - - // returns all groups except 'all' - $scope.allGroups = function (){ - var res = [] - for (var i = 0; i<$scope.items.length; i++) { - for (var j = 0; j<$scope.items[i].group.length; j++) { - if ($scope.items[i].group[j] != 'all') { - res.push($scope.items[i].group[j]); - } - } - } - return res; - }; - $scope.is_activated = function(struct) { // {modname:{"priority":int,"activated":bool}, ...} res = false; if (struct != {}) { @@ -77,160 +48,4 @@ mumApp.controller('notificationsCtrl', function ($scope, $rootScope, $modal, $ro } return res; }; - - $scope.selected_grp = ""; // string - $scope.selected_host = ""; // {"status":"success","group":["all","g1"],"addr":"127.0.0.1","danger":[],"last_check":"2015-03-20 15:32:19.897431","warning":[],"name":"localhost"} - - $scope.option_selected = ""; // 'grp' OR 'host' - - $scope.get_group_subscribers = function () { - $scope.subtitle = "Group " + $scope.selected_grp; - if ($scope.selected_grp != "") { - var args = {'group': $scope.selected_grp}; - $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_group_subscribers', 'args': args}})); - } - }; - - $scope.get_host_subscribers = function () { - $scope.subtitle = $scope.selected_host['addr'] + '('+ $scope.selected_host['name'] + ')'; - if ($scope.selected_host != "") { - var args = {'addr_host': $scope.selected_host['addr']}; - $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_host_subscribers', 'args': args}})); - } - }; - - $scope.$on("resCall", function (event, args) { /* args= { username: - {'minor': { - { notif_mod: priority }, - ... - }, - 'major': { - { notif_mod: priority }, - ... - }}} */ - if (args.func == 'get_host_subscribers' || args.func == 'get_group_subscribers') { - $timeout(function () { - var sd = {}; - for (user in args.res) { - sd[user] = {}; - sd[user]['minor'] = {}; - sd[user]['major'] = {}; - for (notif_mod in args.res[user]['minor']) { - sd[user]['minor'][notif_mod] = - {'activated': args.res[user]['minor'][notif_mod]['activated'], - 'priority':args.res[user]['minor'][notif_mod]['priority']}; - sd[user]['major'][notif_mod] = - {'activated': args.res[user]['major'][notif_mod]['activated'], - 'priority':args.res[user]['major'][notif_mod]['priority']}; - } - for (notif_mod in $scope.notif_mods) { - if (!sd[user]['minor'].hasOwnProperty(notif_mod)) { - sd[user]['minor'][notif_mod] = {'activated': false, 'priority': null}; - sd[user]['major'][notif_mod] = {'activated': false, 'priority': null}; - } - } - } - $scope.subscriber_data = sd; - $scope.subscriber_data_unchanged = sd; - }, 0); - } - if (args.func == 'update_subscription_to_group' || args.func == 'update_subscription_to_host') { - $route.reload(); - } - if (args.func == 'unsubscribe_to_group' || args.func == 'unsubscribe_to_host') { - $route.reload(); - } - }); - - $scope.discard = function () { - $scope.subscriber_data = $scope.subscriber_data_unchanged; - }; - - $scope.save = function () { - var args = {}; - args['subscription'] = $scope.subscriber_data; - if ($scope.option_selected == 'grp') { - args['group'] = $scope.selected_grp; - $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_subscription_to_group', 'args': args}})); - } - else { - args['addr_host'] = $scope.selected_host.addr; - $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_subscription_to_host', 'args': args}})); - } - }; - - $scope.unsubscribe = function (username) { - var args = {}; - args['username'] = username; - if ($scope.option_selected == 'grp') { - args['group'] = $scope.selected_grp; - $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'unsubscribe_to_group', 'args': args}})); - } - else { - args['addr_host'] = $scope.selected_host.addr; - $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'unsubscribe_to_host', 'args': args}})); - } - }; - - $scope.open_modal_add_subscriber = function (mod_name) { - var modalInstance = $modal.open({ - templateUrl: 'modal_add_subscriber_label.html', - controller: 'ModalAddSubscriberInstanceCtrl', - resolve: { - add_subscriber_args: function () { - return {"grp" : $scope.selected_grp, - "host" : $scope.selected_host}; - } - } - }); - }; -}); - -mumApp.controller('ModalAddSubscriberInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, $timeout, add_subscriber_args) { - $scope.add_subscriber_args = add_subscriber_args; /* {'grp': val, 'host': val */ - - $scope.modal_title = "Add users to "; - if ($scope.add_subscriber_args['grp'] != "") { - $scope.modal_title += " group " + $scope.add_subscriber_args['grp']; - } - else { - $scope.modal_title += " host " + $scope.add_subscriber_args['host']['addr']; - } - - $scope.users = {}; - - $scope.selected_users = []; - - $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_users', 'args': null}})); - - // receiving the user list - $scope.$on("resCall", function (event, args) { - if (args.func == 'get_users') { - $timeout(function () { - $scope.users = args.res; - }, 0); - } - - if (args.func == 'subscribe_to_group' || args.func == 'subscribe_to_host') { - $modalInstance.close(); - $route.reload(); - } - }); - - $scope.ok = function () { - var args = {}; - args['users'] = $scope.selected_users; - if ($scope.add_subscriber_args['grp'] != "") { - args['group'] = $scope.add_subscriber_args['grp']; - $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'subscribe_to_group', 'args': args}})); - } - else { - args['addr_host'] = $scope.add_subscriber_args['host']['addr']; - $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'subscribe_to_host', 'args': args}})); - } - }; - - $scope.cancel = function () { - $modalInstance.close(); - }; }); \ No newline at end of file diff --git a/static/js/controllers/statsCtrl.js b/static/js/controllers/statsCtrl.js index fedad18..14d1661 100644 --- a/static/js/controllers/statsCtrl.js +++ b/static/js/controllers/statsCtrl.js @@ -140,7 +140,8 @@ mumApp.controller('statsCtrl', function ($scope, $rootScope, $timeout, DataHosts display: true, //could be 'left, right' position: 'right' - } + }, + waitForHeightAndWidth: true }; $scope.data = { diff --git a/views/dashboard.html b/views/dashboard.html index 75c51c7..17d2649 100644 --- a/views/dashboard.html +++ b/views/dashboard.html @@ -1,104 +1,122 @@ <div class="col-md-offset-2 main"> <h1 class="page-header">Dashboard</h1> - <h2 class="sub-header">Hosts currently on monitoring</h2> + + <input type="radio" value="host_view" ng-model="view"> Host view + <input type="radio" value="group_view" ng-model="view"> Group view <!-- Host view --> + <div ng-show="view == 'host_view'"> + <h2 class="sub-header">Hosts currently on monitoring</h2> + <div class="row" + ng-show="items.length > 0"> - <div class="row" - ng-show="items.length > 0"> + <div class="col-xs-3"> + <label for="addr_f">Address filter</label> + <input class="form-control" type="text" id="addr_f" ng-model="addr_filter"> + </div> - <div class="col-xs-3"> - <label for="addr_f">Address filter</label> - <input class="form-control" type="text" id="addr_f" ng-model="addr_filter"> - </div> + <div class="col-xs-3"> + <label for="name_f">Name filter</label> + <input class="form-control" type="text" id="name_f" ng-model="name_filter"> + </div> - <div class="col-xs-3"> - <label for="name_f">Name filter</label> - <input class="form-control" type="text" id="name_f" ng-model="name_filter"> - </div> + <div class="col-xs-2"> + <label for="status_f">Status filter</label> + <select multiple class="form-control input-sm" + id="status_f" + ng-model="status_filter" + ng-change="update_url()"> + <option>success</option> + <option>warning</option> + <option>danger</option> + <option>idling</option> + </select> + </div> - <div class="col-xs-2"> - <label for="status_f">Status filter</label> - <select multiple class="form-control input-sm" - id="status_f" - ng-model="status_filter" - ng-change="update_url()"> - <option>success</option> - <option>warning</option> - <option>danger</option> - <option>idling</option> - </select> - </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" + ng-options="group for group in allGroups() | unique:'group'"> + </select> + </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" - ng-options="group for group in allGroups() | unique:'group'"> - </select> - </div> + <table class="table table-condensed table-hover"> + <thead> + <tr> + <th><a ng-click="order_val='addr'">Address</a></th> + <th><a ng-click="order_val='name'">Name</a></th> + <th><a ng-click="order_val='status'">Status</a></th> + <th><a ng-click="order_val='group'">Group</a></th> + <th><a ng-click="order_val='last_check'">Last check</a></th> + </tr> + </thead> - <table class="table table-condensed table-hover"> - <thead> - <tr> - <th><a ng-click="order_val='addr'">Address</a></th> - <th><a ng-click="order_val='name'">Name</a></th> - <th><a ng-click="order_val='status'">Status</a></th> - <th><a ng-click="order_val='group'">Group</a></th> - <th><a ng-click="order_val='last_check'">Last check</a></th> - </tr> - </thead> - - <tbody> - <tr ng-repeat="host in items | - orderBy:order_val | - filter:{addr:addr_filter, name:name_filter, group:group_filter} | - filter:filtering_status" - 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> + <tbody> + <tr ng-repeat="host in items | + orderBy:order_val | + filter:{addr:addr_filter, name:name_filter, group:group_filter} | + filter:filtering_status" + class={{host.status}}> <!-- group.name:group_filter --> + <td><a href="#/hostpage/{{host.addr}}">{{host.addr}}</a></td> + <td>{{host.name}}</td> + <td> + <a popover-placement="bottom" + popover="warning: {{host.warning}} ; danger: {{host.danger}}" + popover-trigger="mouseenter">{{host.status}} + </a> + </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> + <td> + <button type="button" class="btn btn-primary btn-xs" aria-label="Subscribers" + popover-placement="left" + popover="{{host.nb_subscribers}} subscribers" + popover-trigger="mouseenter" + ng-click="open_modal_notif(host.addr, null)"> + <span class="glyphicon glyphicon-user" aria-hidden="true"> + </span> + </button> + </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> </div> <!-- Group view --> - <div> - + <div ng-show="view == 'group_view'"> + Group view </div> <div ng-show="items.length == 0"> @@ -113,4 +131,82 @@ </p> </div> + + <script type="text/ng-template" id="modal_notif_label.html"> + <div class="modal-header"> + <h3 class="modal-title">Notifications for {{addr_host}}</h3> + </div> + <div class="modal-body"> + <div ng-repeat="(username, subscriber) in subscribers"> + {{username}} will be notified: + <ul> + <li ng-repeat="(minor_notif_name, minor_notif_obj) in subscriber.minor" + ng-show="minor_notif_obj.activated"> + with {{minor_notif_name}} after {{minor_notif_obj.priority}} minor notification(s). + <button type="button" + class="btn btn-danger btn-xs" + aria-label="Remove notification instruction" + ng-click="remove_notif(username, 'minor', minor_notif_name)"> + <span class="glyphicon glyphicon-minus" aria-hidden="true"></span> + </button> + </li> + <li ng-repeat="(major_notif_name, major_notif_obj) in subscriber.major" + ng-show="major_notif_obj.activated"> + with {{major_notif_name}} after {{major_notif_obj.priority}} major notification(s). + <button type="button" + class="btn btn-danger btn-xs" + aria-label="Remove notification instruction" + ng-click="remove_notif(username, 'major', major_notif_name)"> + <span class="glyphicon glyphicon-minus" aria-hidden="true"></span> + </button> + </li> + </ul> + </div> + + <div class="row"> + <div class="col-md-4"> + <label for="selected_users">Add</label> + <select class="form-control" + id="selected_users" + ng-model="new_username" + ng-options="user as user for user in users"> + </select> + </div> + + <div class="col-md-4"> + <label for="new_mod_notif">with</label> + <select class="form-control" + id="new_mod_notif" + ng-model="new_mod_notif" + ng-options="notif_mod for notif_mod in notif_mods"> + </select> + </div> + + <div class="col-md-4"> + <label for="new_notif_prio">after</label><br/> + <input type="number" + id="new_notif_prio" + min="1" + ng-model="new_notif.priority"> + <select ng-model="new_notif_type" + id="new_notif_type"> + <option>major</option> + <option>minor</option> + </select> notification(s) + </div> + </div> + <button type="button" + class="btn btn-success" + aria-label="Add a notification rule" + ng-click="add_notif()" + ng-disabled="new_notif.priority==null || new_notif_type=='' || new_mod_notif=='' || new_username==''"> + <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> + </button> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="cancel()">Close</button> + <button type="button" class="btn btn-primary" ng-click="save()">Save changes</button> + </div> + </script> + </div> \ No newline at end of file diff --git a/views/index.html b/views/index.html index be0f454..a4fc96f 100644 --- a/views/index.html +++ b/views/index.html @@ -105,7 +105,7 @@ <li><a href="#groups">Manage your groups</a></li> <li><a href="#settings">Check the default settings</a></li> <li><a href="#users">Users</a></li> - <li><a href="#notifications">Notification parameters</a></li> + <li><a href="#notifications">Notifications summary</a></li> <li><a href="#stats">See the statistics</a></li> </ul> </div> diff --git a/views/notifications.html b/views/notifications.html index 7b04633..267006f 100644 --- a/views/notifications.html +++ b/views/notifications.html @@ -1,117 +1,16 @@ <div class="col-md-offset-2 main"> - <h1 class="page-header">Who to notify? <small>{{subtitle}}</small></h1> - <accordion close-others="false"> - <accordion-group heading="Subscriptions summary"> - <h3 ng-repeat-start="(username, user) in all_subscriptions">{{username}}</h3> - <dl ng-repeat-end - ng-repeat-start="(addr_host, host) in user.hosts"> - <dt>{{addr_host}}</dt> - <dd ng-show="is_activated(host.major)">Major: {{get_activated(host.major)}}</dd> - <dd ng-show="is_activated(host.minor)">Minor: {{get_activated(host.minor)}}</dd> - </dl> - <dl ng-repeat-end - ng-repeat="(grp_name, grp) in user.groups"> - <dt>{{grp_name}}</dt> - <dd ng-show="is_activated(grp.major)">Major: {{get_activated(grp.major)}}</dd> - <dd ng-show="is_activated(grp.minor)">Minor: {{get_activated(grp.minor)}}</dd> - </dl> - </accordion-group> - </accordion> - - <form> - <div class="row"> - <div class="col-lg-12"> - <label for="choice_radio">Do you want to manage the notifications of:</label> - <input type="radio" ng-model="option_selected" value="grp" id="choice_radio" - ng-change="selected_host=''"> a whole group - <input type="radio" ng-model="option_selected" value="host" - ng-change="selected_grp=''"> a single host - </div> - <div class="col-lg-6"> - <label for="grp_choice" - ng-show="option_selected=='grp'">Select one group : - </label> - <select class="form-control input-sm" id="grp_choice" - ng-model="selected_grp" - ng-options="item for item in allGroups() | unique:'group'" - ng-show="option_selected=='grp'" - ng-change="get_group_subscribers()"></select> - - <label for="host_choice" - ng-show="option_selected=='host'">or one host :</label> - <select class="form-control input-sm" id="host_choice" - ng-model="selected_host" - ng-options="host.addr group by host.group for host in items" - ng-show="option_selected=='host'" - ng-change="get_host_subscribers()"></select> - </div> - </div> - </form> - <div ng-show="selected_host!='' || selected_grp!=''"> - <p>Check the box if you want the user to be notified by the correspondent service.</p> - <p>The value represents the numbers of notifications that should occure since the last login of the user.</p> - <p>The notification will be sent to the user, by this service, once this value is reached.</p> - <table class="table table-bordered"> - <thead> - <tr> - <th>User - <button type="button" class="btn btn-primary btn-xs" - ng-click="open_modal_add_subscriber()">Add... - </button> - </th> - <th>Notification service </th> - <th>Minor notifications</th> - <th>Major notifications</th> - </tr> - </thead> - <tbody> - <tr ng-repeat-start="(username, user) in subscriber_data"> - <td>{{username}}<br/> - <button type="button" class="btn btn-danger btn-xs" - ng-click="unsubscribe(username)">Unsubscribe - </button> - </td> - </tr> - <tr ng-repeat-end - ng-repeat="(mod_name, mod_param) in user.minor"> - <td></td> - <td>{{mod_name}}</td> - <td> - <div class="input-group"> - <span class="input-group-addon"> - <input type="checkbox" ng-model="mod_param.activated"> - </span> - <input type="number" min="1" class="form-control" ng-model="mod_param.priority"> - </div> - </td> - <td> - <div class="input-group"> - <span class="input-group-addon"> - <input type="checkbox" ng-model="subscriber_data[username].major[mod_name].activated"> - </span> - <input type="number" min="1" class="form-control" ng-model="subscriber_data[username].major[mod_name].priority"> - </div> - </td> - </tr> - </tbody> - </table> - <button type="button" class="btn btn-default" ng-click="discard()">Discard changes</button> - <button type="button" class="btn btn-primary" ng-click="save()">Save changes</button> - </div> + <h1 class="page-header">Subscriptions summary</h1> + <h3 ng-repeat-start="(username, user) in all_subscriptions">{{username}}</h3> + <dl ng-repeat-end + ng-repeat-start="(addr_host, host) in user.hosts"> + <dt>{{addr_host}}</dt> + <dd ng-show="is_activated(host.major)">Major: {{get_activated(host.major)}}</dd> + <dd ng-show="is_activated(host.minor)">Minor: {{get_activated(host.minor)}}</dd> + </dl> + <dl ng-repeat-end + ng-repeat="(grp_name, grp) in user.groups"> + <dt>{{grp_name}}</dt> + <dd ng-show="is_activated(grp.major)">Major: {{get_activated(grp.major)}}</dd> + <dd ng-show="is_activated(grp.minor)">Minor: {{get_activated(grp.minor)}}</dd> + </dl> </div> - -<script type="text/ng-template" id="modal_add_subscriber_label.html"> - <div class="modal-header"> - <h3 class="modal-title">{{modal_title}}</h3> - </div> - <div class="modal-body"> - <select multiple class="form-control" - ng-model="selected_users" - ng-options="user as user for user in users"> - </select> - </div> - <div class="modal-footer"> - <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()" ng-disabled="selected_users.length==0">Add selected</button> - </div> -</script> \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm