Propagate URI parameters

This allows URIs like

  http://hydra.nixos.org/jobset/nixpkgs/trunk/latest-eval?compare=stdenv

to do the right thing.
This commit is contained in:
Eelco Dolstra 2012-04-04 12:56:49 +02:00
parent 05d03ee153
commit e9dd3158a0
2 changed files with 5 additions and 8 deletions

View file

@ -364,9 +364,7 @@ sub latest_eval : Chained('jobset') PathPart('latest-eval') {
my ($self, $c, @args) = @_;
my $eval = getLatestFinishedEval($c, $c->stash->{jobset})
or notFound($c, "No evaluation found.");
my $uri = $c->uri_for($c->controller('JobsetEval')->action_for("view"), [$eval->id]);
$uri .= "/" . join("/", @args) if scalar @args > 0;
$c->res->redirect($uri);
$c->res->redirect($c->uri_for($c->controller('JobsetEval')->action_for("view"), [$eval->id], @args, $c->req->params));
}

View file

@ -142,7 +142,7 @@ sub latest : Chained('view') PathPart('latest') {
my $latest = getLatestSuccessfulViewResult(
$c->stash->{project}, $c->stash->{primaryJob}, $c->stash->{jobs}, 0);
error($c, "This view set has no successful results yet.") if !defined $latest;
$c->res->redirect($c->uri_for($self->action_for("view_view"), $c->req->captures, $latest->id, @args));
$c->res->redirect($c->uri_for($self->action_for("view_view"), $c->req->captures, $latest->id, @args, $c->req->params));
}
@ -155,7 +155,7 @@ sub latest_finished : Chained('view') PathPart('latest-finished') {
my $latest = getLatestSuccessfulViewResult(
$c->stash->{project}, $c->stash->{primaryJob}, $c->stash->{jobs}, 1);
error($c, "This view set has no successful results yet.") if !defined $latest;
$c->res->redirect($c->uri_for($self->action_for("view_view"), $c->req->captures, $latest->id, @args));
$c->res->redirect($c->uri_for($self->action_for("view_view"), $c->req->captures, $latest->id, @args, $c->req->params));
}
@ -209,9 +209,8 @@ sub result : Chained('view') PathPart('') {
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);
$c->res->redirect($c->uri_for($c->controller('JobsetEval')->action_for("view"),
[$eval->id], @args[1..$#args], $c->req->params));
}
# Provide a redirect to the specified job of this view result