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