From fa042e04ae7ed2c07ec1a3af7e561736a74f287b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 26 Nov 2008 17:43:45 +0000 Subject: [PATCH] * Unify rendering of finished and scheduled builds. --- src/Hydra/lib/Hydra/Controller/Root.pm | 32 ++++++++------- src/Hydra/root/common.tt | 50 +++++++++++++++++++++++- src/Hydra/root/index.tt | 54 ++------------------------ src/Hydra/root/job.tt | 12 +----- src/Hydra/root/short-build-info.tt | 17 -------- src/Hydra/root/static/css/hydra.css | 2 +- 6 files changed, 74 insertions(+), 93 deletions(-) delete mode 100644 src/Hydra/root/short-build-info.tt diff --git a/src/Hydra/lib/Hydra/Controller/Root.pm b/src/Hydra/lib/Hydra/Controller/Root.pm index 0efb5858..838a83c5 100644 --- a/src/Hydra/lib/Hydra/Controller/Root.pm +++ b/src/Hydra/lib/Hydra/Controller/Root.pm @@ -18,7 +18,7 @@ my $relPathRE = "(?:$pathCompRE(?:\/$pathCompRE)*)"; sub begin :Private { - my ( $self, $c ) = @_; + my ($self, $c) = @_; $c->stash->{projects} = [$c->model('DB::Projects')->search({}, {order_by => 'displayname'})]; $c->stash->{curUri} = $c->request->uri; } @@ -47,10 +47,8 @@ sub getBuild { sub index :Path :Args(0) { - my ( $self, $c ) = @_; + my ($self, $c) = @_; $c->stash->{template} = 'index.tt'; - $c->stash->{scheduled} = [$c->model('DB::Builds')->search( - {finished => 0}, {join => 'schedulingInfo'})]; # !!! $c->stash->{allBuilds} = [$c->model('DB::Builds')->search( {finished => 1}, {order_by => "timestamp DESC"})]; # Get the latest finished build for each unique job. @@ -63,6 +61,14 @@ sub index :Path :Args(0) { } +sub queue :Local { + my ($self, $c) = @_; + $c->stash->{template} = 'queue.tt'; + $c->stash->{queue} = [$c->model('DB::Builds')->search( + {finished => 0}, {join => 'schedulingInfo', order_by => ["priority DESC", "timestamp"]})]; +} + + sub updateProject { my ($c, $project) = @_; @@ -184,7 +190,7 @@ sub updateProject { sub project :Local { - my ( $self, $c, $projectName, $subcommand ) = @_; + my ($self, $c, $projectName, $subcommand) = @_; $c->stash->{template} = 'project.tt'; (my $project) = $c->model('DB::Projects')->search({ name => $projectName }); @@ -239,7 +245,7 @@ sub project :Local { sub createproject :Local { - my ( $self, $c, $subcommand ) = @_; + my ($self, $c, $subcommand) = @_; if (defined $subcommand && $subcommand eq "submit") { eval { @@ -265,7 +271,7 @@ sub createproject :Local { sub job :Local { - my ( $self, $c, $projectName, $jobName ) = @_; + my ($self, $c, $projectName, $jobName) = @_; $c->stash->{template} = 'job.tt'; (my $project) = $c->model('DB::Projects')->search({ name => $projectName }); @@ -280,13 +286,13 @@ sub job :Local { sub default :Path { - my ( $self, $c ) = @_; + my ($self, $c) = @_; error($c, "Page not found."); } sub build :Local { - my ( $self, $c, $id ) = @_; + my ($self, $c, $id) = @_; my $build = getBuild($c, $id); return error($c, "Build with ID $id doesn't exist.") if !defined $build; @@ -307,7 +313,7 @@ sub build :Local { sub log :Local { - my ( $self, $c, $id ) = @_; + my ($self, $c, $id) = @_; my $build = getBuild($c, $id); return error($c, "Build $id doesn't exist.") if !defined $build; @@ -323,7 +329,7 @@ sub log :Local { sub nixlog :Local { - my ( $self, $c, $id, $stepnr ) = @_; + my ($self, $c, $id, $stepnr) = @_; my $build = getBuild($c, $id); return error($c, "Build with ID $id doesn't exist.") if !defined $build; @@ -356,7 +362,7 @@ sub loadLog { sub download :Local { - my ( $self, $c, $id, $productnr, $filename, @path ) = @_; + my ($self, $c, $id, $productnr, $filename, @path) = @_; my $build = getBuild($c, $id); return error($c, "Build with ID $id doesn't exist.") if !defined $build; @@ -390,7 +396,7 @@ sub download :Local { sub closure :Local { - my ( $self, $c, $buildId, $productnr ) = @_; + my ($self, $c, $buildId, $productnr) = @_; my $build = getBuild($c, $buildId); return error($c, "Build with ID $buildId doesn't exist.") if !defined $build; diff --git a/src/Hydra/root/common.tt b/src/Hydra/root/common.tt index 16eaa8a4..ad237fd1 100644 --- a/src/Hydra/root/common.tt +++ b/src/Hydra/root/common.tt @@ -1,3 +1,6 @@ +[% USE date %] + + [% inputTypes = { "svn" = "Subversion checkout" , "cvs" = "CVS checkout" @@ -9,8 +12,53 @@ } %] -[% USE date %] [% BLOCK renderDateTime %] [% date.format(timestamp, '%Y-%m-%d %H:%M:%S') -%] +[% END %] + + +[% BLOCK renderBuildList %] + + + + [% IF !hideResultInfo %] + + [% END %] + + [% IF showSchedulingInfo %] + + [% END %] + + + + + + + + + [% FOREACH build IN builds -%] + + [% IF !hideResultInfo %] + + [% END %] + + [% IF showSchedulingInfo %] + + [% END %] + + + + + + + [% END -%] + +
#PriorityProjectJobSystemTimestampDescription
+ [% IF build.resultInfo.buildstatus == 0 %] + + [% ELSE %] + + [% END %] + [% build.id %][% build.schedulingInfo.priority %][% build.project.name %][% build.attrname %][% build.system %][% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %][% build.description %]
[% END %] \ No newline at end of file diff --git a/src/Hydra/root/index.tt b/src/Hydra/root/index.tt index 29e00d67..9763cd60 100644 --- a/src/Hydra/root/index.tt +++ b/src/Hydra/root/index.tt @@ -1,70 +1,22 @@ [% WRAPPER layout.tt title="Hydra Overview" %] -[% USE date %] +[% PROCESS common.tt %]

Hydra Overview

-

Queue

- -[% IF scheduled.size == 0 %] - -

The queue is empty.

- -[% ELSE %] - - - - - - - [% FOREACH build IN scheduled -%] - - - - - - - - - - [% END -%] - -
#PriorityProjectJobSystemTimestampDescription
[% build.id %][% build.schedulingInfo.priority %][% build.project.name %][% build.attrname %][% build.system %][% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %][% build.description %]
- -[% END %] - -

Job status

Below are the latest builds for each job.

- - - - - - [% FOREACH build IN latestBuilds -%] - [% INCLUDE "short-build-info.tt" %] - [% END -%] - -
#ProjectJobSystemTimestampDescription
+[% PROCESS renderBuildList builds=latestBuilds %]

All builds

Number of builds: [% allBuilds.size %]

- - - - - - [% FOREACH build IN allBuilds -%] - [% INCLUDE "short-build-info.tt" %] - [% END -%] - -
#ProjectJobSystemTimestampDescription
+[% PROCESS renderBuildList builds=allBuilds %] [% END %] diff --git a/src/Hydra/root/job.tt b/src/Hydra/root/job.tt index 293b5442..7103bffd 100644 --- a/src/Hydra/root/job.tt +++ b/src/Hydra/root/job.tt @@ -1,16 +1,8 @@ [% WRAPPER layout.tt title="Hydra Overview" %] +[% PROCESS common.tt %]

All builds for job [% curProject.name %]:[% jobName %]

- - - - - - [% FOREACH build IN builds -%] - [% INCLUDE "short-build-info.tt" %] - [% END -%] - -
IdProjectJobSystemTimestampDescription
+[% PROCESS renderBuildList builds=builds %] [% END %] diff --git a/src/Hydra/root/short-build-info.tt b/src/Hydra/root/short-build-info.tt deleted file mode 100644 index e056e740..00000000 --- a/src/Hydra/root/short-build-info.tt +++ /dev/null @@ -1,17 +0,0 @@ -[% USE date %] - - - - [% IF build.resultInfo.buildstatus == 0 %] - - [% ELSE %] - - [% END %] - - [% build.id %] - [% build.project.name %] - [% build.attrname %] - [% build.system %] - [% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %] - [% build.description %] - diff --git a/src/Hydra/root/static/css/hydra.css b/src/Hydra/root/static/css/hydra.css index 25343dff..4763510f 100644 --- a/src/Hydra/root/static/css/hydra.css +++ b/src/Hydra/root/static/css/hydra.css @@ -185,7 +185,7 @@ ul.productList li { margin-top: 1em; } -tr.runningJob { +.runningJob { background-color: #ff3030; color: white; }