diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index 8655bea8..5ee9cd5f 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -115,7 +115,7 @@ sub edit : Chained('jobset') PathPart Args(0) { requireProjectOwner($c, $c->stash->{project}); - $c->stash->{template} = 'jobset.tt'; + $c->stash->{template} = 'edit-jobset.tt'; $c->stash->{edit} = 1; } @@ -235,8 +235,8 @@ sub updateJobset { , description => trim($c->request->params->{"description"}) , nixexprpath => $nixExprPath , nixexprinput => $nixExprInput - , enabled => trim($c->request->params->{enabled}) eq "1" ? 1 : 0 - , enableemail => trim($c->request->params->{enableemail}) eq "1" ? 1 : 0 + , enabled => defined $c->request->params->{enabled} ? 1 : 0 + , enableemail => defined $c->request->params->{enableemail} ? 1 : 0 , emailoverride => trim($c->request->params->{emailoverride}) || "" , keepnr => trim($c->request->params->{keepnr}) || 3 }); diff --git a/src/lib/Hydra/Controller/Project.pm b/src/lib/Hydra/Controller/Project.pm index 36cfbe0b..905b6e09 100644 --- a/src/lib/Hydra/Controller/Project.pm +++ b/src/lib/Hydra/Controller/Project.pm @@ -110,7 +110,7 @@ sub create_jobset : Chained('project') PathPart('create-jobset') Args(0) { requireProjectOwner($c, $c->stash->{project}); - $c->stash->{template} = 'jobset.tt'; + $c->stash->{template} = 'edit-jobset.tt'; $c->stash->{create} = 1; $c->stash->{edit} = 1; } diff --git a/src/root/common.tt b/src/root/common.tt index 1e60cd01..ede0f0a8 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -196,11 +196,6 @@ BLOCK maybeLink; END; -BLOCK maybeButton; - IF uri %] uri); IF confirmmsg %]onclick="javascript:return confirm('[% confirmmsg %]')"[% END; content %][% ELSE; content; END; -END; - - BLOCK renderSelection; IF edit; IF radiobuttons; %] @@ -227,21 +222,8 @@ BLOCK renderSelection; END; -BLOCK maybeEditString; - IF edit %] - param, name => param, value => value) %] /> - [% ELSE; - HTML.escape(value); - END; -END; - - -BLOCK editString; - IF edit %] - param, name => param, value => value) %] /> - [% ELSE; - HTML.escape(value); - END; +BLOCK editString; %] + param, name => param, value => value) %] /> END; diff --git a/src/root/edit-jobset.tt b/src/root/edit-jobset.tt new file mode 100644 index 00000000..83bcd025 --- /dev/null +++ b/src/root/edit-jobset.tt @@ -0,0 +1,143 @@ +[% WRAPPER layout.tt title=(create ? "Create jobset in project $project.name" : "Editing jobset $project.name:$jobset.name") %] +[% PROCESS common.tt %] + +[% BLOCK renderInputAlt %] + + alt.value, name => name) %]> +
+[% END %] + +[% BLOCK renderInput %] + + + + input.name) %]> + + + [% INCLUDE renderSelection curValue=input.type param="$baseName-type" options=inputTypes %] + + + [% FOREACH alt IN input.jobsetinputalts %] + + [% INCLUDE renderInputAlt alt=alt name="$baseName-values" %] + + [% END %] + [% IF edit %][% END %] + + +[% END %] + +[% BLOCK renderInputs %] + + + + + + [% FOREACH input IN jobset.jobsetinputs %] + [% INCLUDE renderInput input=input baseName="input-$input.name" %] + [% END %] + + + +
Input nameTypeValues
+[% END %] + +
+ +
+ +
+
+ +
+
+ +
+ +
+ jobset.name) %]> +
+
+ +
+ +
+ jobset.description) %]> +
+
+ +
+ +
+ jobset.nixexprpath) %]> + in + jobset.nixexprinput) %]> +
+
+ +
+
+ +
+
+ +
+ +
+ jobset.emailoverride) %]> +
+
+ +
+ +
+ jobset.keepnr) %]> +
+
+ + [% INCLUDE renderInputs %] + +
+ +
+ +
+ + + [% INCLUDE renderInput input="" extraClass="template" id="input-template" baseName="input-template" %] + + + + + + +
+ +[% END %] + + diff --git a/src/root/edit-project.tt b/src/root/edit-project.tt index 56c356ac..4bac8c43 100644 --- a/src/root/edit-project.tt +++ b/src/root/edit-project.tt @@ -8,12 +8,12 @@
diff --git a/src/root/jobset.tt b/src/root/jobset.tt index d7ff8118..781fce22 100644 --- a/src/root/jobset.tt +++ b/src/root/jobset.tt @@ -1,28 +1,11 @@ -[% WRAPPER layout.tt title=(edit ? (create ? "Create jobset in project $project.name" : "Editing jobset $project.name:$jobset.name") : "Jobset $project.name:$jobset.name") %] +[% WRAPPER layout.tt title="Jobset $project.name:$jobset.name" %] [% PROCESS common.tt %] -[% IF edit %] -
-[% END %] - - -[% BLOCK renderInputAlt %] - [% IF edit %] - - [% INCLUDE maybeEditString param=param value=alt.value %] -
- [% ELSE %] - [% INCLUDE maybeEditString param=param value=alt.value %] - [% END %] -[% END %] - [% BLOCK renderInput %] - - [% IF edit %][% END %] - [% INCLUDE maybeEditString param="$baseName-name" value=input.name %] + [% HTML.escape(input.name) %] [% INCLUDE renderSelection curValue=input.type param="$baseName-type" options=inputTypes %] @@ -30,230 +13,160 @@ [% FOREACH alt IN input.jobsetinputalts %] - [% IF input.type == "string" && !edit %] + [% IF input.type == "string" %] "[% HTML.escape(alt.value) %]" [% ELSE %] - [% INCLUDE renderInputAlt alt=alt param="$baseName-values" %] + [% HTML.escape(alt.value) %] [% END %] [% END %] - [% IF edit %][% END %] - [% END %] [% BLOCK renderInputs %] -

