From 7685596aa844f643d8acfa173455049c615a8d87 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 27 Aug 2013 13:45:27 +0000 Subject: [PATCH] Transpose the aggregate constituents table This way, it grows vertically rather than horizontally. Horizontal may be more "logical", but this is more practical. --- src/lib/Hydra/Controller/Job.pm | 10 ++++-- src/root/common.tt | 2 +- src/root/job.tt | 58 +++++++++++------------------- src/root/layout.tt | 1 + src/root/static/css/hydra.css | 4 +++ src/root/static/css/rotated-th.css | 52 +++++++++++++++++++++++++++ 6 files changed, 86 insertions(+), 41 deletions(-) create mode 100644 src/root/static/css/rotated-th.css diff --git a/src/lib/Hydra/Controller/Job.pm b/src/lib/Hydra/Controller/Job.pm index 2e272395..4d186974 100644 --- a/src/lib/Hydra/Controller/Job.pm +++ b/src/lib/Hydra/Controller/Job.pm @@ -40,7 +40,7 @@ sub overview : Chained('job') PathPart('') Args(0) { # If this is an aggregate job, then get its constituents. my @constituents = $c->model('DB::Builds')->search( - { aggregate => { -in => $job->builds->search({}, { columns => ["id"], order_by => "id desc", rows => 10 })->as_query } }, + { aggregate => { -in => $job->builds->search({}, { columns => ["id"], order_by => "id desc", rows => 15 })->as_query } }, { join => 'aggregateconstituents_constituents', columns => ['id', 'job', 'finished', 'buildstatus'], +select => ['aggregateconstituents_constituents.aggregate'], @@ -51,11 +51,17 @@ sub overview : Chained('job') PathPart('') Args(0) { my %constituentJobs; foreach my $b (@constituents) { my $jobName = $b->get_column('job'); - $aggregates->{$b->get_column('aggregate')}->{$jobName} = + $aggregates->{$b->get_column('aggregate')}->{constituents}->{$jobName} = { id => $b->id, finished => $b->finished, buildstatus => $b->buildstatus}; $constituentJobs{$jobName} = 1; } + foreach my $agg (keys %$aggregates) { + # FIXME: could be done in one query. + $aggregates->{$agg}->{build} = + $c->model('DB::Builds')->find({id => $agg}, {columns => [@buildListColumns]}) or die; + } + $c->stash->{aggregates} = $aggregates; $c->stash->{constituentJobs} = [sort (keys %constituentJobs)]; } diff --git a/src/root/common.tt b/src/root/common.tt index 35e4b032..6e684087 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -20,7 +20,7 @@ BLOCK renderJobsetName %] BLOCK renderJobName %] -[% job %] +[% job %] [% END; diff --git a/src/root/job.tt b/src/root/job.tt index c9c4b6cb..10c719a5 100644 --- a/src/root/job.tt +++ b/src/root/job.tt @@ -28,51 +28,34 @@
- - - - - [% FOREACH j IN constituentJobs %] - - [% END %] - - - - [% FOREACH agg IN aggregates.keys.nsort.reverse %] - - - [% FOREACH j IN constituentJobs %] - - [% END %] - - [% END %] - -
#[% HTML.escape(j) %]
[% agg %] - [% r = aggregates.$agg.$j; IF r.id %] - - [% INCLUDE renderBuildStatusIcon size=16 build=r %] - - [% END %] -
- -
+
This is an aggregate job: + its success or failure is determined entirely by the result of + building its constituent jobs. The table below shows + the status of each constituent job for the [% + aggregates.keys.size %] most recent builds of the + aggregate.
- + [% aggs = aggregates.keys.nsort.reverse %] +
- - [% FOREACH j IN constituentJobs %] - + + [% FOREACH agg IN aggs %] + [% END %] - [% FOREACH agg IN aggregates.keys.nsort.reverse %] + [% FOREACH j IN constituentJobs %] - - [% FOREACH j IN constituentJobs %] - + [% FOREACH agg IN aggs %] +
#[% HTML.escape(j) %]Job + [% agg_ = aggregates.$agg %] +
+ [% agg %] +
[% agg %] - [% r = aggregates.$agg.$j; IF r.id %] + [% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %] + [% r = aggregates.$agg.constituents.$j; IF r.id %] [% INCLUDE renderBuildStatusIcon size=16 build=r %] @@ -84,7 +67,6 @@
-
[% END %] diff --git a/src/root/layout.tt b/src/root/layout.tt index 53d49633..be36af6f 100644 --- a/src/root/layout.tt +++ b/src/root/layout.tt @@ -24,6 +24,7 @@ +