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>
166 {% if sub_authorities %}
168 <div class="col-md-12">
169 <h2>From your sub-authorities</h2>
172 {% for authority, requests in sub_authorities.items %}
173 <div class="col-md-12">
174 <h3>{{authority}}</h3>
175 <table class="table">
183 {% for request in requests %}
186 {% if request.allowed == 'allowed' %}
187 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
189 {% if request.allowed == 'expired' %}
191 {% else %} {# denied #}
196 <td>{{ request.type }}</td>
197 <td>{{ request.id }}</td>
199 {% if request.type == 'user' %}
200 Login: {{request.login}} -- First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}
202 {% if request.type == 'slice' %}
203 Slice name: {{request.slice_name}} -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
204 {% else %} {# authority #}
205 Authority name: {{request.site_name}} -- authority_hrn: {{request.site_authority}} -- City: {{request.address_city}} -- Country: {{request.address_country}}
209 <td>{{ request.timestamp }}</td>
211 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
213 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
220 {% if delegation_authorities %}
222 <div class="col-md-12">
223 <h2>From your authorities with delegation</h2>
226 {% for authority, requests in delegation_authorities.items %}
227 <div class="col-md-12">
228 <h3>{{authority}}</h3>
229 <table class="table">
237 {% for request in requests %}
240 {% if request.allowed == 'allowed' %}
241 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
243 {% if request.allowed == 'expired' %}
245 {% else %} {# denied #}
250 <td>{{ request.type }}</td>
251 <td>{{ request.id }}</td>
253 {% if request.type == 'user' %}
254 Login: {{request.login}} -- First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}
256 {% if request.type == 'slice' %}
257 Slice name: {{request.slice_name}} -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
258 {% else %} {# authority #}
259 Authority name: {{request.site_name}} -- authority_hrn: {{request.site_authority}} -- City: {{request.address_city}} -- Country: {{request.address_country}}
263 <td>{{ request.timestamp }}</td>
265 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
267 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
275 <div class="col-md-12">
276 <button class="btn btn-onelab" type="button" id="portal__validate" onclick="on_click_event();"><span class="glyphicon glyphicon-ok"></span> Validate</button>
277 <button class="btn btn-danger" type="button" id="portal__reject" onclick="on_click_reject();"><span class="glyphicon glyphicon-remove"></span> Reject</button>