Inputs

- - - - - - - [% FOREACH input IN jobset.jobsetinputs %] - [% INCLUDE renderInput input=input baseName="input-$input.name" %] - [% END %] - [% IF edit %] - - - - [% END %] - -
Input nameTypeValues
- +

Inputs

+ + + + + + [% FOREACH input IN jobset.jobsetinputs %] + [% INCLUDE renderInput input=input baseName="input-$input.name" %] + [% END %] + +
Input nameTypeValues
[% END %] - +
-
- [% IF !edit && evals.size() > 0 %] -

Most recent evaluations

- [% INCLUDE renderEvals linkToAll=c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name]) %] - [% END %] - [% IF !edit && activeJobsStatus %] -

Status

- - [% FOREACH s IN systems %][% END %] - - [% odd = 0 %] - [% FOREACH j IN activeJobsStatus %] - - - [% FOREACH s IN systems %] - [% system = s.system %] - [% systemStatus = j.get_column(system) %] - - [% END %] - - [% END %] - -
Job[% s.system %]
[% INCLUDE renderJobName project=project.name jobset = jobset.name job = j.get_column('job') %] - [% IF systemStatus != undef %] - - [% INCLUDE renderBuildStatusIcon buildstatus=systemStatus size=16 %] - - [% END %] -
- [% END %] - [% IF !edit && !activeJobsStatus %] -

Status

-

- [ Show status overview ] -

- [% END %] -
- [% IF !edit %] +
- [% IF jobset.errormsg %] -
-

Evaluation errors

-

- Errors occurred at [% INCLUDE renderDateTime timestamp=jobset.errortime %]. -

-
[% HTML.escape(jobset.errormsg) %]
-
- [% END %] - [% END %] -
-

Information

+ [% IF evals.size() > 0 %] +

Most recent evaluations

