2 ================================================================================
4 ================================================================================
5 Copyright (C) 2017 AT&T Intellectual Property
6 ================================================================================
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ================================================================================
21 <%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> --%>
23 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
24 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
25 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
27 <script src= "static/ebz/angular_js/angular.js"></script>
28 <script src= "static/ebz/angular_js/angular-sanitize.js"></script>
29 <script src= "static/ebz/angular_js/att_abs_tpls.js"></script>
30 <script src= "static/ebz/angular_js/app.js"></script>
31 <script src= "static/ebz/angular_js/gestures.js"></script>
33 <script src="static/js/jquery-1.10.2.js"></script>
34 <script src="static/js/modalService.js"></script>
35 <script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
36 <script src="static/js/jquery-ui.js" type="text/javascript"></script>
38 <div class="pageTitle">
39 <h1 class="heading1" style="margin-top:20px;">Roles</h1>
42 Click on a Role to view its details.
44 <div ng-controller="roleListController" >
45 <div id="dialog" title="Roles">
46 <table att-table table-data="availableRoles" current-page="1">
47 <thead att-table-row type="header">
49 <th att-table-header width="70%">Name</th>
50 <th att-table-header width="10%">Priority</th>
51 <th att-table-header width="10%">Active?</th>
52 <th att-table-header width="10%">Delete?</th>
55 <tbody att-table-row type="body" row-repeat="availableRole in availableRoles track by availableRole.id" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
56 <!-- <tr ng-repeat="availableRole in availableRoles track by availableRole.id"> -->
58 <td width="70%"><a href="role.htm?role_id={{availableRole.id}}">{{ availableRole.name }}</a></td>
59 <td width="10%">{{ availableRole.priority }}</td>
61 <div ng-click="toggleRole(availableRole.active,availableRole);">
62 <input type="checkbox" ng-model="availableRole.active" att-toggle-main>
65 <td att-table-body width="10%">
66 <div ng-click="removeRole(availableRole);" style="font-size:20px;"><a href="javascript:void(0)" class="icon-trash"></a></div>
73 <div align="left" style="marin-bottom: 50px;">
74 <button type="submit" onClick="window.location='role.htm';" att-button
75 btn-type="primary" size="small">Create</button>
84 app.controller('roleListController', function ($scope){
86 $scope.availableRoles=${availableRoles};
87 //console.log($scope.availableRoles);
88 $scope.toggleRole = function(selected,availableRole) {
89 //alert('toggleRole: '+selected);
90 var toggleType = null;
92 toggleType = "activate";
94 toggleType = "inactivate";
97 if (confirm("You are about to "+toggleType+" the test role "+availableRole.name+". Do you want to continue?")) {
99 var uuu = "role_list/toggleRole";
101 var postData={role:availableRole};
106 contentType: 'application/json',
107 data: JSON.stringify(postData),
108 success : function(data){
110 $scope.$apply(function(){$scope.availableRoles=data.availableRoles;});
111 console.log($scope.availableRoles);
113 error : function(data){
115 alert("Error while saving. ");
122 $scope.removeRole = function(role) {
123 if (confirm("You are about to delete the role "+role.name+". Do you want to continue?")) {
124 //alert('deleted'+role.name);
125 var uuu = "role_list/removeRole";
126 var postData={role:role};
131 contentType: 'application/json',
132 data: JSON.stringify(postData),
133 success : function(data){
134 $scope.$apply(function(){$scope.availableRoles=data.availableRoles;});
136 error : function(data){
138 alert("Error while deleting: "+ data.responseText);