From 621ce1ee64f1b93ac96a4f068b2d20ad3a16ee7a Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <e.dolstra@tudelft.nl>
Date: Wed, 5 Nov 2008 03:25:48 +0000
Subject: [PATCH]

---
 src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm |  6 +++---
 src/HydraFrontend/root/build.tt                        | 10 +++++++++-
 src/HydraFrontend/root/index.tt                        |  4 ++--
 src/HydraFrontend/root/job.tt                          |  2 +-
 src/HydraFrontend/root/short-build-info.tt             |  3 ++-
 5 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm
index 956c044c..851f5006 100644
--- a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm
+++ b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm
@@ -32,15 +32,15 @@ sub index :Path :Args(0) {
     $c->stash->{allBuilds} = [$c->model('DB::Builds')->all];
     # Get the latest build for each unique job.
     # select * from builds as x where timestamp == (select max(timestamp) from builds where jobName == x.jobName);
-    $c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef, {order_by => "jobName", where => "timestamp == (select max(timestamp) from builds where jobName == me.jobName)"})];
+    $c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef, {order_by => "project, attrName", where => "timestamp == (select max(timestamp) from builds where project == me.project and attrName == me.attrName)"})];
 }
 
 
 sub job :Local {
-    my ( $self, $c, $jobName ) = @_;
+    my ( $self, $c, $project, $jobName ) = @_;
     $c->stash->{template} = 'job.tt';
     $c->stash->{jobName} = $jobName;
-    $c->stash->{builds} = [$c->model('DB::Builds')->search({jobName => $jobName}, {order_by => "timestamp DESC"})];
+    $c->stash->{builds} = [$c->model('DB::Builds')->search({project => $project, attrName => $jobName}, {order_by => "timestamp DESC"})];
 }
 
 
diff --git a/src/HydraFrontend/root/build.tt b/src/HydraFrontend/root/build.tt
index 57c7534f..a27aab90 100644
--- a/src/HydraFrontend/root/build.tt
+++ b/src/HydraFrontend/root/build.tt
@@ -10,9 +10,17 @@
     <th>Build ID:</th>
     <td>[% build.id %]</td>
   </tr>
+  <tr>
+    <th>Project:</th>
+    <td><tt>[% build.project %]</tt></td>
+  </tr>
+  <tr>
+    <th>Jobset:</th>
+    <td><tt>[% build.jobset %]</tt></td>
+  </tr>
   <tr>
     <th>Job name:</th>
-    <td>[% build.jobname %]</td>
+    <td><tt>[% build.attrname %]</tt></td>
   </tr>
   <tr>
     <th>Description:</th>
diff --git a/src/HydraFrontend/root/index.tt b/src/HydraFrontend/root/index.tt
index 2f80a90d..3a545e8b 100644
--- a/src/HydraFrontend/root/index.tt
+++ b/src/HydraFrontend/root/index.tt
@@ -6,7 +6,7 @@
 
 <table class="tablesorter">
   <thead>
-    <tr><th></th><th>#</th><th>Job</th><th>Timestamp</th><th>Description</th></tr>
+    <tr><th></th><th>#</th><th>Project</th><th>Job</th><th>Timestamp</th><th>Description</th></tr>
   </thead>
   <tbody>
     [% FOREACH build IN latestBuilds -%]
@@ -21,7 +21,7 @@
 
 <table class="tablesorter">
   <thead>
-    <tr><th></th><th>#</th><th>Job</th><th>Timestamp</th><th>Description</th></tr>
+    <tr><th></th><th>#</th><th>Project</th><th>Job</th><th>Timestamp</th><th>Description</th></tr>
   </thead>
   <tbody>
     [% FOREACH build IN allBuilds -%]
diff --git a/src/HydraFrontend/root/job.tt b/src/HydraFrontend/root/job.tt
index 33932347..9547401d 100644
--- a/src/HydraFrontend/root/job.tt
+++ b/src/HydraFrontend/root/job.tt
@@ -3,7 +3,7 @@
 <h1>All builds for job <tt>[% jobName %]</tt></h1>
 
 <table>
-  <tr><th></th><th>Id</th><th>Job</th><th>Timestamp</th><th>Description</th></tr>
+  <tr><th></th><th>Id</th><th>Project</th><th>Job</th><th>Timestamp</th><th>Description</th></tr>
   [% FOREACH build IN builds -%]
     [% INCLUDE "short-build-info.tt" %]
   [% END -%]
diff --git a/src/HydraFrontend/root/short-build-info.tt b/src/HydraFrontend/root/short-build-info.tt
index c5391058..74b73c65 100644
--- a/src/HydraFrontend/root/short-build-info.tt
+++ b/src/HydraFrontend/root/short-build-info.tt
@@ -9,7 +9,8 @@
     [% END %]
   </td>
   <td><a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a></td>
-  <td><a href="[% c.uri_for('/job' build.jobname) %]"><tt>[% build.jobname %]</tt></a></td>
+  <td><a href="[% c.uri_for('/project' build.project) %]"><tt>[% build.project %]</tt></a></td>
+  <td><a href="[% c.uri_for('/job' build.project build.attrname) %]"><tt>[% build.jobset %]:[% build.attrname %]</tt></a></td>
   <td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
   <td>[% build.description %]</td>
 </tr>