hydra/src/root/project.tt
Eelco Dolstra 242072bbd6 Hide the views tab for project that don't have them
Views are obsolete (replaced by the declarative "aggregate" build
mechanism) so we don't want people creating new ones.
2013-08-15 13:54:23 +02:00

182 lines
5.8 KiB
Plaintext

[% WRAPPER layout.tt title="Project $project.name" %]
[% PROCESS common.tt %]
<ul class="nav nav-tabs">
<li class="active"><a href="#tabs-project" data-toggle="tab">Jobsets</a></li>
<li><a href="#tabs-configuration" data-toggle="tab">Configuration</a></li>
<li><a href="#tabs-releases" data-toggle="tab">Releases</a></li>
[% IF views.size > 0 %]
<li><a href="#tabs-views" data-toggle="tab">Views</a></li>
[% END %]
</ul>
<div class="tab-content">
<div id="tabs-project" class="tab-pane active">
[% IF project.jobsets.size > 0 %]
<p>This project has the following jobsets:</p>
<table class="table table-striped table-condensed clickable-rows">
<thead>
<tr>
<th></th>
<th>Id</th>
<th>Description</th>
<th>Last evaluated</th>
<th colspan="2">Success</th>
</tr>
</thead>
<tbody>
[% FOREACH j IN jobsets %]
[% successrate = 0 %]
<tr>
<td>
[% IF j.get_column('nrscheduled') > 0 %]
<img src="/static/images/help_16.png" alt="Scheduled" />
[% ELSIF j.get_column('nrfailed') == 0 %]
<img src="/static/images/checkmark_16.png" alt="Succeeded" />
[% ELSIF j.get_column('nrfailed') > 0 && j.get_column('nrsucceeded') > 0 %]
<img src="/static/images/error_some_16.png" alt="Some Failed" />
[% ELSE %]
<img src="/static/images/error_16.png" alt="All Failed" />
[% END %]
</td>
<td><span class="[% IF !j.enabled %]disabled-jobset[% END %] [%+ IF j.hidden %]hidden-jobset[% END %]">[% INCLUDE renderJobsetName project=project.name jobset=j.name inRow=1 %]</span></td>
<td>[% HTML.escape(j.description) %]</td>
<td>[% INCLUDE renderDateTime timestamp = j.lastcheckedtime %]</td>
[% IF j.get_column('nrtotal') > 0 %]
[% successrate = ( j.get_column('nrsucceeded') / j.get_column('nrtotal') )*100 %]
[% IF j.get_column('nrscheduled') > 0 %]
[% class = 'label' %]
[% ELSIF successrate < 25 %]
[% class = 'label label-important' %]
[% ELSIF successrate < 75 %]
[% class = 'label label-warning' %]
[% ELSIF successrate <= 100 %]
[% class = 'label label-success' %]
[% END %]
[% END %]
<td><span class="[% class %]">[% successrate FILTER format('%d') %]%</span></td>
<td>
[% IF j.get_column('nrsucceeded') > 0 %]
<span class="label label-success">[% j.get_column('nrsucceeded') %]</span>
[% END %]
[% IF j.get_column('nrfailed') > 0 %]
<span class="label label-important">[% j.get_column('nrfailed') %]</span>
[% END %]
[% IF j.get_column('nrscheduled') > 0 %]
<span class="label label">[% j.get_column('nrscheduled') %]</span>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<p>No jobsets have been defined yet.</p>
[% END %]
</div>
<div id="tabs-configuration" class="tab-pane">
<a class="btn pull-right" href="[% c.uri_for('/project' project.name "edit") %]"><i class="icon-edit"></i> Edit</a>
<table class="info-table">
<tr>
<th>Display name:</th>
<td>[% HTML.escape(project.displayname) %]</td>
</tr>
<tr>
<th>Description:</th>
<td>[% HTML.escape(project.description) %]</td>
</tr>
<tr>
<th>Homepage:</th>
<td>
[% IF project.homepage %]
<a [% HTML.attributes(href => project.homepage) %]>[% HTML.escape(project.homepage) %]</a>
[% ELSE %]
<em>(not specified)</em>
[% END %]
</td>
</tr>
<tr>
<th>Owner:</th>
<td><tt>[% HTML.escape(project.owner.username) %]</tt></td>
</tr>
<tr>
<th>Enabled:</th>
<td>[% project.enabled ? "Yes" : "No" %]</td>
</tr>
</table>
</div>
<div id="tabs-releases" class="tab-pane">
[% IF releases.size == 0 %]
<p><em>This project has no releases yet.</em></p>
[% ELSE %]
<p>This project has made the following releases:</p>
<table class="table table-condensed table-striped clickable-rows">
<thead>
<tr>
<th>Name</th>
<th>Date</th>
</tr>
</thead>
<tbody>
[% FOREACH release IN releases %]
<tr>
<td><a class="row-link" href="[% c.uri_for('/release' project.name release.name) %]"><tt>[% release.name %]</tt></a></td>
<td>[% INCLUDE renderDateTime timestamp = release.timestamp %]</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
[% IF c.user_exists %]
<p><a class="btn" href="[% c.uri_for('/project' project.name 'create-release') %]">
<i class="icon-plus"></i> Create a release
</a></p>
[% END %]
</div>
<div id="tabs-views" class="tab-pane">
[% IF views.size > 0 %]
<p>Project <tt>[% project.name %]</tt> has the following views:</p>
<ul>
[% FOREACH view IN views %]
<li>
<a href="[% c.uri_for('/view' project.name view.name) %]"><tt>[% view.name %]</tt></a>
</li>
[% END %]
</ul>
[% ELSE %]
<p>Project <tt>[% project.name %]</tt> has no views.</p>
[% END %]
<!--
<p>
<a class="btn" href="[% c.uri_for('/project' project.name 'create-view') %]"><i class="icon-plus"></i> Create a new view</a>
</p>
-->
</div>
</div>
[% END %]