execution_list.jinja2 3.5 KB
Newer Older
Daniele Venzano's avatar
Daniele Venzano committed
1
{% extends "base_user.jinja2" %}
2 3 4
{% block title %}Home{% endblock %}

{% block custom_head %}
5 6 7
    <script src="{{ static_url("sorttable.js") }}" type="application/javascript"></script>
    <script src="{{ static_url("moment.min.js") }}" type="application/javascript"></script>
    <script src="{{ static_url("moment-timezone.min.js") }}" type="application/javascript"></script>
8 9
    <script>
    function format_timestamp(ts) {
10 11 12
        var m = moment.utc(ts);
        m.local();
        document.write(m.calendar());
13 14 15 16 17 18
    }
    </script>
{% endblock %}

{% block content %}
    <div id="my_executions">
19
    <label class="filter">All executions <input class="filter" placeholder="Filter" /></label>
20 21 22 23 24 25
    {% if max_page > 0 %}
        <p>Pages:
            {% for page_n in range(0, max_page) %}
            {% if page_n == current_page %}
            {{ page_n + 1 }}&nbsp;
            {% else %}
26
            <a href="{{ reverse_url("execution_list_page", page_n) }}">{{ page_n + 1 }}</a>&nbsp;
27 28 29 30
            {% endif %}
            {% endfor %}
        </p>
    {% endif %}
31 32 33 34 35
    <table id="exec_list" class="app_list sortable">
    <thead>
    <tr>
        <th>ID</th>
        <th>Execution name</th>
Daniele Venzano's avatar
Daniele Venzano committed
36
        {% if user.role.can_operate_others %}
37 38 39
        <th>User</th>
        {% endif %}
        <th>Status</th>
40
        <th>Submitted</th>
41 42
        <th>Started</th>
        <th>Finished</th>
43
        <th class="sorttable_nosort">Actions</th>
44 45
    </tr>
    </thead>
46
    <tbody class="list">
47
        {% for e in executions %}
48
            <tr>
49
                <td>{{ e.id }}</td>
50
                <td class="exec-name"><a href="{{ reverse_url("execution_inspect", e.id) }}">{{ e.name }}</a></td>
Daniele Venzano's avatar
Daniele Venzano committed
51 52
                {% if user.role.can_operate_others %}
                <td>{{ e.owner.username }}</td>
53 54
                {% endif %}
                <td>{{ e.status }}</td>
55
                <td sorttable_customkey="{{ e.time_submit }}"><script>format_timestamp("{{ e.time_submit }}")</script></td>
56
                {% if e.time_start == None %}
57
                <td sorttable_customkey="-1">not yet</td>
58
                {% else %}
59
                <td sorttable_customkey="{{ e.time_start }}"><script>format_timestamp("{{ e.time_start }}")</script></td>
60 61
                {% endif %}
                {% if e.time_end == None %}
62
                <td sorttable_customkey="-1">not yet</td>
63
                {% else %}
64
                <td sorttable_customkey="{{ e.time_end }}"><script>format_timestamp("{{ e.time_end }}")</script></td>
65 66
                {% endif %}
                {% if e.is_active %}
67
                    <td><a href="{{ reverse_url("execution_terminate", e.id) }}">Terminate</a></td>
68 69 70 71 72
                {% endif %}
            </tr>
        {% endfor %}
    </tbody>
    </table>
73 74 75 76 77 78
    {% if max_page > 0 %}
        <p>Pages:
            {% for page_n in range(0, max_page) %}
            {% if page_n == current_page %}
            {{ page_n + 1 }}&nbsp;
            {% else %}
79
            <a href="{{ reverse_url("execution_list_page", page_n) }}">{{ page_n + 1 }}</a>&nbsp;
80 81 82 83
            {% endif %}
            {% endfor %}
        </p>
    {% endif %}
84 85
    </div>

86 87 88 89 90 91 92 93 94 95 96 97 98
    <script>
    var $rows = $('#exec_list tbody tr');
    $('input.filter').keyup(function() {
        var val = '^(?=.*\\b' + $.trim($(this).val()).split(/\s+/).join('\\b)(?=.*\\b') + ').*$',
            reg = RegExp(val, 'i'),
            text;

        $rows.show().filter(function() {
            text = $(this).text().replace(/\s+/g, ' ');
            return !reg.test(text);
        }).hide();
    });
    </script>
99
{% endblock %}