+ [% INCLUDE renderEvals linkToAll=c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name]) %] + [% END %] - - [% IF edit %] - - - - - [% END %] - - - - - - - - - - - - - - - - - - - + [% END %] + +
Identifier:[% INCLUDE maybeEditString param="name" value=jobset.name %]
Description:[% INCLUDE maybeEditString param="description" value=jobset.description %]
Nix expression: - [% INCLUDE maybeEditString param="nixexprpath" value=jobset.nixexprpath %] in input - [% INCLUDE maybeEditString param="nixexprinput" value=jobset.nixexprinput %] -
Enabled: - [% INCLUDE renderSelection param="enabled" curValue=jobset.enabled radiobuttons=1 options={"1" = "Yes", "0" = "No"} %] -
Enable email notification: - [% INCLUDE renderSelection param="enableemail" curValue=jobset.enableemail radiobuttons=1 options={"1" = "Yes", "0" = "No"} %] -
Email override: - [% INCLUDE maybeEditString param="emailoverride" value=jobset.emailoverride %] + [% IF activeJobsStatus %] +

Status

+ + [% FOREACH s IN systems %][% END %] + + [% odd = 0 %] + [% FOREACH j IN activeJobsStatus %] + + + [% FOREACH s IN systems %] + [% system = s.system %] + [% systemStatus = j.get_column(system) %] + - - - - - - [% IF !edit %] - - - - - [% END %] -
Job[% s.system %]
[% INCLUDE renderJobName project=project.name jobset = jobset.name job = j.get_column('job') %] + [% IF systemStatus != undef %] + + [% INCLUDE renderBuildStatusIcon buildstatus=systemStatus size=16 %] + + [% END %]
Number of builds to keep: - [% INCLUDE maybeEditString param="keepnr" value=jobset.keepnr %] -
Last checked: - [% IF jobset.lastcheckedtime %] - [% INCLUDE renderDateTime timestamp = jobset.lastcheckedtime %][% IF jobset.errormsg %], with errors! - [% ELSE %], no errors - [% END %] - [% ELSE %] - never - [% END %] -
+ [% END %] +
+ [% ELSE %] +

Status

+

+ [ Show status overview ] +

+ [% END %] +
- [% INCLUDE renderInputs %] -
- [% IF !edit %] -
+ [% IF jobset.errormsg %] +
+

Evaluation errors

+

+ Errors occurred at [% INCLUDE renderDateTime timestamp=jobset.errortime %]. +

+
[% HTML.escape(jobset.errormsg) %]
+
+ [% END %] -

Jobs

+
+

Information

-

This jobset currently contains the following [% activeJobs.size %] jobs: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Description:[% HTML.escape(jobset.description) %]
Nix expression: + [% HTML.escape(jobset.nixexprpath) %] in input + [% HTML.escape(jobset.nixexprinput) %] +
Enabled:[% jobset.enabled ? "Yes" : "No" %]
Enable email notification:[% jobset.enableemail ? "Yes" : "No" %]
Email override:[% HTML.escape(jobset.emailoverride) %]
Number of builds to keep:[% jobset.keepnr %]
Last checked: + [% IF jobset.lastcheckedtime %] + [% INCLUDE renderDateTime timestamp = jobset.lastcheckedtime %][% IF jobset.errormsg %], with errors![% ELSE %], no errors[% END %] + [% ELSE %] + never + [% END %] +
-

- [% IF activeJobs.size == 0 %](none)[% END %] - [% FOREACH j IN activeJobs %][% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]
[% END %] -
-

+ [% INCLUDE renderInputs %] +
-

This jobset used to contain the following [% inactiveJobs.size %] jobs: +

-
- [% IF inactiveJobs.size == 0 %](none)[% END %] - [% FOREACH j IN inactiveJobs %][% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]
[% END %] -
+

This jobset currently contains the following [% activeJobs.size %] jobs: -

+
+ [% IF activeJobs.size == 0 %](none)[% END %] + [% FOREACH j IN activeJobs %][% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]
[% END %] +
+

-
- [% END %] +

This jobset used to contain the following [% inactiveJobs.size %] jobs: + +

+ [% IF inactiveJobs.size == 0 %](none)[% END %] + [% FOREACH j IN inactiveJobs %][% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]
[% END %] +
+

+ +
-[% IF edit %] - - - [% INCLUDE renderInput input="" extraClass="template" id="input-template" baseName="input-template" %] -
- - - [% INCLUDE renderInputAlt alt=alt %] - - - - -
- -
- -
- -[% END %] - - [% END %]