attributes tweaks
[qcg-portal.git] / qcg / templates / qcg / jobs.html
1 {% extends 'qcg/base.html' %}
2
3 {% load staticfiles %}
4
5 {% block extra_css %}
6     <link href="{% static 'qcg/treegrid/css/jquery.treegrid.css' %}" rel="stylesheet">
7
8     <style>
9         .treegrid-expander {
10             opacity: 0.5;
11         }
12
13         .treegrid-expander:hover {
14             opacity: 1;
15         }
16     </style>
17 {% endblock %}
18
19 {% block extra_js %}
20     <script src="{% static 'qcg/treegrid/js/jquery.treegrid.js' %}"></script>
21
22     <script>
23         $(function() {
24             $('.tree').treegrid({
25                 initialState: 'collapsed',
26                 expanderExpandedClass: 'glyphicon glyphicon-chevron-down small',
27                 expanderCollapsedClass: 'glyphicon glyphicon-chevron-right small',
28                 onChange: function() {
29                     $(this).find('.glyphicon-folder-open,.glyphicon-folder-close')
30                             .toggleClass('glyphicon-folder-open').toggleClass('glyphicon-folder-close');
31                 }
32             });
33
34
35         });
36     </script>
37 {% endblock %}
38
39 {% block container %}
40     <h1 class="page-header">
41         {% block title %}Lista zadań{% endblock %}
42     </h1>
43
44 {#    <form class="row form-inline">#}
45 {#        <div class="col-md-9 col-md-offset-1">#}
46 {#            <div class="form-group">#}
47 {#                <label class="sr-only" for="search">Szukaj w opisie lub uwagach</label>#}
48 {#                <input type="text" class="form-control" id="search" placeholder="Szukaj w opisie lub uwagach">#}
49 {#            </div>#}
50 {#            <div class="form-group">#}
51 {#                <label class="sr-only" for="status">Status</label>#}
52 {#                <select class="form-control" id="status">#}
53 {#                  <option>Wybierz stan</option>#}
54 {#                  <option>PENDING</option>#}
55 {#                  <option>RUNNING</option>#}
56 {#                  <option>FAILED</option>#}
57 {#                  <option>FINISHED</option>#}
58 {#                </select>#}
59 {#            </div>#}
60 {#            <div class="form-group">#}
61 {#                <label class="sr-only" for="cluster">Klaster</label>#}
62 {#                <select class="form-control" id="cluster">#}
63 {#                  <option>Wybierz klaster</option>#}
64 {#                  <option>Inula</option>#}
65 {#                  <option>Galera</option>#}
66 {#                  <option>Hydra</option>#}
67 {#                  <option>Zeus</option>#}
68 {#                </select>#}
69 {#            </div>#}
70 {#        </div>#}
71 {#        <div class="col-md-1">#}
72 {#            <button type="submit" class="btn btn-default">Filtruj</button>#}
73 {#        </div>#}
74 {#    </form>#}
75 {##}
76 {#    <hr />#}
77
78
79     <nav class="text-center" style="margin-bottom: 15px">
80         <form action="{{ request.path }}" method="get" class="form-inline" role="form" style="display: inline-block">
81             <div class="input-group input-group-sm">
82                 <span class="input-group-btn">
83                     {% if page.has_previous %}
84                         <a href="{{ request.path }}?page={{ page.previous_page_number }}" class="btn btn-default">
85                     {% else %}
86                         <a href="#" class="btn btn-default disabled">
87                     {% endif %}
88                         <span class="glyphicon glyphicon-chevron-left"></span>
89                     </a>
90                 </span>
91                 <label class="sr-only" for="page">Strona</label>
92                 <input type="text" class="form-control text-center" id="page" name="page" value="{{ page.number }}" style="width: 50px">
93                 <span class="input-group-btn">
94                     {% if page.has_next %}
95                         <a href="{{ request.path }}?page={{ page.next_page_number }}" class="btn btn-default">
96                     {% else %}
97                         <a href="#" class="btn btn-default disabled">
98                     {% endif %}
99                         <span class="glyphicon glyphicon-chevron-right"></span>
100                     </a>
101                 </span>
102             </div>
103         </form>
104         &nbsp;z&nbsp;
105         <a href="{{ request.path }}?page={{ num_pages }}">{{ num_pages }}</a>
106     </nav>
107
108     <table class="table table-hover tree">
109         <thead>
110             <tr>
111                 <th style="width: 80px"></th>
112                 <th>Opis</th>
113                 <th>Wysłane</th>
114                 <th>Start</th>
115                 <th>Koniec</th>
116                 <th>Status</th>
117                 <th>Host</th>
118 {#                <th>Uwagi</th>#}
119             </tr>
120         </thead>
121         <tbody>
122             {% regroup page by job as jobs %}
123
124             {% for job in jobs %}
125                 {% ifequal job.list|length 1 %}
126                     {% with job.list.0 as task %}
127                         <tr class="treegrid-{{ forloop.counter }}">
128                             <td>
129                                 <a href="{{ task.get_absolute_url }}">
130                                     <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
131 {#                                    {{ task }}#}
132                                 </a>
133                             </td>
134                             <td>{{ task.note }}</td>
135                             <td>{{ task.submission_time|timesince }} temu</td>
136                             <td>{{ task.start_time|date:"CUSTOM_DATETIME_FORMAT" }}</td>
137                             <td>{{ task.finish_time|date:"CUSTOM_DATETIME_FORMAT" }}</td>
138                             <td>{{ task.get_status_display }}</td>
139                             <td>{{ task.short_host_names|join:', ' }}</td>
140                         </tr>
141                     {% endwith %}
142                 {% else %}
143                     <tr class="treegrid-{{ forloop.counter }}">
144                         <td>
145                             <a href="{{ job.grouper.get_absolute_url }}">
146                                 <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span>
147 {#                                {{ job.grouper }}#}
148                             </a>
149                         </td>
150                         <td>{{ job.grouper.note }}</td>
151                         <td>{{ job.grouper.submission_time|timesince  }} temu</td>
152                         <td>-</td>
153                         <td>{{ job.grouper.finish_time|date:"CUSTOM_DATETIME_FORMAT" }}</td>
154                         <td>{{ job.grouper.get_status_display }}</td>
155                         <td>-</td>
156                     </tr>
157
158                     {% for task in job.list %}
159                         <tr class="treegrid-{{ forloop.parentloop.counter }}-{{ forloop.counter }} treegrid-parent-{{ forloop.parentloop.counter }}">
160                             <td>
161                                 <a href="{{ task.get_absolute_url }}">
162                                     <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
163 {#                                    {{ task }}#}
164                                 </a>
165                             </td>
166                             <td>{{ task.note }}</td>
167                             <td>{{ task.submission_time|timesince  }} temu</td>
168                             <td>{{ task.start_time|date:"CUSTOM_DATETIME_FORMAT" }}</td>
169                             <td>{{ task.finish_time|date:"CUSTOM_DATETIME_FORMAT" }}</td>
170                             <td>{{ task.get_status_display }}</td>
171                             <td>{{ task.short_host_names|join:', ' }}</td>
172                         </tr>
173                     {% endfor %}
174                 {% endifequal %}
175             {% endfor %}
176         </tbody>
177     </table>
178
179     <nav class="text-center">
180         <ul class="pagination">
181             {% if page.has_previous %}
182                 <li>
183                     <a href="{{ request.path }}?page={{ page.previous_page_number }}" aria-label="Previous">
184                     <span aria-hidden="true"><span class="glyphicon glyphicon-chevron-left"></span>&nbsp;poprzednia</span>
185                 </a>
186             {% endif %}
187             </li>
188
189             <li{% ifequal page.number 1 %} class="active"{% endifequal %}>
190                 <a href="{{ request.path }}?page=1">1</a>
191             </li>
192
193             {% if pages_range.0 > 2 %}
194                 <li class="disabled"><span aria-hidden="true"><strong>&hellip;</strong></span></li>
195             {% endif %}
196
197             {% for num in pages_range %}
198                 <li{% ifequal page.number num %} class="active"{% endifequal %}>
199                     <a href="{{ request.path }}?page={{ num }}">{{ num }}</a>
200                 </li>
201             {% endfor %}
202
203             <li class="disabled"><span aria-hidden="true"><strong>z</strong></span></li>
204             <li><a href="{{ request.path }}?page={{ num_pages }}">{{ num_pages }}</a></li>
205
206             {% if page.has_next %}
207                 <li>
208                     <a href="{{ request.path }}?page={{ page.next_page_number }}" aria-label="Next">
209                     <span aria-hidden="true">następna&nbsp;<span class="glyphicon glyphicon-chevron-right"></span></span>
210                 </a>
211             {% endif %}
212             </li>
213         </ul>
214     </nav>
215
216 {% endblock container %}