From f63e9a63b42a8739271f087306d03b8d4a834b2e Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Fri, 13 Apr 2012 11:26:37 +0200 Subject: [PATCH] Replace last 5 builds on jobset page with last 5 evaluations. Moved hide/unhide and evaluate options to jobset topmenu. --- src/lib/Hydra/Controller/Jobset.pm | 20 ++++++++---- src/root/common.tt | 49 ++++++++++++++++++++++-------- src/root/jobset-eval.tt | 2 +- src/root/jobset-evals.tt | 37 ++-------------------- src/root/jobset.tt | 10 +++--- src/root/project.tt | 10 ------ src/root/topbar.tt | 14 +++++++-- 7 files changed, 73 insertions(+), 69 deletions(-) diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index 117c7c5c..b517edab 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -26,8 +26,6 @@ sub jobsetIndex { $c->stash->{template} = 'jobset.tt'; - #getBuildStats($c, scalar $c->stash->{jobset}->builds); - my $projectName = $c->stash->{project}->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->{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] }) ]; } diff --git a/src/root/common.tt b/src/root/common.tt index aff25137..85aab482 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -399,18 +399,43 @@
  • = total %]class="disabled"[% END %]>Next
  • Last
  • - [% END %] +[% BLOCK renderEvals %] + + + + + + + + + + + [% last = nrShown - 1; FOREACH n IN [0..last]; eval = evals.$n; m = n + 1; next = evals.$m; %] + + + + + + + [% END %] + +
    #DateSuccess
    [% eval.id %] [% INCLUDE renderDateTime timestamp = eval.timestamp %]  + [% eval.get_column('nrSucceeded') %] + [% eval.get_column('nrBuilds') - eval.get_column('nrSucceeded') - eval.get_column('nrScheduled') %] + [% IF eval.get_column('nrScheduled') > 0 %] + [% eval.get_column('nrScheduled') %] + [% END %] + + [% diff = eval.get_column('nrSucceeded') - next.get_column('nrSucceeded'); + IF diff > 0 %] + +[% diff %] + [% ELSIF diff < 0 && eval.get_column('nrScheduled') == 0 %] + [% diff %] + [% END %] +
    + + +[% END %] diff --git a/src/root/jobset-eval.tt b/src/root/jobset-eval.tt index 1a41cbab..cbdbf44f 100644 --- a/src/root/jobset-eval.tt +++ b/src/root/jobset-eval.tt @@ -1,7 +1,7 @@ [% WRAPPER layout.tt title="Jobset $project.name:$jobset.name evaluation $eval.id" %] [% PROCESS common.tt %] -

    Jobset [% project.name %]:[% jobset.name %] evaluation [% eval.id %]

    +

    Jobset [% project.name %]:[% jobset.name %] evaluation [% eval.id %]

    [%- IF otherEval -%]

    Comparisons are relative to [% INCLUDE renderFullJobsetName diff --git a/src/root/jobset-evals.tt b/src/root/jobset-evals.tt index 8b686b22..640bff11 100644 --- a/src/root/jobset-evals.tt +++ b/src/root/jobset-evals.tt @@ -1,9 +1,9 @@ [% WRAPPER layout.tt title="Jobset ‘$project.name:$jobset.name’ Evaluations" %] [% PROCESS common.tt %] -

    Evaluations of Jobset [% INCLUDE renderLink +

    Evaluations of Jobset [% INCLUDE renderLink uri = c.uri_for(c.controller('Project').action_for('view'), [project.name]) - title = project.name %]:[% jobset.name %]

    + title = project.name %]:[% jobset.name %]

    [% nrShown = evals.size > resultsPerPage ? resultsPerPage : evals.size %] @@ -12,37 +12,6 @@ [% INCLUDE renderPager %] - - - - - - - - - - [% last = nrShown - 1; FOREACH n IN [0..last]; eval = evals.$n; m = n + 1; next = evals.$m; %] - - - - - - - [% END %] - -
    #DateSuccess
    [% eval.id %] [% INCLUDE renderDateTime timestamp = eval.timestamp %]  - [% eval.get_column('nrSucceeded') %] - [% eval.get_column('nrBuilds') - eval.get_column('nrSucceeded') - eval.get_column('nrScheduled') %] - [% IF eval.get_column('nrScheduled') > 0 %] - [% eval.get_column('nrScheduled') %] - [% END %] - - [% diff = eval.get_column('nrSucceeded') - next.get_column('nrSucceeded'); - IF diff > 0 %] - +[% diff %] - [% ELSIF diff < 0 && eval.get_column('nrScheduled') == 0 %] - [% diff %] - [% END %] -
    +[% INCLUDE renderEvals %] [% END %] diff --git a/src/root/jobset.tt b/src/root/jobset.tt index c38d789a..62724393 100644 --- a/src/root/jobset.tt +++ b/src/root/jobset.tt @@ -91,10 +91,12 @@ [% END %] - [% IF lastBuilds %] -

    Most recent builds

    - [% INCLUDE renderBuildList builds=lastBuilds hideProjectName=1 hideJobsetName=1 %] - [% END %] +

    Most recent evaluations

    + [% INCLUDE renderEvals nrShown=5 %] + + All evaluations +
    +
    [% IF !edit && activeJobsStatus -%]

    Status

    diff --git a/src/root/project.tt b/src/root/project.tt index b1c997d9..da1e7b9f 100644 --- a/src/root/project.tt +++ b/src/root/project.tt @@ -28,7 +28,6 @@ Description Last evaluated Success - [% IF c.check_user_roles('admin') %]Options[% END%] @@ -76,15 +75,6 @@ [% j.get_column('nrscheduled') %] [% END %] - [% IF c.check_user_roles('admin') %] - [% 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 %] - - [% END%] [% END %] diff --git a/src/root/topbar.tt b/src/root/topbar.tt index 7144d167..3fb8201a 100644 --- a/src/root/topbar.tt +++ b/src/root/topbar.tt @@ -44,10 +44,11 @@ [% IF project %] [% 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('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('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('releases'), [project.name]) title = "Releases" %] [% INCLUDE menuItem uri = c.uri_for('/project' project.name 'channel' 'latest') title = "Channel (latest)" %] [% IF c.check_user_roles('admin') %]
  • @@ -75,12 +76,21 @@ [% INCLUDE makeLink uri = c.uri_for(c.controller('Jobset').action_for('errors'), [project.name, jobset.name]) title = "Errors" %] +
  • [% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'channel' 'latest') title = "Channel (latest)" %] [% IF c.check_user_roles('admin') %]
  • - [% 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 '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 %]