Skip to content

Instantly share code, notes, and snippets.

@ampz9
Last active March 24, 2017 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ampz9/dccd02500959b98941c13a707a8a8846 to your computer and use it in GitHub Desktop.
Save ampz9/dccd02500959b98941c13a707a8a8846 to your computer and use it in GitHub Desktop.
jinja2 template for grid dashboard
<div class="container griddashboard">
<style>
/* only modify th from this dashboard! */
.griddashboard table th {
font-size 24pt;
}
</style>
<!-- Create a table of builds organised by builders/revisions in columns -->
<table class="table table-hover table-striped table-condensed">
<tr>
<!-- Generate the table header with revisions -->
<th>
Builder v / Revision >
</th>
<th></th> {# can't figure out why there is an extra column, workaround is to add this header #}
{% for revision in revisions %}
<th>
{{revision}}
</th>
{% endfor %} {# revisions #}
</tr>
{% for builder in builders %}
{# filter innactive builders #}
{% if builder.masterids|length > 0 %}
<tr>
<td>
<a href="#/builders/{{builder.builderid}}">
{{builder.name}}
</a>
<td>
{% for revision in revisions %}
{# only print builds that have a revision which matches the revision in the header and matches the builder #}
{% for build in builds if (build.properties.got_revision|length > 0) and (build.builderid == builder.builderid) and (build.properties.got_revision.0 == revision) %}
<td>
{# If this build is from this builderid/revision, then we render it in this cell #}
{# We use buildbot internal CSS styles display our builds, with links to the standard UI #}
{% if build.results_text == "not finished" %}
{% set result = "PENDING pulse" %}
{% else %}
{% set result = build.results_text | upper %}
{% endif %}
<a class="badge-status badge results_{{result}}" href="#/builders/{{build.builderid}}/builds/{{build.number}}">
{{build.number}}
</a>
</td>
{% else %}
{# if there isn't a match, just print an empty cell #}
<td></td>
{% endfor %} {# builds #}
{% endfor %} {# revisions #}
</tr>
{% endif %}
{% endfor %} {# builders #}
</table>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment