synchronizing user jobs & basic task list view
[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     <table class="table table-hover tree">
79         <thead>
80             <tr>
81                 <th style="width: 80px"></th>
82                 <th>Opis</th>
83                 <th>Wysłane</th>
84                 <th>Start</th>
85                 <th>Koniec</th>
86                 <th>Status</th>
87                 <th>Host</th>
88 {#                <th>Uwagi</th>#}
89             </tr>
90         </thead>
91         <tbody>
92             {% regroup tasks by job as jobs %}
93
94             {% for job in jobs %}
95                 {% ifequal job.list|length 1 %}
96                     {% with job.list.0 as task %}
97                         <tr class="treegrid-{{ forloop.counter }}">
98                             <td>
99                                 <a href="{% url 'job' %}">
100                                     <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
101 {#                                    {{ task }}#}
102                                 </a>
103                             </td>
104                             <td>{{ task.note }}</td>
105                             <td>{{ task.submission_time }}</td>
106                             <td>{{ task.start_time }}</td>
107                             <td>{{ task.finish_time }}</td>
108                             <td>{{ task.get_status_display }}</td>
109                             <td>{{ task.hosts|join:', ' }}</td>
110                         </tr>
111                     {% endwith %}
112                 {% else %}
113                     <tr class="treegrid-{{ forloop.counter }}">
114                         <td>
115                             <a href="{% url 'job' %}">
116                                 <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span>
117 {#                                {{ job.grouper }}#}
118                             </a>
119                         </td>
120                         <td>{{ job.grouper.note }}</td>
121                         <td>{{ job.grouper.submission_time }}</td>
122                         <td>-</td>
123                         <td>{{ job.grouper.finish_time }}</td>
124                         <td>{{ job.grouper.get_status_display }}</td>
125                         <td>-</td>
126                     </tr>
127
128                     {% for task in job.list %}
129                         <tr class="treegrid-{{ forloop.parentloop.counter }}-{{ forloop.counter }} treegrid-parent-{{ forloop.parentloop.counter }}">
130                             <td>
131                                 <a href="{% url 'job' %}">
132                                     <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
133 {#                                    {{ task }}#}
134                                 </a>
135                             </td>
136                             <td>{{ task.note }}</td>
137                             <td>{{ task.submission_time }}</td>
138                             <td>{{ task.start_time }}</td>
139                             <td>{{ task.finish_time }}</td>
140                             <td>{{ task.get_status_display }}</td>
141                             <td>{{ task.hosts|join:', ' }}</td>
142                         </tr>
143                     {% endfor %}
144                 {% endifequal %}
145             {% endfor %}
146         </tbody>
147     </table>
148
149     <nav class="text-center">
150         <ul class="pagination">
151             <li>
152                 <a href="#" aria-label="Previous">
153                     <span aria-hidden="true">&laquo;</span>
154                 </a>
155             </li>
156             <li><a href="#">1</a></li>
157             <li><a href="#">2</a></li>
158             <li><a href="#">3</a></li>
159             <li><a href="#">4</a></li>
160             <li><a href="#">5</a></li>
161             <li>
162                 <a href="#" aria-label="Next">
163                     <span aria-hidden="true">&raquo;</span>
164                 </a>
165             </li>
166         </ul>
167     </nav>
168
169 {% endblock container %}