update styles and forms
[unfold.git] / portal / templates / manageuserview.html
1 {% extends "layout.html" %}
2 {% block content %}
3
4 <div class="row">
5         <div class="col-md-12">
6         <h1><img src="{{ STATIC_URL }}icons/users-xs.png" alt="Manage Users" /> Manage Users</h1>
7         </div>
8 </div>
9
10
11 {% if messages %}
12 <ul class="messages">
13     {% for message in messages %}
14     <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
15     {% endfor %}
16 </ul>
17 {% endif %}
18
19 <div class="row">
20     <ul class="nav nav-tabs">
21       <li class="active"><a class="home-tab" data-panel="user_profile" href="#">User Profile</a></li>
22       <li><a class="home-tab" data-panel="principal_acc" href="#">User Account</a></li>
23       <li><a class="home-tab" data-panel="ref_acc" href="#">Testbed Access</a></li>
24     </ul>
25         <div class="home-panel" id="user_profile">
26         <form id="editForm"  method="POST" action="{{user_email}}/user_process" enctype="multipart/form-data">
27         <div id="middle" align="center">
28                 <div class="well">
29                         {% csrf_token %}
30                                 <table class="profile">          
31                                 <tr class="odd">
32                                         <td colspan="2">
33                                                         <div id="info">Platform: Myslice</div>
34                                         </td>
35                                 </tr>
36                                         <tr class="even">
37                                         <td class="key">Email</td>
38                                         <td class="value"> <span id="emailval" class="value" >{{ user_email }}</span> </td>
39                                         </tr>
40                                 <tr class="odd">
41                                                 <td class="key">Full Name</td>
42                                                 <td class="value">
43                                                         <span id="nameval" class="value" >{{ fullname }} </span>
44                                                         <span class="hide_this" id="span_name">
45                                                         <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_name_change"> Cancel </button> 
46                                                         <div style='display:none;'><input type='hidden'  name='nameform'  /></div>
47                                                         <input id="fname" type="text" name="fname" class="required"  maxlength="200" value="{{firstname}}" />
48                                                         <input id="lname" type="text" name="lname" class="required"  maxlength="200" value="{{lastname}}" />
49                                                         <input type="submit" class="btn btn-default btn-xs" name="submit_name" value="Save"/>
50                                                         </span>
51                                                         <button class="btn btn-default btn-xs" type="button"title="Full Name" id="edit_name">
52                                                                 <span class="glyphicon glyphicon-edit"></span> Edit
53                                                         </button>
54                                                 </td>
55                                 </tr>
56                                         <tr class="even">
57                                         <td class="key">Authority</td>
58                                         <td class="value">
59                                                 <span id="authval" class="value" >{{ authority }} </span>
60                                                 <span class="hide_this" id="span_auth">
61                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_auth_change"> Cancel </button>
62                                                 <div style='display:none;'><input type='hidden'  name='authform'  /></div>
63                                                 <input id="authority" type="text" name="authority" class="required"  maxlength="200" value="{{authority}}" />
64                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_auth" value="Save"/>
65                                                 </span>
66                                                 <button class="btn btn-default btn-xs" type="button"title="auth" id="edit_auth">
67                                                 <span class="glyphicon glyphicon-edit"></span> Edit
68                                                 </button>
69                                         </td>
70                                         </tr>     
71                                         <tr class="odd">
72                                                 <td class="key">Generate Keys</td>
73                                                 <td>
74                                                         <input type="submit" name="generate" class="btn btn-danger btn-xs" value="Generate a new Key Pair" id="generate_keypair" 
75                                                                    onclick="return confirm('Are you sure? If you do so, your current credentials will be overwritten.');" 
76                                                                    title="It will generate a new key Pair and your current credentials will be overwritten."/>
77                                         </td> 
78                                 </tr>
79                                 <tr class="even">
80                                         <td class="key">Public Key</td>
81                                         <td class="value">
82                                                         <span id="keyval" class="value">******** </span>
83                                                         <span class="hide_this" id="span_upload">
84                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_upload"> Cancel </button>
85                                                                 <div style='display:none;'>
86                                                                         <input type='hidden'  name='upload'  /></div>
87                                                                         <input type="file" name="pubkey" class="required" id="pubkey"/>  
88                                                                         <input class="btn btn-default btn-xs" name="upload_key" id="upload_key"  type="submit" title="Upload your public key" value="Upload"
89                                                                            onclick="return confirm('Are you sure? It will overwrite your current credentials and you have delegate it manually.');"/>
90                                                         </span>
91                                                         <div style='display:none;'> <input type='hidden'  name='dload'  /> </div> 
92                                                         <button type="submit" name="dl_pubkey" class="btn btn-default btn-xs" title="Download your public key" id="dl_file">
93                                                                 <span class="glyphicon glyphicon-download"></span> Download
94                                                         </button>
95                                                         <button class="btn btn-default btn-xs" id="upload_file" type="button" title="Upload a public key">
96                                                                 <span class="glyphicon glyphicon-upload"></span> Upload
97                                                         </button>       
98                                         </td>
99                                 </tr>
100                                 </table>
101                 </div>
102         </div>
103         </div>
104
105         
106         <div class="home-panel" id="principal_acc" style="display:none;">
107         <div class="row">
108                 
109         <h3>Principal Account <small>Account used for delegating credentials</small></h3>
110         
111                         <table class="table table-bordered table-hover  mytable"> 
112                                 <tr class="odd"> 
113                                 <th>Platform</th> 
114                                 <th>Account Type</th>
115                                         <th>Account Delegation</th>
116                                 <th>User hrn</th>
117                                         <th>User Status</th>
118                                 <!--<th>Pub Key</th> -->
119                         </tr>   
120                                 {% for row in principal_acc %}         
121                                 <tr class="border_bottom">
122                                 <td class="odd"> {{ row.platform_name }} </td>
123                                 <td class="odd"> {{ row.account_type }} </td>
124                                         <td class="odd"> {{ row.delegation_type }} </td>
125                                 <td class="odd"> {{ row.usr_hrn }}  </td>
126                                         <td class="odd"> {{ row.user_status }}  </td>
127                         <!--    <td class="even"> {{ row.usr_pubkey }} </td> -->
128                         </tr> 
129                                 {%endfor%}               
130                         </table>
131         </div>
132
133
134
135 {%if 'Enabled'  in user_status %}
136         <div class="row">
137         <h3>Credentials <small>Delegated to Principal Account</small></h3>
138                 <table class="mytable table table-bordered table-hover">
139                                 <caption><b>Delegated User Credential</b></caption> 
140                     <tr class="odd"> 
141                         <th>Expiration Date</th>
142                                         <th>Download</th>
143                     </tr>
144                                 {% for row in my_users %}         
145                                 <tr class="border_bottom">
146                                 <td class="odd"> {{ row.cred_exp }} </td>
147                                         <td class="odd">
148                                                 <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
149                                                         <span class="glyphicon glyphicon-download"></span> Download
150                                                 </button>
151                                         </td>
152                                 </tr>
153                                 {%endfor%}
154                          </table>
155                         <p></p>
156                         <table class="mytable table table-bordered table-hover">
157                                 <caption><b>Delegated Slice Credentials</b></caption>  
158                         <tr class="odd"> 
159                                         <th>Slice Name</th> 
160                                 <th>Expiration Date</th>
161                                         <th>Download</th>
162                         </tr>
163                                 {% for row in my_slices %}     
164                         <tr class="border_bottom">
165                                 <td class="odd"> {{ row.slice_name }} </td>
166                                         <td class="odd"> {{ row.cred_exp }} </td>
167                                         <td class="odd"> 
168                                                 <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
169                                                         <span class="glyphicon glyphicon-download"></span> Download
170                                                 </button> 
171                                         </td>
172                         </tr>
173                         {%endfor%}
174                         </table>
175                         <p></p>
176                         <table class="mytable table table-bordered table-hover">
177                                 <caption><b>Delegated Authority Credentials</b></caption>
178                                 <tr class="odd"> 
179                                 <th>Authority Name</th> 
180                                 <th>Expiration Date</th>
181                                         <th>Download</th>
182                                 </tr>
183                                 {% for row in my_auths %}
184                                 <tr class="border_bottom">
185                                 <td class="odd"> {{ row.auth_name }} </td>
186                                 <td class="odd"> {{ row.cred_exp }} </td>
187                                         <td class="odd">
188                                                 <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
189                                                         <span class="glyphicon glyphicon-download"></span> Download
190                                                 </button>
191                                         </td>
192                                 </tr>
193                                 {%endfor%}
194                         </table>
195                         <p></p>
196                          {%if '' not in my_users%}      
197                         <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
198                         {%else%}
199                         <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
200                         {%endif%}
201         </div>
202 </div>
203
204
205         <div class="home-panel" id="ref_acc" style="display:none;">
206                 <h3>Testbed Access <small>Reference Accounts in the following testbeds</small></h3>
207         <table class="mytable table table-bordered table-hover"> 
208             <tr class="odd"> 
209                 <th>Platform</th> 
210                 <th>Account Type</th>
211                                 <th>Reference to</th>
212                                 <th>Remove Account</th>
213             </tr>   
214             {% for row in ref_acc %}         
215             <tr class="border_bottom">
216                 <td class="odd"> {{ row.platform_name }} </td>
217                 <td class="odd"> {{ row.account_type }} </td>
218                                 <td class="odd"> {{ row.account_reference }} </td>
219                                 <td class="odd">
220                                 <button class="btn btn-danger btn-xs" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform">
221                                                 <span class="glyphicon glyphicon-minus"></span>
222                                         </button>
223                                 </td>
224             </tr> 
225             {%endfor%}               
226         </table>
227
228
229                 <h3>Add reference account to the following testbeds</h3>
230
231         <table class="mytable table table-bordered table-hover"> 
232             <tr class="odd"> 
233                 <th>Platforms</th> 
234                 <th>Add Account</th>
235             </tr>   
236             {% for platform in platform_list %}         
237             <tr class="border_bottom">
238                 <td class="odd"> {{ platform.platform_no_access }} </td>
239                 <td class="odd">
240                                         <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform">
241                                                 <span class="glyphicon glyphicon-plus"></span>
242                                         </button>
243                                 </td>
244             </tr> 
245             {%endfor%}               
246         </table>
247     
248         </div>
249 {%endif%} 
250 </div>
251 </form>
252 </div>
253
254  <script>
255      $(document).ready(function() {
256          $('a.home-tab').click(function() {
257              $('ul.nav-tabs li').removeClass('active');
258              $(this).parent().addClass('active');
259              $('div.home-panel').hide();
260              $('div#'+$(this).data('panel')).show();
261          });
262          $('button#createslice').click(function() {
263              window.location="/portal/slice_request/";
264          })
265          ;$('button#slicerequestbtn').click(function() {
266              /*
267              window.location="/portal/slice_request/";
268              */
269          });
270      });
271  </script>
272
273
274 {% endblock %}