forked from lix-project/hydra
Split viewing and editing a jobset
This commit is contained in:
parent
9c7b416f8b
commit
547e41263d
|
@ -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
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -196,11 +196,6 @@ BLOCK maybeLink;
|
|||
END;
|
||||
|
||||
|
||||
BLOCK maybeButton;
|
||||
IF uri %]<a class="btn btn-mini" [% HTML.attributes(href => uri); IF confirmmsg %]onclick="javascript:return confirm('[% confirmmsg %]')"[% END; content %]</a>[% ELSE; content; END;
|
||||
END;
|
||||
|
||||
|
||||
BLOCK renderSelection;
|
||||
IF edit;
|
||||
IF radiobuttons; %]
|
||||
|
@ -227,21 +222,8 @@ BLOCK renderSelection;
|
|||
END;
|
||||
|
||||
|
||||
BLOCK maybeEditString;
|
||||
IF edit %]
|
||||
<input type="text" class="string [% extraClass %]" [% HTML.attributes(id => param, name => param, value => value) %] />
|
||||
[% ELSE;
|
||||
HTML.escape(value);
|
||||
END;
|
||||
END;
|
||||
|
||||
|
||||
BLOCK editString;
|
||||
IF edit %]
|
||||
BLOCK editString; %]
|
||||
<input type="text" class="string" [% HTML.attributes(id => param, name => param, value => value) %] />
|
||||
[% ELSE;
|
||||
HTML.escape(value);
|
||||
END;
|
||||
END;
|
||||
|
||||
|
||||
|
|
143
src/root/edit-jobset.tt
Normal file
143
src/root/edit-jobset.tt
Normal file
|
@ -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 %]
|
||||
<button type="button" class="btn btn-warning" onclick='$(this).parents(".inputalt").remove()'><i class="icon-trash icon-white"></i></button>
|
||||
<input type="text" [% HTML.attributes(value => alt.value, name => name) %]></input>
|
||||
<br />
|
||||
[% END %]
|
||||
|
||||
[% BLOCK renderInput %]
|
||||
<tr class="input [% extraClass %]" [% IF id %]id="[% id %]"[% END %]>
|
||||
<td>
|
||||
<button type="button" class="btn btn-warning" onclick='$(this).parents(".input").remove()'><i class="icon-trash icon-white"></i></button>
|
||||
<tt><input type="text" name="[% baseName %]-name" [% HTML.attributes(value => input.name) %]></input>
|
||||
</td>
|
||||
<td>
|
||||
[% INCLUDE renderSelection curValue=input.type param="$baseName-type" options=inputTypes %]
|
||||
</td>
|
||||
<td class="inputalts" id="[% baseName %]">
|
||||
[% FOREACH alt IN input.jobsetinputalts %]
|
||||
<span class="inputalt">
|
||||
[% INCLUDE renderInputAlt alt=alt name="$baseName-values" %]
|
||||
</span>
|
||||
[% END %]
|
||||
[% IF edit %]<button type="button" class="add-inputalt btn btn-success" onclick='return false'><i class="icon-plus icon-white"></i></button>[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
||||
[% BLOCK renderInputs %]
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr><th>Input name</th><th>Type</th><th>Values</th></tr>
|
||||
</thead>
|
||||
<tbody class="inputs">
|
||||
[% FOREACH input IN jobset.jobsetinputs %]
|
||||
[% INCLUDE renderInput input=input baseName="input-$input.name" %]
|
||||
[% END %]
|
||||
<tr>
|
||||
<td colspan="3" style="text-align: center;"><button type="button" class="add-input btn btn-success"><i class="icon-plus icon-white"></i> Add a new input</button></td
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
[% END %]
|
||||
|
||||
<form class="form-horizontal" action="[% IF create %][% c.uri_for('/project' project.name 'create-jobset/submit') %][% ELSE %][% c.uri_for('/jobset' project.name jobset.name 'submit') %][% END %]" method="post">
|
||||
|
||||
<fieldset>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="enabled" [% IF jobset.enabled; 'checked="checked"'; END %]></input>Enabled
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Identifier</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="span3" name="name" [% HTML.attributes(value => jobset.name) %]></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Description</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="span3" name="description" [% HTML.attributes(value => jobset.description) %]></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Nix expression</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="span3" name="nixexprpath" [% HTML.attributes(value => jobset.nixexprpath) %]></input>
|
||||
in
|
||||
<input type="text" class="span3" name="nixexprinput" [% HTML.attributes(value => jobset.nixexprinput) %]></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="enableemail" [% IF jobset.enableemail; 'checked="checked"'; END %]></input>Email notification
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Email override</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="span3" name="emailoverride" [% HTML.attributes(value => jobset.emailoverride) %]></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Number of builds to keep</label>
|
||||
<div class="controls">
|
||||
<input type="number" class="span3" name="keepnr" [% HTML.attributes(value => jobset.keepnr) %]></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% INCLUDE renderInputs %]
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> [%IF create %]Create[% ELSE %]Apply changes[% END %]</button>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<table class="hidden">
|
||||
[% INCLUDE renderInput input="" extraClass="template" id="input-template" baseName="input-template" %]
|
||||
</table>
|
||||
|
||||
<tt class="inputalt hidden" id="inputalt-template">
|
||||
[% INCLUDE renderInputAlt alt=alt %]
|
||||
</tt>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var id = 0;
|
||||
|
||||
$(".add-input").click(function() {
|
||||
var newid = "input-" + id++;
|
||||
var x = $("#input-template").clone(true).attr("id", "").insertBefore($(this).parents("tr")).show();
|
||||
$("#input-template-name", x).attr("name", newid + "-name");
|
||||
$("#input-template-type", x).attr("name", newid + "-type");
|
||||
$("#input-template", x).attr("id", newid);
|
||||
return false;
|
||||
});
|
||||
|
||||
$(".add-inputalt").click(function() {
|
||||
var x = $("#inputalt-template").clone(true).insertBefore($(this)).attr("id", "").show();
|
||||
$("input", x).attr("name", x.parents(".inputalts").attr("id") + "-values");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</form>
|
||||
|
||||
[% END %]
|
||||
|
||||
|
|
@ -8,12 +8,12 @@
|
|||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="enabled" value="enabled" [% IF project.enabled; 'checked="checked"'; END %]></input>Enabled
|
||||
<input type="checkbox" name="enabled" [% IF project.enabled; 'checked="checked"'; END %]></input>Enabled
|
||||
</label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="visible" value="visible" [% IF !project.hidden; 'checked="checked"'; END %]></input>Visible in the list of projects
|
||||
<input type="checkbox" name="visible" [% IF !project.hidden; 'checked="checked"'; END %]></input>Visible in the list of projects
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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 %]
|
||||
<form class="form-horizontal" action="[% IF create %][% c.uri_for('/project' project.name 'create-jobset/submit') %][% ELSE %][% c.uri_for('/jobset' project.name jobset.name 'submit') %][% END %]" method="post">
|
||||
[% END %]
|
||||
|
||||
|
||||
[% BLOCK renderInputAlt %]
|
||||
[% IF edit %]
|
||||
<button type="button" class="btn btn-warning" onclick='$(this).parents(".inputalt").remove()'><i class="icon-trash icon-white"></i></button>
|
||||
[% INCLUDE maybeEditString param=param value=alt.value %]
|
||||
<br />
|
||||
[% ELSE %]
|
||||
[% INCLUDE maybeEditString param=param value=alt.value %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
|
||||
[% BLOCK renderInput %]
|
||||
|
||||
<tr class="input [% extraClass %]" [% IF id %]id="[% id %]"[% END %]>
|
||||
<td>
|
||||
[% IF edit %]<button type="button" class="btn btn-warning" onclick='$(this).parents(".input").remove()'><i class="icon-trash icon-white"></i></button>[% END %]
|
||||
<tt>[% INCLUDE maybeEditString param="$baseName-name" value=input.name %]</tt>
|
||||
<tt>[% HTML.escape(input.name) %]</tt>
|
||||
</td>
|
||||
<td>
|
||||
[% INCLUDE renderSelection curValue=input.type param="$baseName-type" options=inputTypes %]
|
||||
|
@ -30,23 +13,20 @@
|
|||
<td class="inputalts" id="[% baseName %]">
|
||||
[% FOREACH alt IN input.jobsetinputalts %]
|
||||
<tt class="inputalt">
|
||||
[% 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 %]
|
||||
</tt>
|
||||
[% END %]
|
||||
[% IF edit %]<button type="button" class="add-inputalt btn btn-success" onclick='return false'><i class="icon-plus icon-white"></i></button>[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
[% END %]
|
||||
|
||||
|
||||
[% BLOCK renderInputs %]
|
||||
<h3>Inputs</h3>
|
||||
|
||||
<table class="tablesorter table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr><th>Input name</th><th>Type</th><th>Values</th></tr>
|
||||
|
@ -55,33 +35,30 @@
|
|||
[% FOREACH input IN jobset.jobsetinputs %]
|
||||
[% INCLUDE renderInput input=input baseName="input-$input.name" %]
|
||||
[% END %]
|
||||
[% IF edit %]
|
||||
<tr>
|
||||
<td colspan="3" style="text-align: center;"><button type="button" class="add-input btn btn-success"><i class="icon-plus icon-white"></i> Add a new input</button></td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
[% END %]
|
||||
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
[% IF !edit %]
|
||||
<li class="active"><a href="#tabs-information" data-toggle="tab">Jobset</a></li>
|
||||
[% IF jobset.errormsg %]<li><a href="#tabs-errors" data-toggle="tab"><img src="/static/images/error_16.png" /> Evaluation errors</a></li>[% END %]
|
||||
<li><a href="#tabs-jobs" data-toggle="tab">Jobs ([% activeJobs.size %])</a></li>
|
||||
[% IF jobset.errormsg %]
|
||||
<li><a href="#tabs-errors" data-toggle="tab"><img src="/static/images/error_16.png" /> Evaluation errors</a></li>
|
||||
[% END %]
|
||||
<li><a href="#tabs-setup" data-toggle="tab">Setup</a></li>
|
||||
<li><a href="#tabs-jobs" data-toggle="tab">Jobs ([% activeJobs.size %])</a></li>
|
||||
<li><a href="#tabs-setup" data-toggle="tab">Configuration</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="generic-tabs" class="tab-content">
|
||||
|
||||
<div id="tabs-information" class="tab-pane active">
|
||||
[% IF !edit && evals.size() > 0 %]
|
||||
|
||||
[% IF evals.size() > 0 %]
|
||||
<h2>Most recent evaluations</h2>
|
||||
[% INCLUDE renderEvals linkToAll=c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name]) %]
|
||||
[% END %]
|
||||
[% IF !edit && activeJobsStatus %]
|
||||
|
||||
[% IF activeJobsStatus %]
|
||||
<h2>Status</h2>
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead><tr><th>Job</th>[% FOREACH s IN systems %]<th>[% s.system %]</th>[% END %]</tr></thead>
|
||||
|
@ -105,8 +82,7 @@
|
|||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
[% END %]
|
||||
[% IF !edit && !activeJobsStatus %]
|
||||
[% ELSE %]
|
||||
<h2>Status</h2>
|
||||
<p>
|
||||
[ <a href="[% c.uri_for('/jobset' project.name jobset.name 'with-status' ) %]">Show status overview</a> ]
|
||||
|
@ -114,7 +90,6 @@
|
|||
[% END %]
|
||||
|
||||
</div>
|
||||
[% IF !edit %]
|
||||
|
||||
[% IF jobset.errormsg %]
|
||||
<div id="tabs-errors" class="tab-pane">
|
||||
|
@ -125,75 +100,54 @@
|
|||
<pre class="multiLineMsg error">[% HTML.escape(jobset.errormsg) %]</pre>
|
||||
</div>
|
||||
[% END %]
|
||||
[% END %]
|
||||
<div id="tabs-setup" class="tab-pane [% IF edit %]active[% END %]">
|
||||
|
||||
<div id="tabs-setup" class="tab-pane">
|
||||
<h2>Information</h2>
|
||||
|
||||
<table class="layoutTable">
|
||||
[% IF edit %]
|
||||
<tr>
|
||||
<th>Identifier:</th>
|
||||
<td>[% INCLUDE maybeEditString param="name" value=jobset.name %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
<tr>
|
||||
<th>Description:</th>
|
||||
<td>[% INCLUDE maybeEditString param="description" value=jobset.description %]</td>
|
||||
<td>[% HTML.escape(jobset.description) %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nix expression:</th>
|
||||
<td>
|
||||
<tt>[% INCLUDE maybeEditString param="nixexprpath" value=jobset.nixexprpath %]</tt> in input
|
||||
<tt>[% INCLUDE maybeEditString param="nixexprinput" value=jobset.nixexprinput %]</tt>
|
||||
<tt>[% HTML.escape(jobset.nixexprpath) %]</tt> in input
|
||||
<tt>[% HTML.escape(jobset.nixexprinput) %]</tt>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Enabled:</th>
|
||||
<td>
|
||||
[% INCLUDE renderSelection param="enabled" curValue=jobset.enabled radiobuttons=1 options={"1" = "Yes", "0" = "No"} %]
|
||||
</td>
|
||||
<td>[% jobset.enabled ? "Yes" : "No" %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Enable email notification:</th>
|
||||
<td>
|
||||
[% INCLUDE renderSelection param="enableemail" curValue=jobset.enableemail radiobuttons=1 options={"1" = "Yes", "0" = "No"} %]
|
||||
</td>
|
||||
<td>[% jobset.enableemail ? "Yes" : "No" %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email override:</th>
|
||||
<td>
|
||||
[% INCLUDE maybeEditString param="emailoverride" value=jobset.emailoverride %]
|
||||
</td>
|
||||
<td>[% HTML.escape(jobset.emailoverride) %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Number of builds to keep:</th>
|
||||
<td>
|
||||
[% INCLUDE maybeEditString param="keepnr" value=jobset.keepnr %]
|
||||
</td>
|
||||
<td>[% jobset.keepnr %]</td>
|
||||
</tr>
|
||||
[% IF !edit %]
|
||||
<tr>
|
||||
<th>Last checked:</th>
|
||||
<td>
|
||||
[% IF jobset.lastcheckedtime %]
|
||||
[% INCLUDE renderDateTime timestamp = jobset.lastcheckedtime %][% IF jobset.errormsg %]<em>, with errors!</em>
|
||||
[% ELSE %], <em>no errors</em>
|
||||
[% END %]
|
||||
[% INCLUDE renderDateTime timestamp = jobset.lastcheckedtime %][% IF jobset.errormsg %]<em>, with errors!</em>[% ELSE %], <em>no errors</em>[% END %]
|
||||
[% ELSE %]
|
||||
<em>never</em>
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</table>
|
||||
|
||||
|
||||
[% INCLUDE renderInputs %]
|
||||
</div>
|
||||
[% IF !edit %]
|
||||
<div id="tabs-jobs" class="tab-pane">
|
||||
|
||||
<h2>Jobs</h2>
|
||||
<div id="tabs-jobs" class="tab-pane">
|
||||
|
||||
<p>This jobset currently contains the following [% activeJobs.size %] jobs:
|
||||
|
||||
|
@ -209,51 +163,10 @@
|
|||
[% IF inactiveJobs.size == 0 %]<em>(none)</em>[% END %]
|
||||
[% FOREACH j IN inactiveJobs %][% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]<br/>[% END %]
|
||||
</blockquote>
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
[% END %]
|
||||
|
||||
</div>
|
||||
|
||||
[% IF edit %]
|
||||
|
||||
<table class="template"> <!-- dummy wrapper needed because “hidden” trs are visible anyway -->
|
||||
[% INCLUDE renderInput input="" extraClass="template" id="input-template" baseName="input-template" %]
|
||||
</table>
|
||||
|
||||
<tt class="inputalt template" id="inputalt-template">
|
||||
[% INCLUDE renderInputAlt alt=alt %]
|
||||
</tt>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var id = 0;
|
||||
|
||||
$(".add-input").click(function() {
|
||||
var newid = "input-" + id++;
|
||||
var x = $("#input-template").clone(true).attr("id", "").insertBefore($(this).parents("tr")).show();
|
||||
$("#input-template-name", x).attr("name", newid + "-name");
|
||||
$("#input-template-type", x).attr("name", newid + "-type");
|
||||
$("#input-template", x).attr("id", newid);
|
||||
return false;
|
||||
});
|
||||
|
||||
$(".add-inputalt").click(function() {
|
||||
var x = $("#inputalt-template").clone(true).insertBefore($(this)).attr("id", "").show();
|
||||
$("input", x).attr("name", x.parents(".inputalts").attr("id") + "-values");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> [%IF create %]Create[% ELSE %]Apply changes[% END %]</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
[% END %]
|
||||
|
||||
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in a new issue