* UI for cloning builds (not functional yet).

This commit is contained in:
Eelco Dolstra 2009-10-26 14:30:42 +00:00
parent cd27c046b0
commit 57cc6ceca6
6 changed files with 81 additions and 2 deletions

View file

@ -385,4 +385,28 @@ sub add_to_release : Chained('build') PathPart('add-to-release') Args(0) {
}
sub clone : Chained('build') PathPart('clone') Args(0) {
my ($self, $c) = @_;
my $build = $c->stash->{build};
requireProjectOwner($c, $build->project);
$c->stash->{template} = 'clone-build.tt';
}
sub clone_submit : Chained('build') PathPart('clone/submit') Args(0) {
my ($self, $c) = @_;
my $build = $c->stash->{build};
requireProjectOwner($c, $build->project);
$c->flash->{buildMsg} = "Build XXX added to the queue.";
$c->res->redirect($c->uri_for($c->controller('Root')->action_for('queue')));
}
1;

View file

@ -60,6 +60,7 @@ sub queue :Local {
$c->stash->{template} = 'queue.tt';
$c->stash->{queue} = [$c->model('DB::Builds')->search(
{finished => 0}, {join => 'schedulingInfo', order_by => ["priority DESC", "timestamp"]})];
$c->stash->{flashMsg} = $c->flash->{buildMsg};
}

View file

@ -211,7 +211,6 @@
[% END %]
</table>
[% IF c.user_exists && available %]
<form action="[% c.uri_for('/build' build.id 'add-to-release') %]" method="post">
<p>Add to release: <input type="text" class="string" name="name" />
@ -219,6 +218,9 @@
</form>
[% END %]
[% IF c.user_exists %]
<p>[<a href="[% c.uri_for('/build' build.id 'clone') %]">Clone this build</a>]</p>
[% END %]
[% IF build.buildproducts %]

48
src/root/clone-build.tt Normal file
View file

@ -0,0 +1,48 @@
[% WRAPPER layout.tt title="Clone Build" %]
[% PROCESS common.tt %]
[% USE HTML %]
[% edit=1 %]
<h1>Clone Build</h1>
<p>Cloning allows you to perform a build with modified inputs.</p>
<form action="[% c.uri_for('/build' build.id 'clone' 'submit') %]" method="post">
<h2>Nix expression</h2>
<p>Evaluate job <tt><input type="text" class="string"
name="jobname" [% HTML.attributes(value => build.job.name) %]
/></tt> in Nix expression <tt><input type="text" class="string"
name="nixexprpath" [% HTML.attributes(value => build.nixexprpath) %]
/></tt> in input <tt><input type="text" class="string"
name="nixexprinput" [% HTML.attributes(value => build.nixexprinput)
%] /></tt>.</p>
<h2>Build inputs</h2>
<table class="tablesorter">
<thead>
<tr><th>Name</th><th>Type</th><th>Value</th></tr>
</thead>
<tbody>
[% FOREACH input IN build.inputs -%]
<tr>
<td><tt>[% input.name %]</tt></td>
<td>
[% INCLUDE renderSelection curValue=input.type param="input-$input.name-type" options=inputTypes %]
</td>
<td>
<tt><input type="text" class="string" name="input-[% input.name %]-value"
[% HTML.attributes(value => input.value || input.uri || input.dependency.id) %] /></tt>
</td>
</tr>
[% END -%]
</tbody>
</table>
<p><button type="submit"><img alt="Add" src="/static/images/success.gif" />Add to queue</button></p>
</form>
[% END %]

View file

@ -95,7 +95,7 @@
[% END %]
<a href="[% c.uri_for(c.controller('Project').action_for('create_jobset'), [project.name]) %]">[Create a new jobset]</a>
<p><a href="[% c.uri_for(c.controller('Project').action_for('create_jobset'), [project.name]) %]">[Create a new jobset]</a></p>
<h2>Views</h2>

View file

@ -3,6 +3,10 @@
<h1>Hydra Queue</h1>
[% IF flashMsg %]
<p class="error">[% flashMsg %]</p>
[% END %]
[% IF queue.size == 0 %]
<p>The queue is empty.</p>