Replace last 5 builds on jobset page with last 5 evaluations. Moved hide/unhide and evaluate options to jobset topmenu.

This commit is contained in:
Rob Vermaas 2012-04-13 11:26:37 +02:00
parent 11bf848b09
commit f63e9a63b4
7 changed files with 73 additions and 69 deletions

View file

@ -26,8 +26,6 @@ sub jobsetIndex {
$c->stash->{template} = 'jobset.tt'; $c->stash->{template} = 'jobset.tt';
#getBuildStats($c, scalar $c->stash->{jobset}->builds);
my $projectName = $c->stash->{project}->name; my $projectName = $c->stash->{project}->name;
my $jobsetName = $c->stash->{jobset}->name; my $jobsetName = $c->stash->{jobset}->name;
@ -51,6 +49,20 @@ sub jobsetIndex {
} }
} }
$c->stash->{evals} = [ $c->stash->{jobset}->jobsetevals->search(
{ hasnewbuilds => 1 },
{ order_by => "id DESC"
, '+select' => # !!! Slow - should precompute this.
[ "(select count(*) from JobsetEvalMembers where eval = me.id)"
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 0))"
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1))"
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1 and b.buildStatus = 0))"
]
, '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ]
, rows => 5
}
) ];
$c->stash->{systems} = $c->stash->{systems} =
[ $c->stash->{jobset}->builds->search({ iscurrent => 1 }, { select => ["system"], distinct => 1, order_by => "system" }) ]; [ $c->stash->{jobset}->builds->search({ iscurrent => 1 }, { select => ["system"], distinct => 1, order_by => "system" }) ];
@ -80,10 +92,6 @@ sub jobsetIndex {
})]; })];
} }
# Last builds for jobset.
$c->stash->{lastBuilds} =
[ $c->stash->{jobset}->builds->search({ finished => 1 },
{ order_by => "timestamp DESC", rows => 5, columns => [@buildListColumns] }) ];
} }

View file

@ -399,18 +399,43 @@
<li [% IF page * resultsPerPage >= total %]class="disabled"[% END %]><a href="[% "$baseUri?page="; (page + 1) %]">Next</a></li> <li [% IF page * resultsPerPage >= total %]class="disabled"[% END %]><a href="[% "$baseUri?page="; (page + 1) %]">Next</a></li>
<li><a href="[% "$baseUri?page="; (total - 1) div resultsPerPage + 1 %]">Last</a></li> <li><a href="[% "$baseUri?page="; (total - 1) div resultsPerPage + 1 %]">Last</a></li>
</ul> </ul>
<!--
<p>
[]
[% IF page > 1 %]
[<a href="[% "$baseUri?page="; (page - 1) %]">Prev</a>]
[% END %]
[% IF page * resultsPerPage < total %]
[<a href="[% "$baseUri?page="; (page + 1) %]">Next</a>]
[% END %]
[<a href="[% "$baseUri?page="; (total - 1) div resultsPerPage + 1 %]">Last</a>]
</p>
-->
[% END %] [% END %]
[% BLOCK renderEvals %]
<table class="tablesorter table table-condensed table-striped">
<thead>
<tr>
<th>#</th>
<th>Date</th>
<th colspan='2'>Success</th>
</tr>
</thead>
<tbody>
[% last = nrShown - 1; FOREACH n IN [0..last]; eval = evals.$n; m = n + 1; next = evals.$m; %]
<tr>
<td><a href="[% c.uri_for(c.controller('JobsetEval').action_for('view'), [eval.id]) %]">[% eval.id %]</a>&nbsp;</td>
<td>[% INCLUDE renderDateTime timestamp = eval.timestamp %]&nbsp;</td>
<td align='right'>
<span class="label label-success">[% eval.get_column('nrSucceeded') %]</span>
<span class="label label-important">[% eval.get_column('nrBuilds') - eval.get_column('nrSucceeded') - eval.get_column('nrScheduled') %]</span>
[% IF eval.get_column('nrScheduled') > 0 %]
<span class="label">[% eval.get_column('nrScheduled') %]</span>
[% END %]
</td>
<td align='right'>
[% diff = eval.get_column('nrSucceeded') - next.get_column('nrSucceeded');
IF diff > 0 %]
<span class='label label-success'><strong>+[% diff %]</strong></span>
[% ELSIF diff < 0 && eval.get_column('nrScheduled') == 0 %]
<span class='label label-important'><strong>[% diff %]</strong></span>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]

