forked from lix-project/hydra
This commit is contained in:
parent
06b49e0df7
commit
58cb6fbea5
|
@ -213,7 +213,7 @@ sub getReleaseSet {
|
|||
$c->stash->{releaseSet} = $releaseSet;
|
||||
|
||||
(my $primaryJob) = $releaseSet->releasesetjobs->search({isprimary => 1});
|
||||
die "Release set $releaseSetName doesn't have a primary job." if !defined $primaryJob;
|
||||
#die "Release set $releaseSetName doesn't have a primary job." if !defined $primaryJob;
|
||||
|
||||
$c->stash->{jobs} = [$releaseSet->releasesetjobs->search({},
|
||||
{order_by => ["isprimary DESC", "job", "attrs"]})];
|
||||
|
@ -275,6 +275,26 @@ sub updateReleaseSet {
|
|||
$releaseSet->name($releaseSetName);
|
||||
$releaseSet->description(trim $c->request->params->{description});
|
||||
$releaseSet->update;
|
||||
|
||||
$releaseSet->releasesetjobs->delete_all;
|
||||
|
||||
foreach my $param (keys %{$c->request->params}) {
|
||||
next unless $param =~ /^job-(\d+)-name$/;
|
||||
my $baseName = $1;
|
||||
|
||||
my $name = trim $c->request->params->{"job-$baseName-name"};
|
||||
my $description = trim $c->request->params->{"job-$baseName-description"};
|
||||
my $attrs = trim $c->request->params->{"job-$baseName-attrs"};
|
||||
|
||||
$releaseSet->releasesetjobs->create(
|
||||
{ job => $name
|
||||
, description => $description
|
||||
, attrs => $attrs
|
||||
, isprimary => $c->request->params->{"primary"} eq $baseName
|
||||
});
|
||||
}
|
||||
|
||||
die "There must be one primary job." if $releaseSet->releasesetjobs->search({isprimary => 1})->count != 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,30 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Primary job</th>
|
||||
<th>Job name</th>
|
||||
<th>Description</th>
|
||||
<th>Constraint</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% n = 0 %]
|
||||
[% FOREACH job IN jobs %]
|
||||
<tr>
|
||||
<td><input type="radio" name="primary" [% IF job.isprimary %]
|
||||
checked="checked" [% END %] [% HTML.attributes(value => "$n") %] /> [% n %]</td>
|
||||
<td><input type="text" class="string" [% HTML.attributes(name => "job-$n-name", value => job.job) %] /></td>
|
||||
<td><input type="text" class="string" [% HTML.attributes(name => "job-$n-description", value => job.description) %] /></td>
|
||||
<td><input type="text" class="string" [% HTML.attributes(name => "job-$n-attrs", value => job.attrs) %] /></td>
|
||||
</tr>
|
||||
[% n = n + 1 %]
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><button type="submit"><img src="/static/images/success.gif" />[%IF create %]Create[% ELSE %]Apply changes[% END %]</button></p>
|
||||
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue