Remove support for views

They're replaced by aggregates, which are declarative, faster, and
have a better interface.
This commit is contained in:
Eelco Dolstra
2014-04-23 23:21:06 +02:00
parent 5e0d10a392
commit affec8881d
11 changed files with 4 additions and 907 deletions

View File

@ -1,106 +0,0 @@
[% WRAPPER layout.tt title=(create ? "New view" : "View $project.name:$view.name") %]
[% PROCESS common.tt %]
[% USE HTML %]
[% BLOCK renderJob %]
<tr id="[% id %]" >
<td>
<button type="button" class="btn btn-warning" onclick='$(this).parents("tr").remove()'>
<i class="icon-trash icon-white"></i>
</button>
</td>
<td><input type="radio" id="[% "$baseName-primary" %]" name="primary" [% IF job.isprimary %]
checked="checked" [% END %] [% HTML.attributes(value => "$n") %] /></td>
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-name", name => "$baseName-name", value => "$job.jobset:$job.job") %] /></td>
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-description", name => "$baseName-description", value => job.description) %] /></td>
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-attrs", name => "$baseName-attrs", value => job.attrs) %] /></td>
</tr>
[% END %]
<form class="form-horizontal" action="[% IF create %][% c.uri_for('/project' project.name 'create-view/submit') %][% ELSE %][% c.uri_for('/view' project.name view.name 'submit') %][% END %]" method="post">
<fieldset>
<div class="control-group">
<label class="control-label">Identifier</label>
<div class="controls">
<input type="text" class="span3" name="name" [% HTML.attributes(value => view.name) %]/>
</div>
</div>
<div class="control-group">
<label class="control-label">Description</label>
<div class="controls">
<input type="text" class="span3" name="description" [% HTML.attributes(value => view.description) %]/>
</div>
</div>
<table class="table table-condensed table-striped">
<thead>
<tr>
<th></th>
<th>Primary job</th>
<th>Job name</th>
<th>Description</th>
<th>Constraint</th>
</tr>
</thead>
<tbody>
[% n = 0 %]
[% FOREACH j IN jobs %]
[% INCLUDE renderJob baseName="job-$n" job=j %]
[% n = n + 1 %]
[% END %]
<tr>
<td colspan="5" style="text-align: center;"><button type="button" class="add-job btn btn-success"><i class="icon-plus icon-white"></i> Add a job</button></td>
</tr>
</tbody>
</table>
<div class="form-actions">
<button type="submit" class="btn btn-primary">
<i class="icon-ok icon-white"></i>
[%IF create %]Create[% ELSE %]Apply changes[% END %]
</button>
[% IF !create %]
<button id="delete-view" type="submit" class="btn btn-danger" name="submit" value="delete">
<i class="icon-trash icon-white"></i>
Delete this view
</button>
<script type="text/javascript">
$("#delete-view").click(function() {
return confirm("Are you sure you want to delete this view?");
});
</script>
[% END %]
</div>
</form>
<table class="template"> <!-- dummy wrapper needed because “hidden” trs are visible anyway -->
[% INCLUDE renderJob job="" id="job-template" baseName="job-template" %]
</table>
<script type="text/javascript">
$(document).ready(function() {
var id = [% n %];
$(".add-job").click(function() {
var newnr = id++;
var newid = "job-" + newnr;
var x = $("#job-template").clone(true).attr("id", "").insertBefore($(this).parents("tr")).show();
$("#job-template-name", x).attr("name", newid + "-name");
$("#job-template-description", x).attr("name", newid + "-description");
$("#job-template-attrs", x).attr("name", newid + "-attrs");
$("#job-template-primary", x).attr("value", newnr);
return false;
});
});
</script>
[% END %]

View File

@ -20,9 +20,6 @@
<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">
@ -99,34 +96,6 @@
</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>
<script>

View File

