Commits

Benoît Allard committed 4c44645

web: Make a page for each build, reduce the amount of information shown on the builds page

Comments (0)

Files changed (3)

web/templates/build.html

+{% extends "layout.html" %}
+
+{% import "macros.j2" as macros %}
+
+{% block body %}
+<div class="build">
+  <h3>{{ build.number }}</h3>
+  {% if build.binaries %}
+  <div>
+    Outcome:
+    <ul>
+      {% for binary in build.binaries %}
+      <li>{{ binary.module.name }}</li>
+      {% endfor %}
+    </ul>
+  </div>
+  {% endif %}
+  {% if build.changesets %}
+  <div>
+    From:
+    <ul>
+      {% for changeset in build.changesets %}
+      <li>
+        {{ macros.render_changeset(changeset)|safe }} (
+        {{ macros.render_repository(changeset.repository)|safe }})
+      </li>
+      {% endfor %}
+    </ul>
+  </div>
+  {% endif %}
+</div>
+{% endblock %}

web/templates/builds.html

 {% block items %}
 {% for build in builds %}
   <li class="build">
-    {{ build.number }}
+    <h3><a href="{{ url_for('views.build', number=build.number) }}">{{ build.number }}</a></h3>
     {% if build.binaries %}
-    <div>
-      Outcome:
-      <ul>
-        {% for binary in build.binaries %}
-          <li>{{ binary.module.name }}</li>
-        {% endfor %}
-      </ul>
-    </div>
+    <p>{{ build.binaries | count }} binaries built.</p>
     {% endif %}
     {% if build.changesets %}
-    <div>
-      From:
-      <ul>
-        {% for changeset in build.changesets %}
-        <li>
-          {{ macros.render_changeset(changeset)|safe }} (
-          {{ macros.render_repository(changeset.repository)|safe }})
-        </li>
-        {% endfor %}
-      </ul>
-    </div>
+    <p>build contains {{ build.changesets| count }} changesets.</p>
     {% endif %}
   </li>
 {% else %}
 from flask import Blueprint, render_template, abort, request
 from flask import flash, make_response
 
+import sqlalchemy
+
 views = Blueprint('views', __name__)
 
 PER_PAGE = 20
                            builds=items,
                            )
 
+@views.route('/build/<int:number>')
+def build(number):
+    try:
+        build = request.dbsession.query(models.Build).filter_by(number=number).one()
+    except sqlalchemy.orm.exc.NoResultFound:
+        abort(404)
+    return render_template('build.html', build=build)
+
+
 @views.route('/releases/', defaults={'page': 1})
 @views.route('/releases/page/<int:page>')
 def listreleases(page):