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