From bd93ca9316e454490ac031954b19edf77b9818f5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Apr 2012 15:45:48 +0200 Subject: [PATCH] Add a redirect to the evaluation page of a view result E.g. http://hydra.nixos.org/view/nixpkgs/unstable/latest/eval Thus this is the channel representing the latest Nixpkgs for which the elements of the view "unstable" succeeded: http://hydra.nixos.org/view/nixpkgs/unstable/latest/eval/channel --- src/lib/Hydra/Controller/View.pm | 8 ++++++++ src/lib/Hydra/Helper/Nix.pm | 1 + 2 files changed, 9 insertions(+) diff --git a/src/lib/Hydra/Controller/View.pm b/src/lib/Hydra/Controller/View.pm index 88504fc2..4f958f8e 100644 --- a/src/lib/Hydra/Controller/View.pm +++ b/src/lib/Hydra/Controller/View.pm @@ -193,6 +193,14 @@ sub result : Chained('view') PathPart('') { [$c->stash->{project}->name, $release->name])); } + elsif (scalar @args >= 1 && $args[0] eq "eval") { + my $eval = $c->stash->{result}->{eval}; + notFound($c, "This view result has no evaluation.") unless defined $eval; + my $uri = $c->uri_for($c->controller('JobsetEval')->action_for("view"), [$eval->id]); + $uri .= "/" . join("/", @args[1..$#args]) if scalar @args > 1; + $c->res->redirect($uri); + } + # Provide a redirect to the specified job of this view result # through `http://.../view/$project/$viewName/$viewResult/$jobName'. # Optionally, you can append `-$system' to the $jobName to get a diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index ab87989e..9eb42759 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -216,6 +216,7 @@ sub getViewResult { , jobs => [@jobs] , status => $status , timestamp => $timestamp + , eval => $ev }; }