blob: 54ca0208aaa654042e9f1a72fd0f80522d2d12fd [file] [log] [blame]
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -05001<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8" />
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <% include ../partials/head %>
7 <% include ../partials/header %>
8 <script type="text/javascript" src="/javascripts/admportal.js" async></script>
9 <title>SDN-C AdminPortal</title>
10<script class="init">
11 $(document).ready(function() {
12 $('#alts_credentials').DataTable( {
13 "order": [[ 0, "asc" ]]
14 } );
15} );
16</script>
17
18</head>
19<body>
20
21<div class="well well-sm">
22<h3>ALTS Credentials</h3>
23</div>
24
25<% if ( typeof result != 'undefined' ) {
26 if (result.code.length > 0) {
27 if ( result.code == 'success' ) { %>
28 <div class='alert alert-success' role='alert'>
29 <%
30 for ( x in result.msg ){ %>
31 <div><%= result.msg[x] %></div>
32 <% } %>
33 </div>
34 <% } else { %>
35 <div class='alert alert-danger' role='danger'>
36 <%
37 for ( x in result.msg ){ %>
38 <div><%= result.msg[x] %></div>
39 <% } %>
40 </div>
41 <% } %>
42 <% } %>
43<% } %>
44
45<% if( typeof privilege != 'undefined'){
46 var priv = privilege.privilege;
47} else {
48 var priv = 'A';
49} %>
50
51
52<div class="container-fluid">
53
54 <% if(priv == 'A'){ %>
55 <div class="actions" style="padding:15px 0px;">
56 <button class="btn btn-primary" data-toggle="modal" data-target="#add_alts_credentials">
57 Add ALTS Credentials
58 </button>
59 </div>
60 <% } %>
61
62 <table id="alts_credentials" class="table table-hover table-condensed">
63 <thead>
64 <tr>
65 <th>ALTS Username</th>
66 <th>ALTS Password</th>
67 <% if(priv == 'A'){ %>
68 <th>Action</th>
69 <% } %>
70 </tr>
71 </thead>
72 <tbody>
73 <% rows.forEach( function(row) { %>
74 <tr>
75 <td><%= row.alts_username %></td>
76 <td>*****</td>
77 <% if(priv == 'A') { %>
78 <td>
79 <button type="button" class="btn btn-default btn-xs"
80 onclick="updateAltsCredentials('<%=row.alts_username %>','<%= row.alts_password %>');">Update</button>
81 <button type="button" class="btn btn-default btn-xs"
82 onclick="deleteAltsCredentials('<%= row.alts_username %>', '<%= row.alts_password %>');">Delete</button>
83 </td>
84 <% } %>
85
86 </tr>
87 <% }); %>
88 </tbody>
89 </table>
90
91</div>
92
93<% include ../partials/alts_credentials %>
94<footer>
95 <% include ../partials/footer %>
96</footer>
97
98<script type="text/javascript">
99function submitAltsCredentials(form)
100{
101 var errorMsg='';
102 var alts_username = '';
103 var alts_password = '';
104 var confirm_alts_password = '';
105
106 if ( form.name == 'addForm' )
107 {
108 alts_username = form.nf_alts_username;
109 alts_password = form.nf_alts_password;
110 confirm_alts_password = form.nf_confirm_alts_password;
111
112 if ( alts_password.value != confirm_alts_password.value )
113 {
114 bootbox.alert('Passwords do not match.');
115 return;
116 }
117 }
118 else
119 {
120 alts_username = form.uf_alts_username;
121 alts_password = form.uf_alts_password;
122 confirm_alts_password = form.uf_confirm_alts_password;
123
124 if ( alts_password.value != confirm_alts_password.value )
125 {
126 bootbox.alert('Passwords do not match.');
127 return;
128 }
129 }
130 form.submit();
131}
132
133function updateAltsCredentials(alts_username,alts_password) {
134
135 document.getElementById('uf_alts_username').value=alts_username;
136 document.getElementById('uf_alts_password').value=alts_password;
137
138 $('#update_alts_credentials').modal('show');
139}
140
141function deleteAltsCredentials(alts_username, alts_password) {
142
143 var url_string = encodeURI("/ucpe/deleteAltsCredentials?alts_username=" + alts_username
144 + "&alts_password=" + alts_password);
145
146
147 bootbox.confirm({
148 message: "Are you sure you want to delete ALTS Credentials? " + alts_username,
149 callback: function(result) {
150 if ( result )
151 {
152 location.assign(url_string);
153 }
154 return;
155 },
156 buttons: {
157 cancel: {
158 label: "Cancel"
159 },
160 confirm: {
161 label: "Yes"
162 }
163 }
164 });
165}
166
167</script>
168
169</body>
170</html>
171