1 {% extends "layout_wide.html" %}
4 <script type="text/javascript" src="{{STATIC_URL}}/js/institution.js"></script>
8 <div class="container">
10 <div class="col-md-12">
11 <div class="breadcrumbs">
12 Management > Institution: <span id="authority_name">{{user_details.parent_authority}}</span>
17 <div class="container">
19 <div class="col-md-12">
20 <ul class="nav nav-tabs nav-section">
21 <li class="active"><a href="#about">About</a></li>
22 <li><a href="#users">Users</a></li>
23 <li><a href="#slices">Slices</a></li>
24 <li><a href="#requests">Requests</a></li>
29 <div class="container tab-content">
30 <div class="tab-pane active row" id="about">
31 <div class="col-md-12 el">
32 <h2>{{user_details.parent_authority}}</h2>
36 <div class="tab-pane row" id="users" data-authority="{{user_details.parent_authority}}">
37 <div class="col-md-12 el">
38 <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
39 <div id="user-tab-loaded" style="display:none;">
40 <table id="user-tab" class="table">
56 <button id="makepi" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-arrow-up"></span> Upgrade to PI</button>
57 <button id="removepi" type="button" class="btn"><span class="glyphicon glyphicon-arrow-down"></span> Downgrade to user</button>
58 <button id="deleteusers" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete selected users</button>
64 <div class="tab-pane row" id="slices">
65 <div class="col-md-12 el">
66 <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
67 <div id="slice-tab-loaded" style="display:none;">
68 <table id="slice-tab" class="table">
74 <!-- <th>nodes</th> -->
82 <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create slice</button>
84 <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request slice</button>
86 <button id="renewslices" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
87 <button id="deleteslices" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
92 <div class="tab-pane row" id="requests">
96 $(document).ready(function() {
98 {% if user_details.parent_authority %}
100 $.post("/rest/myslice:slice/",{'fields':['slice_hrn','users','url','slice_date_created'],'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
101 var list_slices = [];
102 var table_slices = [];
103 /* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "users", "slice_urn", "slice_expires" */
104 $.each( data, function( key, val ) {
105 list_slices.push( "<li><a href=\"portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
106 if(val.nodes=="undefined" || val.nodes==null){
109 nodes_length=val.nodes.length;
112 if(val.users=="undefined" || val.users==null){
115 users_length=val.users.length;
118 if(val.url=="undefined" || val.url==null){
121 slice_url="<a href='"+val.url+"' target='_blank'>"+val.url+"</a>";
124 slice_row = "<tr id='"+val.slice_hrn+"'>";
125 slice_row += "<td><input type='checkbox' class='slice' id='"+val.slice_hrn+"'></td>";
126 slice_row += "<td><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></td>";
127 slice_row += "<td>"+users_length+"</td>";
128 slice_row += "<td>"+slice_url+"</td>";
129 //slice_row += "<td>"+nodes_length+"</td>";
130 slice_row += "<td>"+val.slice_date_created+"</td>";
131 slice_row += "</tr>";
132 table_slices.push(slice_row);
136 /* $("div#slice-list").html($( "<ul/>", { html: list_slices.join( "" ) })); */
137 $("table#slice-tab tr:last").after(table_slices.join( "" ));
138 $("div#slice-tab-loaded").css("display","block");
139 $("div#slice-tab-loading").css("display","none");
143 // XXX LOIC CACHE PB IF PREFIXED !
144 $.post("/rest/authority/",{'fields':['pi_users'],'filters':{'authority_hrn':'{{user_details.parent_authority}}'}}, function( data ) {
146 var table_users = [];
147 $.each( data[0].pi_users, function( key, val ) {
149 user_row = "<tr id='"+val+"'>";
150 user_row += "<td><input type='checkbox' class='user' id='"+val+"'></td>";
151 user_row += "<td></td>";
152 user_row += "<td>"+val+"</td>";
154 table_users.push(user_row);
156 $("table#user-tab tr:last").after(table_users.join( "" ));
157 $("div#user-tab-loaded").css("display","block");
158 $("div#user-tab-loading").css("display","none");
162 $.post("/rest/user/",{'fields':['user_hrn','user_email'],'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
164 var table_users = [];
166 user_gid, user_enabled, slices, pi_authorities, keys, parent_authority, user_first_name,
167 user_urn, user_last_name, user_phone, user_hrn, user_email, user_type
169 $.each( data, function( key, val ) {
170 list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
171 user_row = "<tr id='"+val.user_hrn+"'>";
172 user_row += "<td><input type='checkbox' class='user' id='"+val.user_hrn+"' data-email='"+val.user_email+"'></td>";
173 user_row += "<td>"+val.user_email+"</td>";
174 user_row += "<td>"+val.user_hrn+"</td>";
176 user_row += "<td>"+val.user_first_name+"</td>";
177 user_row += "<td>"+val.user_last_name+"</td>";
178 user_row += "<td>"+val.user_enabled+"</td>";
181 table_users.push(user_row);
183 $("table#user-tab tr:last").after(table_users.join( "" ));
184 $("div#user-tab-loaded").css("display","block");
185 $("div#user-tab-loading").css("display","none");
192 }); // End document.ready
194 $(document).ready(function() {
195 $('.nav-tabs a').click(function (e) {
198 var id = $(this).attr('href').substr(1);
199 if ((id == 'requests')){
200 $("#" + id).load('/management/' + id);
203 if ((id == 'requests') || (id == 'about'))
204 $("#" + id).load('/management/' + id);
207 var hash = window.location.hash;
209 $('.nav-tabs a[href='+hash+']').click();
211 $('.nav-tabs a[href=#about]').click();