1 <script type="text/javascript">
2 $(document).ready(function() {
3 $("li#nav-request").addClass("active");
4 $('table.requests').dataTable();
6 function on_click_event() {
8 $('.portal__validate__checkbox').each(function(i, el) {
9 if ($(el).prop('checked')) {
10 // portal__validate__checkbox__slice__2
11 var id_array = $(el).attr('id').split('__');
13 ids.push(id_array[3] + '__' + id_array[4]);
17 var id_str = ids.join('/');
21 $.getJSON('/portal/validate_action/' + id_str,
23 $.each(status, function(request_type__id, request_status) {
24 // request_status: NAME -> dict (status, description)
26 $.each(request_status, function(name, result) {
31 status_str += '<font color="green">OK</font>';
32 $('#portal__validate__checkbox__' + request_type__id).hide();
34 status_str += '<font color="red">ERROR: ' + result.description + '</font>';
37 $('#portal__status__' + request_type__id).html(status_str);
45 function on_click_reject() {
47 $('.portal__validate__checkbox').each(function(i, el) {
48 if ($(el).prop('checked')) {
49 // portal__validate__checkbox__slice__2
50 var id_array = $(el).attr('id').split('__');
52 ids.push(id_array[3] + '__' + id_array[4]);
56 var id_str = ids.join('/');
60 $.getJSON('/portal/reject_action/' + id_str,
62 $.each(status, function(request_type__id, request_status) {
63 // request_status: NAME -> dict (status, description)
65 $.each(request_status, function(name, result) {
70 status_str += '<font color="green">Rejected</font>';
71 $('#portal__validate__checkbox__' + request_type__id).hide();
73 status_str += '<font color="red">ERROR: ' + result.description + '</font>';
76 $('#portal__status__' + request_type__id).html(status_str);
86 <div class="container-fluid">
87 <div class="col-md-12">
88 <h2>From your authorities</h2>
90 {% if my_authorities %}
91 <table class="table-responsive requests">
103 {% for authority, requests in my_authorities.items %}
105 {% for request in requests %}
107 {% if request.type == 'user' %}
109 {% elif request.type == 'slice' %}
114 <td><span class="gray small">{{ request.id }}</span></td>
116 {% if request.allowed == 'allowed' %}
117 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
119 {% if request.allowed == 'expired' %}expired{% else %}denied{% endif %}
122 <td><span class="type">{{ request.type }}</span></td>
123 <td><i>{{authority}}{{request.site_authority}}</i></td>
125 {% if request.type == 'user' %}
126 <b>{{request.first_name}} {{request.last_name}}</b> <<a href="mailto:{{request.email}}">{{request.email}}</a>>
127 {% elif request.type == 'slice' %}
128 <b>{{request.slice_name}}</b> -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
130 <b>{{request.site_name}}</b> ({{request.site_authority}}) -- {{request.address_city}}, {{request.address_country}}
133 <td>{{ request.timestamp }}</td>
135 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
137 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
146 <div class="col-md-12">
147 <i>There is no pending request waiting for validation.</i>
154 <div class="col-md-12">
155 <h2>From your sub-authorities</h2>
157 {% if sub_authorities %}
159 {% for authority, requests in sub_authorities.items %}
160 <div class="col-md-12">
161 <h3>{{authority}}</h3>
162 <table class="table">
170 {% for request in requests %}
173 {% if request.allowed == 'allowed' %}
174 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
176 {% if request.allowed == 'expired' %}
178 {% else %} {# denied #}
183 <td>{{ request.type }}</td>
184 <td>{{ request.id }}</td>
186 {% if request.type == 'user' %}
187 Login: {{request.login}} -- First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}
189 {% if request.type == 'slice' %}
190 Slice name: {{request.slice_name}} -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
191 {% else %} {# authority #}
192 Authority name: {{request.site_name}} -- authority_hrn: {{request.site_authority}} -- City: {{request.address_city}} -- Country: {{request.address_country}}
196 <td>{{ request.timestamp }}</td>
198 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
200 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
207 <div class="col-md-12">
208 <i>There is no pending request waiting for validation.</i>
212 <div class="col-md-12">
213 <h2>From your authorities with delegation</h2>
216 {% if delegation_authorities %}
218 {% for authority, requests in delegation_authorities.items %}
219 <div class="col-md-12">
220 <h3>{{authority}}</h3>
221 <table class="table">
229 {% for request in requests %}
232 {% if request.allowed == 'allowed' %}
233 <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
235 {% if request.allowed == 'expired' %}
237 {% else %} {# denied #}
242 <td>{{ request.type }}</td>
243 <td>{{ request.id }}</td>
245 {% if request.type == 'user' %}
246 Login: {{request.login}} -- First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}
248 {% if request.type == 'slice' %}
249 Slice name: {{request.slice_name}} -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
250 {% else %} {# authority #}
251 Authority name: {{request.site_name}} -- authority_hrn: {{request.site_authority}} -- City: {{request.address_city}} -- Country: {{request.address_country}}
255 <td>{{ request.timestamp }}</td>
257 <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
259 <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
266 <div class="col-md-12">
267 <i>There is no pending request waiting for validation.</i>
271 <div class="col-md-12">
272 <button class="btn btn-onelab" type="button" id="portal__validate" onclick="on_click_event();"><span class="glyphicon glyphicon-ok"></span> Validate</button>
273 <button class="btn btn-danger" type="button" id="portal__reject" onclick="on_click_reject();"><span class="glyphicon glyphicon-remove"></span> Reject</button>