Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
[myslice.git] / portal / templates / onelab / onelab_slice-user-view.html
1
2 <div class="col-md-2">
3         <div id="select-platform" class="list-group">
4         </div>
5                 
6         <ul class="list-group">
7           <li class="list-group-item">Authority:<b> {{user_details.parent_authority}}</b>
8                 <!--<select id="auth_list">
9                         <option value="ple.upmc">UPMC</option>
10                         <option value="ple.inria">INRIA</option>
11                         <option value="ple.nitos">NITOS</option>
12                         <option value="ple.iminds">iMinds</option>
13                 </select> -->
14           </li>
15           <li class="list-group-item">Filter: slice</li>
16           
17         </ul>
18
19 </div>
20 <div class="col-md-10">
21         <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Useres" /></div>
22         <div id="user-tab-loaded" style="display:none;">
23                 <table id="user-tab" class="table">
24                 <tr>
25                         <th>+/-</th>
26                         <th>Email</th>
27                         <th>User hrn</th>
28                         <th>Enabled</th>
29                 </tr>
30                 </table>
31         </div>
32 </div>
33 <script>
34     $(document).ready(function() {
35                         //console.log("the value you selected: " + selectedValue);
36                 $.post("/rest/user/",{'filters':{'parent_authority': "{{user_details.parent_authority}}"}}, function( data ) {
37                 var list_users = [];
38                 var table_users = [];
39                                 /* Available fields
40                                 user_gid, user_enabled, slices, pi_authorities, keys, parent_authority, user_first_name,
41                             user_urn, user_last_name, user_phone, user_hrn, user_email, user_type
42                                 */
43                 $.each( data, function( key, val ) {
44                         //list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
45                         user_row = "<tr>";
46                                         // checking the box for the users that belong to the selected slice
47                                         var flag_checkbox = 0;
48                                         for(var data in val.slices) {
49                                         var element = val.slices[data];
50                                                 if (element == "{{slice}}"){
51                                                         //console.log("the slice is: "+ element);       
52                                                         flag_checkbox = 1;
53                                                         user_row += "<td><input type='checkbox' checked='True'></td>";
54                                                 }
55                                         }
56                                         if(flag_checkbox != 1){
57                                 user_row += "<td><input type='checkbox'></td>";
58                                         }
59                         user_row += "<td>"+val.user_email+"</td>";
60                         user_row += "<td>"+val.user_hrn+"</td>";
61                                         user_row += "<td>"+val.user_enabled+"</td>";
62                         user_row += "</tr>";
63                         table_users.push(user_row);
64                 
65                 });
66                                 $("table#user-tab tr:last").after(table_users.join( "" ));
67                 $("div#user-tab-loaded").css("display","block");
68                 $("div#user-tab-loading").css("display","none");
69                 });
70         //      });
71     });
72 </script>
73