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