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 %}
<tr>
<td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td>
@ -7,3 +23,6 @@
<td>{% include "build_status.html" with build=build %}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@ -2,13 +2,16 @@
{% load static %}
{% block content %}
<h3>Part Builds</h3>
<div id='button-toolbar'>
<h4>Active Builds</h4>
<div id='active-build-toolbar'>
<div class='btn-group'>
<button class="btn btn-success" id='new-build'>Start New Build</button>
</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>
<tr>
<th>Build</th>
@ -18,12 +21,21 @@
</tr>
</thead>
<tbody>
{% include "build/build_list.html" with builds=builds %}
{% for build in active %}
<tr>
<td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td>
<td><a href="{% url 'part-build' build.part.id %}">{{ build.part.name }}</a></td>
<td>{{ build.quantity }}</td>
<td>{% include "build_status.html" with build=build %}
</tr>
{% endfor %}
</tbody>
</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' %}
@ -39,9 +51,10 @@
});
});
$("#build-table").bootstrapTable({
$(".build-table").bootstrapTable({
sortable: true,
search: true,
formatNoMatches: function() { return 'No builds found'; },
columns: [
{
field: 'name',

View File

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