Separate active / complete / cancelled builds

This commit is contained in:
Oliver Walters 2019-05-02 21:16:20 +10:00
parent 6482b54bc9
commit b91de1af7b
3 changed files with 49 additions and 19 deletions

View File

@ -1,4 +1,20 @@
{% extends "collapse.html" %}
{% block collapse_title %}
{{ title }}<span class='badge'>{{ builds | length }}</span>
{% endblock %}
{% block collapse_content %}
<table class='table table-striped table-condensed build-table' id='build-table-{{collapse_id}}' data-toolbar='#button-toolbar'>
<thead>
<tr>
<th>Build</th>
<th>Part</th>
<th>Quantity</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for build in builds %} {% for build in builds %}
<tr> <tr>
<td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td> <td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td>
@ -7,3 +23,6 @@
<td>{% include "build_status.html" with build=build %} <td>{% include "build_status.html" with build=build %}
</tr> </tr>
{% endfor %} {% endfor %}
</tbody>
</table>
{% endblock %}

View File

@ -2,28 +2,40 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
<h3>Part Builds</h3>
<div id='button-toolbar'> <h4>Active Builds</h4>
<button class="btn btn-success" id='new-build'>Start New Build</button>
<div id='active-build-toolbar'>
<div class='btn-group'>
<button class="btn btn-success" id='new-build'>Start New Build</button>
</div>
</div> </div>
<table class='table table-striped table-condensed' id='build-table' data-toolbar='#button-toolbar'> <table class='table table-striped table-condensed build-table' id='build-table-{{collapse_id}}' data-toolbar='#active-build-toolbar'>
<thead> <thead>
<tr>
<th>Build</th>
<th>Part</th>
<th>Quantity</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for build in active %}
<tr> <tr>
<th>Build</th> <td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td>
<th>Part</th> <td><a href="{% url 'part-build' build.part.id %}">{{ build.part.name }}</a></td>
<th>Quantity</th> <td>{{ build.quantity }}</td>
<th>Status</th> <td>{% include "build_status.html" with build=build %}
</tr> </tr>
</thead> {% endfor %}
<tbody>
{% include "build/build_list.html" with builds=builds %}
</tbody> </tbody>
</table> </table>
<p></p>
{% include "build/build_list.html" with builds=completed title="Completed Builds" collapse_id="complete" %}
<p></p>
{% include "build/build_list.html" with builds=cancelled title="Cancelled Builds" collapse_id="cancelled" %}
{% include 'modals.html' %} {% include 'modals.html' %}
@ -39,9 +51,10 @@
}); });
}); });
$("#build-table").bootstrapTable({ $(".build-table").bootstrapTable({
sortable: true, sortable: true,
search: true, search: true,
formatNoMatches: function() { return 'No builds found'; },
columns: [ columns: [
{ {
field: 'name', field: 'name',

View File

@ -33,12 +33,10 @@ class BuildIndex(ListView):
context = super(BuildIndex, self).get_context_data(**kwargs).copy() context = super(BuildIndex, self).get_context_data(**kwargs).copy()
""" context['active'] = self.get_queryset().filter(status__in=[Build.PENDING,])
context['active'] = self.get_queryset().filter(status__in=[Build.PENDING, Build.HOLDING])
context['complete'] = self.get_queryset().filter(status=Build.COMPLETE) context['complete'] = self.get_queryset().filter(status=Build.COMPLETE)
context['cancelled'] = self.get_queryset().filter(status=Build.CANCELLED) context['cancelled'] = self.get_queryset().filter(status=Build.CANCELLED)
"""
return context return context