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 <ul class="nav nav-tabs nav-section">
12 <li class="active"><a href="#info"><img src="{{ STATIC_URL }}icons/authority-xs.png" alt="Institution" /> Institution {{user_details.parent_authority}}</a></li>
13 <li><a href="#users">Users</a></li>
14 <li><a href="#slices">Slices</a></li>
19 <div class="container tab-content">
20 <div class="tab-pane active row" id="info">
21 <div class="col-md-12">
22 <div id="authority-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Authority" /></div>
23 <div id="authority-tab-loaded" style="display:none;">
24 <div id="authority-data" style="float:left; width:50%;"></div>
25 <div id="onelab_membership" style="float:right; width:50%;">
26 <img src="{{ STATIC_URL }}img/onelab-logo.png" alt="" /><br>
27 <div id="onelab-data"></div>
33 <div class="tab-pane row" id="users" data-authority="{{user_details.parent_authority}}">
34 <div class="col-md-12">
35 <table class="table"><tr><td><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></td></tr></table>
37 <button id="deleteusers" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Users</button>
41 <div class="tab-pane row" id="slices">
42 <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> create slice</button>
43 <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
44 <div id="slice-tab-loaded" style="display:none;">
45 <table id="slice-tab">
57 <button id="renewslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
58 <button id="deleteslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
64 $(document).ready(function() {
66 {% if user_details.parent_authority %}
68 $.post("/rest/authority/",{'filters':{'authority_hrn':'{{user_details.parent_authority}}'}}, function( data ) {
69 var authority_data = [];
71 /* 'city','enabled','legal','longitude','onelab_membership','address','parent_authority','slice','user','country',
72 'tech','abbreviated_name','url','postcode','description','scientific','authority_hrn','latitude','name' */
73 $.each( data, function( key, val ) {
74 authority_row = "<img src='{{ STATIC_URL }}img/institutions/{{user_details.parent_authority}}.gif' alt='' /><br>";
75 authority_row += "<br>";
76 authority_row += "<b>authority:</b> "+val.authority_hrn+"<br>";
77 authority_row += "<br>";
78 authority_row += "<b>"+val.name+"</b><br>";
79 authority_row += "<br>";
80 authority_row += "<b>Address:</b> "+val.address+"<br>";
81 authority_row += "<b>City:</b> "+val.postcode+" "+val.city+"<br>";
82 authority_row += "<br>";
83 authority_row += "<b>Country:</b> "+val.country+"<br>";
84 authority_row += "<br>";
85 authority_row += "<br>";
86 authority_row += "<h2>Contacts</h2>";
87 authority_row += "<b>Legal:</b> ";
90 TODO: find a way to express JSON correctly given the constrains: CSV / JSON
92 legal = jQuery.parseJSON(val.legal);
94 $.each(legal, function(k,v){
95 authority_row += k+" "+v+"<br>";
99 authority_row += val.legal+"<br>";
101 authority_row += "<br>";
102 authority_row += "<b>Scientific:</b> ";
104 scientific = jQuery.parseJSON(val.scientific);
105 if($.isArray(scientific)){
106 $.each(scientific, function(v){
107 authority_row += v+", ";
111 authority_row += val.scientific+"<br>";
113 onelab_membership = "<b>Status: </b>"+val.onelab_membership;
114 onelab_data.push(onelab_membership);
115 authority_data.push(authority_row);
117 $("div#authority-data").html(authority_data.join( "" ));
118 $("div#onelab-data").html(onelab_data.join( "" ));
119 $("div#authority-tab-loaded").css("display","block");
120 $("div#authority-tab-loading").css("display","none");
123 $.post("/rest/slice/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
124 var list_slices = [];
125 var table_slices = [];
126 /* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "user", "slice_urn", "slice_expires" */
127 $.each( data, function( key, val ) {
128 list_slices.push( "<li><a href=\"portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
129 if(val.nodes=="undefined" || val.nodes==null){
132 nodes_length=val.nodes.length;
135 if(val.user=="undefined" || val.user==null){
138 user_length=val.user.length;
141 if(val.slice_url=="undefined" || val.slice_url==null){
144 slice_url="<a href='"+val.slice_url+"' target='_blank'>"+val.slice_url+"</a>";
147 slice_row = "<tr id='"+val.slice_hrn+"'>";
148 slice_row += "<td><input type='checkbox' class='slice' id='"+val.slice_hrn+"'></td>";
149 slice_row += "<td><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></td>";
150 slice_row += "<td>"+user_length+"</td>";
151 slice_row += "<td>"+slice_url+"</td>";
152 slice_row += "<td>"+nodes_length+"</td>";
153 slice_row += "<td>"+val.slice_expires+"</td>";
154 slice_row += "</tr>";
155 table_slices.push(slice_row);
159 /* $("div#slice-list").html($( "<ul/>", { html: list_slices.join( "" ) })); */
160 $("table#slice-tab tr:last").after(table_slices.join( "" ));
161 $("div#slice-tab-loaded").css("display","block");
162 $("div#slice-tab-loading").css("display","none");
166 // $.post("/rest/user/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
167 // var list_users = [];
168 // var table_users = [];
169 // /* Available fields
170 // user_gid, user_enabled, slices, pi_authorities, keys, parent_authority, user_first_name,
171 // user_urn, user_last_name, user_phone, user_hrn, user_email, user_type
173 // $.each( data, function( key, val ) {
174 // list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
176 // user_row = "<tr id='"+val.user_hrn+"'>";
177 // user_row += "<td><input type='checkbox' class='user' id='"+val.user_hrn+"'></td>";
178 // user_row += "<td>"+val.user_email+"</td>";
179 // user_row += "<td>"+val.user_hrn+"</td>";
180 // user_row += "<td>"+val.user_first_name+"</td>";
181 // user_row += "<td>"+val.user_last_name+"</td>";
182 // user_row += "<td>"+val.user_enabled+"</td>";
183 // user_row += "</tr>";
184 // table_users.push(user_row);
187 // $("table#user-tab tr:last").after(table_users.join( "" ));
188 // $("div#user-tab-loaded").css("display","block");
189 // $("div#user-tab-loading").css("display","none");