job and task details view
[qcg-portal.git] / qcg / templates / qcg / jobs.html
index 747d382..b599429 100644 (file)
         {% block title %}Lista zadań{% endblock %}
     </h1>
 
-    <form class="row form-inline">
-        <div class="col-md-9 col-md-offset-1">
-            <div class="form-group">
-                <label class="sr-only" for="search">Szukaj w opisie lub uwagach</label>
-                <input type="text" class="form-control" id="search" placeholder="Szukaj w opisie lub uwagach">
-            </div>
-            <div class="form-group">
-                <label class="sr-only" for="status">Status</label>
-                <select class="form-control" id="status">
-                  <option>Wybierz stan</option>
-                  <option>PENDING</option>
-                  <option>RUNNING</option>
-                  <option>FAILED</option>
-                  <option>FINISHED</option>
-                </select>
-            </div>
-            <div class="form-group">
-                <label class="sr-only" for="cluster">Klaster</label>
-                <select class="form-control" id="cluster">
-                  <option>Wybierz klaster</option>
-                  <option>Inula</option>
-                  <option>Galera</option>
-                  <option>Hydra</option>
-                  <option>Zeus</option>
-                </select>
-            </div>
-        </div>
-        <div class="col-md-1">
-            <button type="submit" class="btn btn-default">Filtruj</button>
-        </div>
-    </form>
+{#    <form class="row form-inline">#}
+{#        <div class="col-md-9 col-md-offset-1">#}
+{#            <div class="form-group">#}
+{#                <label class="sr-only" for="search">Szukaj w opisie lub uwagach</label>#}
+{#                <input type="text" class="form-control" id="search" placeholder="Szukaj w opisie lub uwagach">#}
+{#            </div>#}
+{#            <div class="form-group">#}
+{#                <label class="sr-only" for="status">Status</label>#}
+{#                <select class="form-control" id="status">#}
+{#                  <option>Wybierz stan</option>#}
+{#                  <option>PENDING</option>#}
+{#                  <option>RUNNING</option>#}
+{#                  <option>FAILED</option>#}
+{#                  <option>FINISHED</option>#}
+{#                </select>#}
+{#            </div>#}
+{#            <div class="form-group">#}
+{#                <label class="sr-only" for="cluster">Klaster</label>#}
+{#                <select class="form-control" id="cluster">#}
+{#                  <option>Wybierz klaster</option>#}
+{#                  <option>Inula</option>#}
+{#                  <option>Galera</option>#}
+{#                  <option>Hydra</option>#}
+{#                  <option>Zeus</option>#}
+{#                </select>#}
+{#            </div>#}
+{#        </div>#}
+{#        <div class="col-md-1">#}
+{#            <button type="submit" class="btn btn-default">Filtruj</button>#}
+{#        </div>#}
+{#    </form>#}
+{##}
+{#    <hr />#}
 
-    <hr />
+
+    <nav class="text-center" style="margin-bottom: 15px">
+        <form action="{{ request.path }}" method="get" class="form-inline" role="form" style="display: inline-block">
+            <div class="input-group input-group-sm">
+                <span class="input-group-btn">
+                    {% if page.has_previous %}
+                        <a href="{{ request.path }}?page={{ page.previous_page_number }}" class="btn btn-default">
+                    {% else %}
+                        <a href="#" class="btn btn-default disabled">
+                    {% endif %}
+                        <span class="glyphicon glyphicon-chevron-left"></span>
+                    </a>
+                </span>
+                <label class="sr-only" for="page">Strona</label>
+                <input type="text" class="form-control text-center" id="page" name="page" value="{{ page.number }}" style="width: 50px">
+                <span class="input-group-btn">
+                    {% if page.has_next %}
+                        <a href="{{ request.path }}?page={{ page.next_page_number }}" class="btn btn-default">
+                    {% else %}
+                        <a href="#" class="btn btn-default disabled">
+                    {% endif %}
+                        <span class="glyphicon glyphicon-chevron-right"></span>
+                    </a>
+                </span>
+            </div>
+        </form>
+        &nbsp;z&nbsp;
+        <a href="{{ request.path }}?page={{ num_pages }}">{{ num_pages }}</a>
+    </nav>
 
     <table class="table table-hover tree">
         <thead>
                 <th>Koniec</th>
                 <th>Status</th>
                 <th>Host</th>
-                <th>Uwagi</th>
+{#                <th>Uwagi</th>#}
             </tr>
         </thead>
         <tbody>
-            <tr class="treegrid-1">
-                <td>
-                    <a href="{% url 'job' %}">
-                        <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
-                    </a>
-                </td>
-                <td>urban</td>
-                <td>04.07.13 17:03</td>
-                <td></td>
-                <td></td>
-                <td>PENDING</td>
-                <td>hydra</td>
-                <td></td>
-            </tr>
-            <tr class="treegrid-2">
-                <td>
-                    <a href="{% url 'job' %}">
-                        <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span>
-                    </a>
-                </td>
-                <td>urban</td>
-                <td>04.07.13 17:03</td>
-                <td></td>
-                <td></td>
-                <td>RUNNING</td>
-                <td>inula</td>
-                <td></td>
-            </tr>
-            <tr class="treegrid-3 treegrid-parent-2">
-                <td>
-                    <a href="{% url 'job' %}">
-                        <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
-                    </a>
-                </td>
-                <td>urban</td>
-                <td>04.07.13 17:03</td>
-                <td></td>
-                <td></td>
-                <td>FINISHED</td>
-                <td>inula</td>
-                <td></td>
-            </tr>
-            <tr class="treegrid-4">
-                <td>
-                    <a href="{% url 'job' %}">
-                        <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
-                    </a>
-                </td>
-                <td>urban</td>
-                <td>04.07.13 17:03</td>
-                <td></td>
-                <td></td>
-                <td>CANCELED</td>
-                <td>inula</td>
-                <td></td>
-            </tr>
+            {% regroup page by job as jobs %}
+
+            {% for job in jobs %}
+                {% ifequal job.list|length 1 %}
+                    {% with job.list.0 as task %}
+                        <tr class="treegrid-{{ forloop.counter }}">
+                            <td>
+                                <a href="{{ task.get_absolute_url }}">
+                                    <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
+{#                                    {{ task }}#}
+                                </a>
+                            </td>
+                            <td>{{ task.note }}</td>
+                            <td>{{ task.submission_time|timesince }} temu</td>
+                            <td>{{ task.start_time }}</td>
+                            <td>{{ task.finish_time }}</td>
+                            <td>{{ task.get_status_display }}</td>
+                            <td>{{ task.hosts|join:', ' }}</td>
+                        </tr>
+                    {% endwith %}
+                {% else %}
+                    <tr class="treegrid-{{ forloop.counter }}">
+                        <td>
+                            <a href="{{ job.grouper.get_absolute_url }}">
+                                <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span>
+{#                                {{ job.grouper }}#}
+                            </a>
+                        </td>
+                        <td>{{ job.grouper.note }}</td>
+                        <td>{{ job.grouper.submission_time|timesince  }} temu</td>
+                        <td>-</td>
+                        <td>{{ job.grouper.finish_time }}</td>
+                        <td>{{ job.grouper.get_status_display }}</td>
+                        <td>-</td>
+                    </tr>
+
+                    {% for task in job.list %}
+                        <tr class="treegrid-{{ forloop.parentloop.counter }}-{{ forloop.counter }} treegrid-parent-{{ forloop.parentloop.counter }}">
+                            <td>
+                                <a href="{{ task.get_absolute_url }}">
+                                    <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
+{#                                    {{ task }}#}
+                                </a>
+                            </td>
+                            <td>{{ task.note }}</td>
+                            <td>{{ task.submission_time|timesince  }} temu</td>
+                            <td>{{ task.start_time }}</td>
+                            <td>{{ task.finish_time }}</td>
+                            <td>{{ task.get_status_display }}</td>
+                            <td>{{ task.hosts|join:', ' }}</td>
+                        </tr>
+                    {% endfor %}
+                {% endifequal %}
+            {% endfor %}
         </tbody>
     </table>
 
     <nav class="text-center">
         <ul class="pagination">
-            <li>
-                <a href="#" aria-label="Previous">
-                    <span aria-hidden="true">&laquo;</span>
+            {% if page.has_previous %}
+                <li>
+                    <a href="{{ request.path }}?page={{ page.previous_page_number }}" aria-label="Previous">
+                    <span aria-hidden="true"><span class="glyphicon glyphicon-chevron-left"></span>&nbsp;poprzednia</span>
                 </a>
+            {% endif %}
             </li>
-            <li><a href="#">1</a></li>
-            <li><a href="#">2</a></li>
-            <li><a href="#">3</a></li>
-            <li><a href="#">4</a></li>
-            <li><a href="#">5</a></li>
-            <li>
-                <a href="#" aria-label="Next">
-                    <span aria-hidden="true">&raquo;</span>
+
+            <li{% ifequal page.number 1 %} class="active"{% endifequal %}>
+                <a href="{{ request.path }}?page=1">1</a>
+            </li>
+
+            {% if pages_range.0 > 2 %}
+                <li class="disabled"><span aria-hidden="true"><strong>&hellip;</strong></span></li>
+            {% endif %}
+
+            {% for num in pages_range %}
+                <li{% ifequal page.number num %} class="active"{% endifequal %}>
+                    <a href="{{ request.path }}?page={{ num }}">{{ num }}</a>
+                </li>
+            {% endfor %}
+
+            <li class="disabled"><span aria-hidden="true"><strong>z</strong></span></li>
+            <li><a href="{{ request.path }}?page={{ num_pages }}">{{ num_pages }}</a></li>
+
+            {% if page.has_next %}
+                <li>
+                    <a href="{{ request.path }}?page={{ page.next_page_number }}" aria-label="Next">
+                    <span aria-hidden="true">następna&nbsp;<span class="glyphicon glyphicon-chevron-right"></span></span>
                 </a>
+            {% endif %}
             </li>
         </ul>
     </nav>