From 83d6ad7aa263824074e7397e2ec0a97da2e36d6d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 13 Nov 2008 18:16:57 +0000 Subject: [PATCH] --- .../lib/HydraFrontend/Controller/Root.pm | 2 +- src/HydraFrontend/root/project.tt | 14 ++++++++++---- src/hydra.sql | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm index 42682d4c..d446f438 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm @@ -126,7 +126,7 @@ sub project :Local { $c->model('DB')->schema->txn_do(sub { updateProject($c, $project); }); - return $c->res->redirect($c->uri_for("/project", $projectName)); + return $c->res->redirect($c->uri_for("/project", $c->request->params->{name})); } elsif ($subcommand eq "delete" && $isPosted) { $c->model('DB')->schema->txn_do(sub { $project->delete; diff --git a/src/HydraFrontend/root/project.tt b/src/HydraFrontend/root/project.tt index 569e43d1..143bea3a 100644 --- a/src/HydraFrontend/root/project.tt +++ b/src/HydraFrontend/root/project.tt @@ -13,15 +13,21 @@ [% BLOCK renderJobset %] -
+
-

Jobset [% INCLUDE maybeEditString param="jobset-$baseName-name" value=jobset.name %]

+

[% IF jobset %]Jobset [% jobset.name %][% ELSE %]New jobset[% END %]

-
+

Information

+ [% IF edit %] + + + + + [% END %] @@ -137,7 +143,7 @@ $("#add-jobset").click(function() { var newid = "jobset-" + id++; $("#jobset-template").clone(true).attr("id", newid).insertAfter($("#jobset-template")).show(); - $("#jobset-template-name", $("#" + newid)).attr("name", newid + "-name").attr("value", newid); + $("#jobset-template-name", $("#" + newid)).attr("name", newid + "-name").attr("value", "trunk"); $("#jobset-template-description", $("#" + newid)).attr("name", newid + "-description"); $("#jobset-template-nixexprpath", $("#" + newid)).attr("name", newid + "-nixexprpath"); $("#jobset-template-nixexprinput", $("#" + newid)).attr("name", newid + "-nixexprinput"); diff --git a/src/hydra.sql b/src/hydra.sql index ff0f14a7..3b406f48 100644 --- a/src/hydra.sql +++ b/src/hydra.sql @@ -155,6 +155,16 @@ create table Projects ( ); +create trigger cascadeProjectUpdate + update of name on Projects + for each row begin + update Jobsets set project = new.name where project = old.name; + update JobsetInputs set project = new.name where project = old.name; + update JobsetInputAlts set project = new.name where project = old.name; + update Builds set project = new.name where project = old.name; + end; + + -- A jobset consists of a set of inputs (e.g. SVN repositories), one -- of which contains a Nix expression containing an attribute set -- describing build jobs. @@ -170,6 +180,15 @@ create table Jobsets ( ); +create trigger cascadeJobsetUpdate + update of name on jobsets + for each row begin + update JobsetInputs set jobset = new.name where jobset = old.name; + update JobsetInputAlts set jobset = new.name where jobset = old.name; + update Builds set jobset = new.name where jobset = old.name; + end; + + create table JobsetInputs ( project text not null, jobset text not null,
Identifier:[% INCLUDE maybeEditString param="jobset-$baseName-name" value=jobset.name %]
Description: [% INCLUDE maybeEditString param="jobset-$baseName-description" value=jobset.description %]