@ -1,57 +0,0 @@
[% releaseName = (result.releasename || "(No name)") %]
[% WRAPPER layout.tt title="View $releaseName" %]
[% PROCESS common.tt %]
[% PROCESS "product-list.tt" %]
[% USE HTML %]
<p><em>Finished building on [% INCLUDE renderDateTime timestamp = result.timestamp %].</em></p>
[% IF result.status == 1 %]
<p class="error">Note: One or more of the jobs in the view did not build correctly. See below for details.</p>
[% ELSIF result.status == 2 %]
<p class="error">Note: One or more of the jobs in the view have not been built (yet). See below for details.</p>
[% END %]
[% FOREACH j IN result.jobs %]
<h2>
[% IF j.build %]<a href="[% c.uri_for('/build' j.build.id) %]">[% END %]
[% INCLUDE renderViewJobName job=j.job %]
[% IF j.build %]</a>[% END %]
</h2>
[% IF j.build %]
[% IF j.build.buildstatus == 0 %]
[% IF j.build.buildproducts %]
[% p = jobNames.${j.job.job} > 1 ? "-${j.build.system}" : "";
INCLUDE renderProductList build=j.build latestRoot=['/view' project.name view.name 'latest' "${j.job.job}${p}"]
%]
[% ELSE %]
<p><em>Succeeded.</em></p>
[% END %]
[% ELSE %]
<p class="error">Build failed</p>
[% END %]
[% ELSE %]
<p class="error">Build not (yet) performed.</p>
[% END %]
<br />
[% END %]
[% IF c.user_exists %]
<p>
<a class="btn" href="[% c.uri_for('/view' project.name view.name result.id 'release') %]">Release</a>
</p>
[% END %]
[% END %]

View File

@ -1,86 +0,0 @@
[% WRAPPER layout.tt title="View $view.project.name:$view.name" %]
[% PROCESS common.tt %]
[% USE HTML %]
<p>
<a class="btn" href="[% c.uri_for('/view' project.name view.name "edit") %]"><i class="icon-edit"></i> Edit</a>
<a class="btn" href="[% c.uri_for('/view' project.name view.name "latest") %]"><i class="icon-share-alt"></i> Latest</a>
</p>
<p>Showing results [% (page - 1) * resultsPerPage + 1 %] - [% (page - 1) * resultsPerPage + results.size %] out of [% totalResults %].</p>
<table class="table table-condensed table-striped clickable-rows">
<thead>
<tr>
<th></th>
<th>#</th>
<th>Name</th>
<th>Date</th>
[% FOREACH j IN jobs %]
<th class="releaseSetJobName">[% INCLUDE renderViewJobName job=j %]</th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH result IN results %]
<tr>
<td>
[% IF result.status == 0 %]
<img src="[% c.uri_for("/static/images/checkmark_16.png") %]" />
[% ELSIF result.status == 1 %]
<img src="[% c.uri_for("/static/images/error_16.png") %]" />
[% ELSIF result.status == 2 %]
<img src="[% c.uri_for("/static/images/help_16.png") %]" />
[% END %]
</td>
<td><a class="row-link" href="[% c.uri_for('/view' project.name view.name result.id) %]">[% result.id %]</a></td>
<td>
[% IF result.releasename %]
<tt>[% result.releasename %]</tt>
[% ELSE %]
<em>No name</em>
[% END %]
</td>
<td>[% INCLUDE renderDateTime timestamp=result.timestamp %]</td>
[% FOREACH j IN result.jobs %]
<td class="centered">
[% IF j.build %]
<a href="[% c.uri_for('/build' j.build.id) %]">
[% IF j.build.get_column('buildstatus') == 0 %]
<img src="[% c.uri_for("/static/images/checkmark_16.png") %]" />
[% ELSE %]
<img src="[% c.uri_for("/static/images/error_16.png") %]" />
[% END %]
</a>
[% END %]
</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
<ul class="pager">
[% IF page > 1 %]
<li class="previous"><a href="[% "$baseUri?page="; (page - 1) %]">Prev</a></li>
[% END %]
[% IF page * resultsPerPage < totalResults %]
<li class="next"><a href="[% "$baseUri?page="; (page + 1) %]">Next</a></li>
[% END %]
</ul>
<!--
<p>
[<a href="[% "$baseUri?page=1" %]">First</a>]
[% IF page > 1 %]
[<a href="[% "$baseUri?page="; (page - 1) %]">Prev</a>]
[% END %]
[% IF page * resultsPerPage < totalResults %]
[<a href="[% "$baseUri?page="; (page + 1) %]">Next</a>]
[% END %]
[<a href="[% "$baseUri?page="; (totalResults - 1) div resultsPerPage + 1 %]">Last</a>]
</p>
-->
[% END %]