1 {% extends "layout.html" %}
3 <script type="text/javascript" src="{{STATIC_URL}}/js/institution.js"></script>
7 <h1><img src="{{ STATIC_URL }}img/icon_authority_color_small.png" alt="" /> Institution: {{user_details.parent_authority}}</h1>
9 <div class="row" id="institution">
10 <ul class="nav nav-tabs">
11 <li class="active" id="authority-tab"><a class="home-tab" data-panel="institution" href="#">INFO</a></li>
12 <li id="users-tab"><a class="home-tab" data-panel="users" href="#">USERS</a></li>
13 <li id="slices-tab"><a class="home-tab" data-panel="slices" href="#">SLICES</a></li>
15 <div class="home-panel" id="institution">
16 <div id="authority-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Authority" /></div>
17 <div id="authority-tab-loaded" style="display:none;">
18 <div id="authority-data" style="float:left; width:50%;"></div>
21 <div class="home-panel" id="users" style="display:none;">
22 <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
23 <div id="user-tab-loaded" style="display:none;">
35 <button id="deleteusers" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Users</button>
38 <div class="home-panel" id="slices" style="display:none;">
39 <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> create slice</button>
40 <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
41 <div id="slice-tab-loaded" style="display:none;">
42 <table id="slice-tab">
54 <button id="renewslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
55 <button id="deleteslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
61 $(document).ready(function() {
63 {% if user_details.parent_authority %}
64 $.post("/rest/authority/",{'filters':{'authority_hrn':'{{user_details.parent_authority}}'}}, function( data ) {
65 var authority_data = [];
67 /* 'city','enabled','legal','longitude','onelab_membership','address','parent_authority','slice','user','country',
68 'tech','abbreviated_name','url','postcode','description','scientific','authority_hrn','latitude','name' */
69 $.each( data, function( key, val ) {
70 authority_row = "<img src='{{ STATIC_URL }}img/institutions/{{user_details.parent_authority}}.gif' alt='' /><br>";
71 authority_row += "<br>";
72 authority_row += "<b>authority:</b> "+val.authority_hrn+"<br>";
73 authority_row += "<br>";
75 authority_row += "<b>"+val.name+"</b><br>";
76 authority_row += "<br>";
77 authority_row += "<b>Address:</b> "+val.address+"<br>";
78 authority_row += "<b>City:</b> "+val.postcode+" "+val.city+"<br>";
79 authority_row += "<br>";
80 authority_row += "<b>Country:</b> "+val.country+"<br>";
81 authority_row += "<br>";
82 authority_row += "<br>";
83 authority_row += "<h2>Contacts</h2>";
84 authority_row += "<b>Legal:</b> ";
88 TODO: find a way to express JSON correctly given the constrains: CSV / JSON
90 legal = jQuery.parseJSON(val.legal);
92 $.each(legal, function(k,v){
93 authority_row += k+" "+v+"<br>";
96 authority_row += val.legal+"<br>";
98 authority_row += "<br>";
99 authority_row += "<b>Scientific:</b> ";
100 scientific = jQuery.parseJSON(val.scientific);
101 if($.isArray(scientific)){
102 $.each(scientific, function(v){
103 authority_row += v+", ";
107 authority_row += val.scientific+"<br>";
109 onelab_membership = "<b>Status: </b>"+val.onelab_membership;
110 onelab_data.push(onelab_membership);
112 authority_data.push(authority_row);
114 $("div#authority-data").html(authority_data.join( "" ));
115 $("div#onelab-data").html(onelab_data.join( "" ));
116 $("div#authority-tab-loaded").css("display","block");
117 $("div#authority-tab-loading").css("display","none");
120 $.post("/rest/slice/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
121 var list_slices = [];
122 var table_slices = [];
123 /* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "user", "slice_urn", "slice_expires" */
124 $.each( data, function( key, val ) {
125 list_slices.push( "<li><a href=\"portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
126 if(val.nodes=="undefined" || val.nodes==null){
129 nodes_length=val.nodes.length;
132 if(val.user=="undefined" || val.user==null){
135 user_length=val.user.length;
138 if(val.slice_url=="undefined" || val.slice_url==null){
141 slice_url="<a href='"+val.slice_url+"' target='_blank'>"+val.slice_url+"</a>";
144 slice_row = "<tr id='"+val.slice_hrn+"'>";
145 slice_row += "<td><input type='checkbox' class='slice' id='"+val.slice_hrn+"'></td>";
146 slice_row += "<td><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></td>";
147 slice_row += "<td>"+user_length+"</td>";
148 slice_row += "<td>"+slice_url+"</td>";
149 slice_row += "<td>"+nodes_length+"</td>";
150 slice_row += "<td>"+val.slice_expires+"</td>";
151 slice_row += "</tr>";
152 table_slices.push(slice_row);
156 /* $("div#slice-list").html($( "<ul/>", { html: list_slices.join( "" ) })); */
157 $("table#slice-tab tr:last").after(table_slices.join( "" ));
158 $("div#slice-tab-loaded").css("display","block");
159 $("div#slice-tab-loading").css("display","none");
162 $.post("/rest/user/",{'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>" );
172 user_row = "<tr id='"+val.user_hrn+"'>";
173 user_row += "<td><input type='checkbox' class='user' id='"+val.user_hrn+"'></td>";
174 user_row += "<td>"+val.user_email+"</td>";
175 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>";
180 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");