View file

@ -1,7 +1,7 @@
[% WRAPPER layout.tt title="Jobset $project.name:$jobset.name evaluation $eval.id" %] [% WRAPPER layout.tt title="Jobset $project.name:$jobset.name evaluation $eval.id" %]
[% PROCESS common.tt %] [% PROCESS common.tt %]
<h1>Jobset <tt>[% project.name %]:[% jobset.name %]</tt> evaluation [% eval.id %]</h1> <h2>Jobset <tt>[% project.name %]:[% jobset.name %]</tt> evaluation [% eval.id %]</h2>
[%- IF otherEval -%] [%- IF otherEval -%]
<p>Comparisons are relative to [% INCLUDE renderFullJobsetName <p>Comparisons are relative to [% INCLUDE renderFullJobsetName

View file

@ -1,9 +1,9 @@
[% WRAPPER layout.tt title="Jobset $project.name:$jobset.name Evaluations" %] [% WRAPPER layout.tt title="Jobset $project.name:$jobset.name Evaluations" %]
[% PROCESS common.tt %] [% PROCESS common.tt %]
<h1>Evaluations of Jobset <tt>[% INCLUDE renderLink <h2>Evaluations of Jobset <tt>[% INCLUDE renderLink
uri = c.uri_for(c.controller('Project').action_for('view'), [project.name]) uri = c.uri_for(c.controller('Project').action_for('view'), [project.name])
title = project.name %]:[% jobset.name %]</tt></h1> title = project.name %]:[% jobset.name %]</tt></h2>
[% nrShown = evals.size > resultsPerPage ? resultsPerPage : evals.size %] [% nrShown = evals.size > resultsPerPage ? resultsPerPage : evals.size %]
@ -12,37 +12,6 @@
[% INCLUDE renderPager %] [% INCLUDE renderPager %]
<table class="tablesorter table table-condensed table-striped"> [% INCLUDE renderEvals %]
<thead>
<tr>
<th>#</th>
<th>Date</th>
<th colspan='2'>Success</th>
</tr>
</thead>
<tbody>
[% last = nrShown - 1; FOREACH n IN [0..last]; eval = evals.$n; m = n + 1; next = evals.$m; %]
<tr>
<td><a href="[% c.uri_for(c.controller('JobsetEval').action_for('view'), [eval.id]) %]">[% eval.id %]</a>&nbsp;</td>
<td>[% INCLUDE renderDateTime timestamp = eval.timestamp %]&nbsp;</td>
<td align='right'>
<span class="label label-success">[% eval.get_column('nrSucceeded') %]</span>
<span class="label label-important">[% eval.get_column('nrBuilds') - eval.get_column('nrSucceeded') - eval.get_column('nrScheduled') %]</span>
[% IF eval.get_column('nrScheduled') > 0 %]
<span class="label">[% eval.get_column('nrScheduled') %]</span>
[% END %]
</td>
<td align='right'>
[% diff = eval.get_column('nrSucceeded') - next.get_column('nrSucceeded');
IF diff > 0 %]
<span class='label label-success'><strong>+[% diff %]</strong></span>
[% ELSIF diff < 0 && eval.get_column('nrScheduled') == 0 %]
<span class='label label-important'><strong>[% diff %]</strong></span>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %] [% END %]

View file

@ -91,10 +91,12 @@
</script> </script>
[% END %] [% END %]
[% IF lastBuilds %] <h2>Most recent evaluations</h2>
<h2>Most recent builds</h2> [% INCLUDE renderEvals nrShown=5 %]
[% INCLUDE renderBuildList builds=lastBuilds hideProjectName=1 hideJobsetName=1 %]
[% END %] <a href="c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name])" class="btn">All evaluations</a>
<br />
<br />
[% IF !edit && activeJobsStatus -%] [% IF !edit && activeJobsStatus -%]
<h2>Status</h2> <h2>Status</h2>

View file

@ -28,7 +28,6 @@
<th>Description</th> <th>Description</th>
<th>Last evaluated</th> <th>Last evaluated</th>
<th colspan="2">Success</th> <th colspan="2">Success</th>
[% IF c.check_user_roles('admin') %]<th>Options</th>[% END%]
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -76,15 +75,6 @@
<span class="label label">[% j.get_column('nrscheduled') %]</span> <span class="label label">[% j.get_column('nrscheduled') %]</span>
[% END %] [% END %]
</td> </td>
[% IF c.check_user_roles('admin') %]
<td>[% INCLUDE maybeButton uri = c.uri_for(c.controller('Admin').action_for('force_eval'), project.name, j.name) content = "Evaluate" confirmmsg = ("Are you sure you want to force evaluation of jobset " _ project.name _ ":" _ j.name _ "?") %]
[% IF j.hidden %]
[% INCLUDE maybeButton uri = c.uri_for('/jobset' project.name j.name 'unhide') content = "Unhide" %]
[% ELSE %]
[% INCLUDE maybeButton uri = c.uri_for('/jobset' project.name j.name 'hide') content = "Hide" %]
[% END %]
</td>
[% END%]
</tr> </tr>
[% END %] [% END %]
</tbody> </tbody>

View file

@ -44,10 +44,11 @@
[% IF project %] [% IF project %]
[% WRAPPER makeSubMenu title=("Project: " _ project.name) collapsed=(jobset || job) %] [% WRAPPER makeSubMenu title=("Project: " _ project.name) collapsed=(jobset || job) %]
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('view'), [project.name]) title = "Overview" %] [% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('view'), [project.name]) title = "Overview" %]
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('releases'), [project.name]) title = "Releases" %]
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('all'), [project.name]) title = "All builds" %] [% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('all'), [project.name]) title = "All builds" %]
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('jobstatus'), [project.name]) title = "Job status" %] [% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('jobstatus'), [project.name]) title = "Job status" %]
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('errors'), [project.name]) title = "Errors" %] [% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('errors'), [project.name]) title = "Errors" %]
<li class="divider"></li>
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('releases'), [project.name]) title = "Releases" %]
[% INCLUDE menuItem uri = c.uri_for('/project' project.name 'channel' 'latest') title = "Channel (latest)" %] [% INCLUDE menuItem uri = c.uri_for('/project' project.name 'channel' 'latest') title = "Channel (latest)" %]
[% IF c.check_user_roles('admin') %] [% IF c.check_user_roles('admin') %]
<li class="divider"></li> <li class="divider"></li>
@ -75,13 +76,22 @@
[% INCLUDE makeLink [% INCLUDE makeLink
uri = c.uri_for(c.controller('Jobset').action_for('errors'), [project.name, jobset.name]) uri = c.uri_for(c.controller('Jobset').action_for('errors'), [project.name, jobset.name])
title = "Errors" %] title = "Errors" %]
<li class="divider"></li>
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'channel' 'latest') title = "Channel (latest)" %] [% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'channel' 'latest') title = "Channel (latest)" %]
[% IF c.check_user_roles('admin') %] [% IF c.check_user_roles('admin') %]
<li class="divider"></li> <li class="divider"></li>
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'edit') title="Edit jobset" %]
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'clone') title="Clone jobset" %] [% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'clone') title="Clone jobset" %]
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'edit') title="Edit jobset" %]
[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('force_eval'), project.name, j.name) content = "Evaluate" confirmmsg = ("Are you sure you want to force evaluation of jobset " _ project.name _ ":" _ j.name _ "?") %]
[% IF j.hidden %]
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name j.name 'unhide') title = "Unhide" %]
[% ELSE %]
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name j.name 'hide') title = "Hide" %]
[% END %] [% END %]
[% END %] [% END %]
[% END %]
[% END %] [% END %]