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"></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="#info">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="info">
31 <div class="col-md-12 el">
32 <div id="authority-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Authority" /></div>
33 <div id="authority-tab-loaded" style="display:none;">
34 <div id="authority-data" style="float:left; width:50%;"></div>
35 <div id="onelab_membership" style="float:right; width:50%;">
36 <img src="{{ STATIC_URL }}img/onelab-logo.png" alt="" /><br>
37 <div id="onelab-data"></div>
43 <div class="tab-pane row" id="users" data-authority="{{user_details.parent_authority}}">
44 <div class="col-md-12 el">
45 <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
46 <div id="user-tab-loaded" style="display:none;">
47 <table id="user-tab" class="table">
61 <button id="deleteusers" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete selected users</button>
67 <div class="tab-pane row" id="slices">
68 <div class="col-md-12 el">
69 {% if 'is_pi' in pi %}
70 <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create slice</button>
72 <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request slice</button>
75 <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
76 <div id="slice-tab-loaded" style="display:none;">
77 <table id="slice-tab" class="table">
83 <!-- <th>nodes</th> -->
88 {% if 'is_pi' in pi %}
90 <button id="renewslices" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
91 <button id="deleteslices" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
96 <div class="tab-pane row" id="requests">
100 $(document).ready(function() {
102 {% if user_details.parent_authority %}
104 $.post("/rest/authority/",{'filters':{'authority_hrn':'{{user_details.parent_authority}}'}}, function( data ) {
106 var authority_data = [];
107 var onelab_data = [];
108 /* 'city','enabled','legal','longitude','onelab_membership','address','parent_authority','slice','user','country',
109 'tech','abbreviated_name','url','postcode','description','scientific','authority_hrn','latitude','name' */
110 $.each( data, function( key, val ) {
111 $('#authority_name').text(val.name);
112 authority_row = "<img src='{{ STATIC_URL }}img/institutions/{{user_details.parent_authority}}.gif' alt='' /><br>";
113 authority_row += "<br>";
114 authority_row += "<b>authority:</b> "+val.authority_hrn+"<br>";
115 authority_row += "<br>";
116 authority_row += "<b>"+val.name+"</b><br>";
117 authority_row += "<br>";
118 authority_row += "<b>Address:</b> "+val.address+"<br>";
119 authority_row += "<b>City:</b> "+val.postcode+" "+val.city+"<br>";
120 authority_row += "<br>";
121 authority_row += "<b>Country:</b> "+val.country+"<br>";
122 authority_row += "<br>";
123 authority_row += "<br>";
124 authority_row += "<h2>Contacts</h2>";
125 authority_row += "<b>Legal:</b> ";
128 TODO: find a way to express JSON correctly given the constrains: CSV / JSON
130 legal = jQuery.parseJSON(val.legal);
131 if($.isArray(legal)){
132 $.each(legal, function(k,v){
133 authority_row += k+" "+v+"<br>";
137 authority_row += val.legal+"<br>";
139 authority_row += "<br>";
140 authority_row += "<b>Scientific:</b> ";
142 scientific = jQuery.parseJSON(val.scientific);
143 if($.isArray(scientific)){
144 $.each(scientific, function(v){
145 authority_row += v+", ";
149 authority_row += val.scientific+"<br>";
151 onelab_membership = "<b>Status: </b>"+val.onelab_membership;
152 onelab_data.push(onelab_membership);
153 authority_data.push(authority_row);
156 $("div#authority-data").html(authority_data.join( "" ));
157 $("div#onelab-data").html(onelab_data.join( "" ));
158 $("div#authority-tab-loaded").css("display","block");
159 $("div#authority-tab-loading").css("display","none");
162 $.post("/rest/slice/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
163 var list_slices = [];
164 var table_slices = [];
165 /* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "users", "slice_urn", "slice_expires" */
166 $.each( data, function( key, val ) {
167 list_slices.push( "<li><a href=\"portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
168 if(val.nodes=="undefined" || val.nodes==null){
171 nodes_length=val.nodes.length;
174 if(val.users=="undefined" || val.users==null){
177 users_length=val.users.length;
180 if(val.slice_url=="undefined" || val.slice_url==null){
183 slice_url="<a href='"+val.slice_url+"' target='_blank'>"+val.slice_url+"</a>";
186 slice_row = "<tr id='"+val.slice_hrn+"'>";
187 slice_row += "<td><input type='checkbox' class='slice' id='"+val.slice_hrn+"'></td>";
188 slice_row += "<td><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></td>";
189 slice_row += "<td>"+users_length+"</td>";
190 slice_row += "<td>"+slice_url+"</td>";
191 //slice_row += "<td>"+nodes_length+"</td>";
192 slice_row += "<td>"+val.slice_expires+"</td>";
193 slice_row += "</tr>";
194 table_slices.push(slice_row);
198 /* $("div#slice-list").html($( "<ul/>", { html: list_slices.join( "" ) })); */
199 $("table#slice-tab tr:last").after(table_slices.join( "" ));
200 $("div#slice-tab-loaded").css("display","block");
201 $("div#slice-tab-loading").css("display","none");
205 $.post("/rest/user/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
207 var table_users = [];
209 user_gid, user_enabled, slices, pi_authorities, keys, parent_authority, user_first_name,
210 user_urn, user_last_name, user_phone, user_hrn, user_email, user_type
212 $.each( data, function( key, val ) {
213 list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
214 user_row = "<tr id='"+val.user_hrn+"'>";
215 user_row += "<td><input type='checkbox' class='user' id='"+val.user_hrn+"'></td>";
216 user_row += "<td>"+val.user_email+"</td>";
217 user_row += "<td>"+val.user_hrn+"</td>";
218 user_row += "<td>"+val.user_first_name+"</td>";
219 user_row += "<td>"+val.user_last_name+"</td>";
220 user_row += "<td>"+val.user_enabled+"</td>";
222 table_users.push(user_row);
224 $("table#user-tab tr:last").after(table_users.join( "" ));
225 $("div#user-tab-loaded").css("display","block");
226 $("div#user-tab-loading").css("display","none");
232 }); // End document.ready
234 $(document).ready(function() {
235 $('.nav-tabs a').click(function (e) {
238 var id = $(this).attr('href').substr(1);
239 if (id == 'requests')
240 $("#" + id).load('/management/' + id);
242 var hash = window.location.hash;
244 $('.nav-tabs a[href='+hash+']').click();