1 <script type="text/javascript">
2 $(document).ready(function() {
3 $("li#nav-request").addClass("active");
4 $('table.requests').dataTable({
6 "bScrollCollapse": true,
9 "bLengthChange": false,
17 function on_click_event() {
19 $('.portal__validate__checkbox').each(function(i, el) {
20 if ($(el).prop('checked')) {
21 // portal__validate__checkbox__slice__2
22 var id_array = $(el).attr('id').split('__');
24 ids.push(id_array[3] + '__' + id_array[4]);
28 var id_str = ids.join('/');
32 $.getJSON('/portal/validate_action/' + id_str,
34 $.each(status, function(request_type__id, request_status) {
35 // request_status: NAME -> dict (status, description)
37 $.each(request_status, function(name, result) {
42 status_str += '<font color="green">OK</font>';
43 $('#portal__validate__checkbox__' + request_type__id).hide();
45 status_str += '<font color="red">ERROR: ' + result.description + '</font>';
48 $('#portal__status__' + request_type__id).html(status_str);
56 function on_click_reject() {
58 $('.portal__validate__checkbox').each(function(i, el) {
59 if ($(el).prop('checked')) {
60 // portal__validate__checkbox__slice__2
61 var id_array = $(el).attr('id').split('__');
63 ids.push(id_array[3] + '__' + id_array[4]);
67 var id_str = ids.join('/');
71 $.getJSON('/portal/reject_action/' + id_str,
73 $.each(status, function(request_type__id, request_status) {
74 // request_status: NAME -> dict (status, description)
76 $.each(request_status, function(name, result) {
81 status_str += '<font color="green">Rejected</font>';
82 $('#portal__validate__checkbox__' + request_type__id).hide();
84 status_str += '<font color="red">ERROR: ' + result.description + '</font>';
87 $('#portal__status__' + request_type__id).html(status_str);
97 <div class="container-fluid">
98 <div class="col-md-12">
99 <h2>From your authorities</h2>
101 {% if my_authorities %}
102 <div class="col-md-12">
103 <table class="table requests">
116 {% for authority, requests in my_authorities.items %}
118 {% for request in requests %}
120 {% if request.type == 'user' %}
122 {% elif request.type == 'slice' %}
127 <td><span class="gray small">{{ request.id }}</span></td>
129 {% if request.allowed == 'allowed' %}
130 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
132 {% if request.allowed == 'expired' %}expired{% else %}denied{% endif %}
135 <td><span class="type">{{ request.type }}</span></td>
136 <td><i>{{authority}}{{request.site_authority}}</i></td>
138 {% if request.type == 'user' %}
139 <b>{{request.first_name}} {{request.last_name}}</b> <<a href="mailto:{{request.email}}">{{request.email}}</a>>
140 {% elif request.type == 'slice' %}
141 <b>{{request.slice_name}}</b> -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
143 <b>{{request.site_name}}</b> ({{request.site_authority}}) -- {{request.address_city}}, {{request.address_country}}
146 <td>{{ request.timestamp }}</td>
148 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
150 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
160 <div class="col-md-12">
161 <i>There is no pending request waiting for validation.</i>
168 <div class="col-md-12">
169 <h2>From your sub-authorities</h2>
171 {% if sub_authorities %}
173 {% for authority, requests in sub_authorities.items %}
174 <div class="col-md-12">
175 <h3>{{authority}}</h3>
176 <table class="table">
184 {% for request in requests %}
187 {% if request.allowed == 'allowed' %}
188 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
190 {% if request.allowed == 'expired' %}
192 {% else %} {# denied #}
197 <td>{{ request.type }}</td>
198 <td>{{ request.id }}</td>
200 {% if request.type == 'user' %}
201 Login: {{request.login}} -- First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}
203 {% if request.type == 'slice' %}
204 Slice name: {{request.slice_name}} -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
205 {% else %} {# authority #}
206 Authority name: {{request.site_name}} -- authority_hrn: {{request.site_authority}} -- City: {{request.address_city}} -- Country: {{request.address_country}}
210 <td>{{ request.timestamp }}</td>
212 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
214 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
221 <div class="col-md-12">
222 <i>There is no pending request waiting for validation.</i>
226 <div class="col-md-12">
227 <h2>From your authorities with delegation</h2>
230 {% if delegation_authorities %}
232 {% for authority, requests in delegation_authorities.items %}
233 <div class="col-md-12">
234 <h3>{{authority}}</h3>
235 <table class="table">
243 {% for request in requests %}
246 {% if request.allowed == 'allowed' %}
247 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
249 {% if request.allowed == 'expired' %}
251 {% else %} {# denied #}
256 <td>{{ request.type }}</td>
257 <td>{{ request.id }}</td>
259 {% if request.type == 'user' %}
260 Login: {{request.login}} -- First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}
262 {% if request.type == 'slice' %}
263 Slice name: {{request.slice_name}} -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
264 {% else %} {# authority #}
265 Authority name: {{request.site_name}} -- authority_hrn: {{request.site_authority}} -- City: {{request.address_city}} -- Country: {{request.address_country}}
269 <td>{{ request.timestamp }}</td>
271 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
273 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
280 <div class="col-md-12">
281 <i>There is no pending request waiting for validation.</i>
285 <div class="col-md-12">
286 <button class="btn btn-onelab" type="button" id="portal__validate" onclick="on_click_event();"><span class="glyphicon glyphicon-ok"></span> Validate</button>
287 <button class="btn btn-danger" type="button" id="portal__reject" onclick="on_click_reject();"><span class="glyphicon glyphicon-remove"></span> Reject</button>