{% block head %}
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/validate_pending.css" />
+<script type="text/javascript">
+ function on_click_event() {
+ var ids = [];
+ $('.portal__validate__checkbox').each(function(i, el) {
+ if ($(el).attr('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/validate_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">' + name + '</font>';
+ $('#portal__validate__checkbox__' + request_type__id).hide();
+ } else {
+ status_str += '<font color="red">' + name + ' (' + result.description + ')</font>';
+ }
+ });
+ $('#portal__status__' + request_type__id).html(status_str)
+
+
+ });
+ }
+ );
+ }
+ }
+</script>
{% endblock %}
{% block unfold1_main %}
<span class='type'>{{ request.type }}</span>
<span class='id'>{{ request.id }}</span>
<span class='timestamp'>{{ request.timestamp }}</span>
- <span class='details'>{{ request.details }}</span>
+ <span class='authority'>{{ request.authority_hrn }}</span>
+
+ {% if request.type == 'user' %}
+ <span class='details'>First name: {{request.first_name}} -- Last name: {{request.last_name}} -- Email: {{request.email}}</span>
+ {% else %}
+ {% if request.type == 'slice' %}
+ <span class='details'>Number of nodes: {{request.number_of_nodes}} -- Type of nodes: {{request.type_of_nodes}} -- Purpose: {{request.purpose}}</span>
+ {% else %} {# authority #}
+ <span class='details'>TODO</span>
+ {% endif %}
+ {% endif %}
+
{% if request.allowed == 'allowed' %}
- <input type='checkbox'/>
+ <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
{% else %}
{% if request.allowed == 'expired' %}
expired
denied
{% endif %}
{% endif %}
+ <span class='status' id='portal__status__{{request.type}}__{{request.id}}'></span>
</div>
{% endfor %}
{% endfor %}
<span class='timestamp'>{{ request.timestamp }}</span>
<span class='details'>{{ request.details }}</span>
{% if request.allowed == 'allowed' %}
- <input type='checkbox'/>
+ <input class='portal__validate__checkbox' id='portal__validate__checkbox__{{request.type}}__{{request.id}}' type='checkbox'/>
{% else %}
{% if request.allowed == 'expired' %}
expired
denied
{% endif %}
{% endif %}
+ <span class='status' id='portal__status__{{request.type}}__{{request.id}}'></span>
</div>
{% endfor %}
{% endfor %}
{% endif %}
+<input type='button' id='portal__validate' value='Validate' onclick='on_click_event();'/>
+
{% endblock %}