<script type="text/javascript">
$(document).ready(function() {
$("li#nav-request").addClass("active");
- $('table.requests').dataTable({
- "sDom": "frtiS",
- "bScrollCollapse": true,
- "bStateSave": true,
- "bPaginate": false,
- "bLengthChange": false,
- "bFilter": false,
- "bSort": true,
- "bInfo": false,
- "bAutoWidth": true,
- "bAutoHeight": false,
- });
});
function on_click_event() {
var ids = [];
});
if (ids.length > 0) {
var id_str = ids.join('/');
-
// XXX spinner
-
$.getJSON('/portal/validate_action/' + id_str,
function(status) {
$.each(status, function(request_type__id, request_status) {
$('#portal__status__' + request_type__id).html(status_str);
- });
- }
- );
- }
- }
- function on_click_reject() {
- var ids = [];
- $('.portal__validate__checkbox').each(function(i, el) {
- if ($(el).prop('checked')) {
- // portal__validate__checkbox__slice__2
- var id_array = $(el).attr('id').split('__');
- // push(slice__2)
- ids.push(id_array[3] + '__' + id_array[4]);
- }
- });
- if (ids.length > 0) {
- var id_str = ids.join('/');
-
- // XXX spinner
-
- $.getJSON('/portal/reject_action/' + id_str,
- function(status) {
- $.each(status, function(request_type__id, request_status) {
- // request_status: NAME -> dict (status, description)
- var status_str = '';
- $.each(request_status, function(name, result) {
- if (status_str != '')
- status_str += ' -- ';
-
- if (result.status) {
- status_str += '<font color="green">Rejected</font>';
- $('#portal__validate__checkbox__' + request_type__id).hide();
- } else {
- status_str += '<font color="red">ERROR: ' + result.description + '</font>';
- }
- });
- $('#portal__status__' + request_type__id).html(status_str);
-
-
});
}
);
}
</script>
-<div class="container-fluid">
<div class="col-md-12">
<h2>From your authorities</h2>
</div>
{% if my_authorities %}
-<div class="col-md-12">
- <table class="table requests">
- <thead>
- <tr>
- <th>ID</th>
- <th></th>
- <th>Type</th>
- <th>Authority</th>
- <th>Info</th>
- <th>Date</th>
- <th>Status</th>
- </tr>
- </thead>
- <tbody>
+
{% for authority, requests in my_authorities.items %}
- {% for request in requests %}
-
+ <div class="col-md-12">
+ <h2>{{authority}}</h2>
+ </div>
+
+ <table class="table">
+ <th>
+ <td>Type</td>
+ <td>Id</td>
+ <td>Details</td>
+ <td>Timestamp</td>
+ <td>Status</td>
+ </th>
+ {% for request in requests %}
+
+ <tr>
+ <td>
+ {% if request.allowed == 'allowed' %}
+ <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
+ {% else %}
+ {% if request.allowed == 'expired' %}
+ expired
+ {% else %} {# denied #}
+ denied
+ {% endif %}
+ {% endif %}
+ </td>
+ <td>{{ request.type }}</td>
+ <td>{{ request.id }}</td>
+ <td>
{% if request.type == 'user' %}
- <tr>
- {% elif request.type == 'slice' %}
- <tr class="info">
- {% else %}
- <tr class="active">
- {% endif %}
- <td><span class="gray small">{{ request.id }}</span></td>
- <td>
- {% if request.allowed == 'allowed' %}
- <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
- {% else %}
- {% if request.allowed == 'expired' %}expired{% else %}denied{% endif %}
- {% endif %}
- </td>
- <td><span class="type">{{ request.type }}</span></td>
- <td><i>{{authority}}{{request.site_authority}}</i></td>
- <td>
- {% if request.type == 'user' %}
- <b>{{request.first_name}} {{request.last_name}}</b> <<a href="mailto:{{request.email}}">{{request.email}}</a>>
- {% elif request.type == 'slice' %}
+ <b>{{request.first_name}} {{request.last_name}}</b> <a href="mailto:{{request.email}}">{{request.email}}</a>
+ {% else %}
+ {% if request.type == 'slice' %}
<b>{{request.slice_name}}</b> -- Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}
- {% else %}
+ {% else %} {# authority #}
<b>{{request.site_name}}</b> ({{request.site_authority}}) -- {{request.address_city}}, {{request.address_country}}
{% endif %}
- </td>
- <td>{{ request.timestamp }}</td>
-
- <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
-
- <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
- </tr>
-
- {% endfor %}
-
+ {% endif %}
+ </td>
+ <td>{{ request.timestamp }}</td>
+
+ <td><span id='portal__status__{{request.type}}__{{request.id}}'></span></td>
+
+ <!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
+ </tr>
+
+ {% endfor %}
+ </table>
{% endfor %}
- </tbody>
- </table>
- </div>
+
{% else %}
<div class="col-md-12">
<i>There is no pending request waiting for validation.</i>
</div>
{% endif %}
-</div>
-
-
-<br />
+<div>nnllknjkn<br /><br /></div>
<div class="col-md-12">
<h2>From your sub-authorities</h2>
</div>
{% for authority, requests in sub_authorities.items %}
<div class="col-md-12">
- <h3>{{authority}}</h3>
- <table class="table">
+ <h2>{{authority}}</h2>
+ </div>
+
+ <table class="table">
<th>
<td>Type</td>
<td>Id</td>
<!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
</tr>
{% endfor %}
- </table>
- </div>
+ </table>
{% endfor %}
{% else %}
<div class="col-md-12">
<i>There is no pending request waiting for validation.</i>
</div>
{% endif %}
-<br />
+
<div class="col-md-12">
<h2>From your authorities with delegation</h2>
</div>
{% for authority, requests in delegation_authorities.items %}
<div class="col-md-12">
<h3>{{authority}}</h3>
- <table class="table">
+ </div>
+ <table class="table">
<th>
<td>Type</td>
<td>Id</td>
<!--<div class='portal_validate_request {{request.type}} {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}'> -->
</tr>
{% endfor %}
- </table>
- </div>
+ </table>
{% endfor %}
{% else %}
<div class="col-md-12">
<i>There is no pending request waiting for validation.</i>
</div>
{% endif %}
-<br />
<div class="col-md-12">
<button class="btn btn-onelab" type="button" id="portal__validate" onclick="on_click_event();"><span class="glyphicon glyphicon-ok"></span> Validate</button>
- <button class="btn btn-danger" type="button" id="portal__reject" onclick="on_click_reject();"><span class="glyphicon glyphicon-remove"></span> Reject</button>
</div>