1 <script type="text/javascript">
2 $(document).ready(function() {
3 $("li#nav-request").addClass("active");
5 function on_click_event() {
7 $('.portal__validate__checkbox').each(function(i, el) {
8 if ($(el).prop('checked')) {
9 // portal__validate__checkbox__slice__2
10 var id_array = $(el).attr('id').split('__');
12 ids.push(id_array[3] + '__' + id_array[4]);
16 var id_str = ids.join('/');
20 $.getJSON('/portal/validate_action/' + id_str,
22 $.each(status, function(request_type__id, request_status) {
23 // request_status: NAME -> dict (status, description)
25 $.each(request_status, function(name, result) {
30 status_str += '<font color="green">OK</font>';
31 $('#portal__validate__checkbox__' + request_type__id).hide();
33 status_str += '<font color="red">ERROR: ' + result.description + '</font>';
36 $('#portal__status__' + request_type__id).html(status_str);
44 function on_click_reject() {
46 $('.portal__validate__checkbox').each(function(i, el) {
47 if ($(el).prop('checked')) {
48 // portal__validate__checkbox__slice__2
49 var id_array = $(el).attr('id').split('__');
51 ids.push(id_array[3] + '__' + id_array[4]);
55 var id_str = ids.join('/');
59 $.getJSON('/portal/reject_action/' + id_str,
61 $.each(status, function(request_type__id, request_status) {
62 // request_status: NAME -> dict (status, description)
64 $.each(request_status, function(name, result) {
69 status_str += '<font color="green">OK</font>';
70 $('#portal__validate__checkbox__' + request_type__id).hide();
72 status_str += '<font color="red">ERROR: ' + result.description + '</font>';
75 $('#portal__status__' + request_type__id).html(status_str);
85 <div class="col-md-12">
86 <h2>From your authorities</h2>
88 {% if my_authorities %}
90 {% for authority, requests in my_authorities.items %}
92 <div class="col-md-12">
93 <h2>{{authority}}</h2>
104 {% for request in requests %}
108 {% if request.allowed == 'allowed' %}
109 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
111 {% if request.allowed == 'expired' %}
113 {% else %} {# denied #}
118 <td>{{ request.type }}</td>
119 <td>{{ request.id }}</td>
121 {% if request.type == 'user' %}
122 Login: {{request.login}} -- First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}
124 {% if request.type == 'slice' %}
125 Slice name: {{request.slice_name}} -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
126 {% else %} {# authority #}
127 Authority name: {{request.site_name}} -- authority_hrn: {{request.site_authority}} -- City: {{request.address_city}} -- Country: {{request.address_country}}
131 <td>{{ request.timestamp }}</td>
133 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
135 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
144 <div class="col-md-12">
145 <i>There is no pending request waiting for validation.</i>
149 <div class="col-md-12">
150 <h2>From your sub-authorities</h2>
152 {% if sub_authorities %}
154 {% for authority, requests in sub_authorities.items %}
155 <div class="col-md-12">
156 <h3>{{authority}}</h3>
157 <table class="table">
165 {% for request in requests %}
168 {% if request.allowed == 'allowed' %}
169 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
171 {% if request.allowed == 'expired' %}
173 {% else %} {# denied #}
178 <td>{{ request.type }}</td>
179 <td>{{ request.id }}</td>
181 {% if request.type == 'user' %}
182 Login: {{request.login}} -- First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}
184 {% if request.type == 'slice' %}
185 Slice name: {{request.slice_name}} -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
186 {% else %} {# authority #}
187 Authority name: {{request.site_name}} -- authority_hrn: {{request.site_authority}} -- City: {{request.address_city}} -- Country: {{request.address_country}}
191 <td>{{ request.timestamp }}</td>
193 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
195 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
202 <div class="col-md-12">
203 <i>There is no pending request waiting for validation.</i>
207 <div class="col-md-12">
208 <h2>From your authorities with delegation</h2>
211 {% if delegation_authorities %}
213 {% for authority, requests in delegation_authorities.items %}
214 <div class="col-md-12">
215 <h3>{{authority}}</h3>
216 <table class="table">
224 {% for request in requests %}
227 {% if request.allowed == 'allowed' %}
228 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
230 {% if request.allowed == 'expired' %}
232 {% else %} {# denied #}
237 <td>{{ request.type }}</td>
238 <td>{{ request.id }}</td>
240 {% if request.type == 'user' %}
241 Login: {{request.login}} -- First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}
243 {% if request.type == 'slice' %}
244 Slice name: {{request.slice_name}} -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
245 {% else %} {# authority #}
246 Authority name: {{request.site_name}} -- authority_hrn: {{request.site_authority}} -- City: {{request.address_city}} -- Country: {{request.address_country}}
250 <td>{{ request.timestamp }}</td>
252 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
254 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
261 <div class="col-md-12">
262 <i>There is no pending request waiting for validation.</i>
266 <div class="col-md-12">
267 <button class="btn btn-onelab" type="button" id="portal__validate" onclick="on_click_event();"><span class="glyphicon glyphicon-ok"></span> Validate</button>
268 <button class="btn btn-onelab" type="button" id="portal__reject" onclick="on_click_reject();"><span class="glyphicon glyphicon-remove"></span> Reject</button>