* Adding input value alternatives.

This commit is contained in:
Eelco Dolstra 2008-11-17 13:36:58 +00:00
parent 2650094643
commit 0c0175d88e
5 changed files with 61 additions and 27 deletions

View file

@ -196,7 +196,7 @@
<ul class="productList"> <ul class="productList">
[% FOREACH product IN build.buildproducts -%] [% FOREACH product IN build.buildproducts -%]
<li> <li class="product">
[% SWITCH product.type %] [% SWITCH product.type %]
[% CASE "nix-build" %] [% CASE "nix-build" %]
@ -213,8 +213,8 @@
File <tt>[% product.name %]</tt> of type <tt>[% product.subtype %]</tt> File <tt>[% product.name %]</tt> of type <tt>[% product.subtype %]</tt>
[% END %] [% END %]
</a> </a>
[<a href="javascript:" onclick="javascript:$('#foo-[% product.productnr %]').toggle()">details</a>] [<a class="productDetailsToggle" href="javascript:">details</a>]
<div class="productDetails" id="foo-[% product.productnr %]"> <div class="productDetails">
<table> <table>
<tr> <tr>
<th>URL:</th> <th>URL:</th>
@ -262,12 +262,21 @@
</ul> </ul>
<script>
$(document).ready(function() {
$('.productDetailsToggle').toggle(
function () { $(".productDetails", $(this).parents(".product")).fadeIn(); },
function () { $(".productDetails", $(this).parents(".product")).hide(); }
);
});
</script>
[% END %] [% END %]
[% IF build.buildlogs %] [% IF build.buildlogs %]
<div id="bla"> <div>
<h2>Logs</h2> <h2>Logs</h2>

View file

@ -26,6 +26,7 @@ table {
empty-cells: show; empty-cells: show;
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0px; border-spacing: 0px;
margin-bottom: 1em;
} }
th { th {
@ -179,24 +180,21 @@ tr.runningJob {
margin-left: 3em; margin-left: 3em;
} }
div.template { .template {
display: none; display: none;
} }
div.jobset { div.jobset {
border: solid black 1px; border: solid black 1px;
-moz-border-radius: 1em;
border-radius: 1em;
padding-left: 1em; padding-left: 1em;
padding-right: 1em; padding-right: 1em;
padding-bottom: 1em;
margin-bottom: 1em; margin-bottom: 1em;
} }
div.jobset-edit { div.jobset-edit {
border: solid black 1px;
background-color: #f8f8f8; background-color: #f8f8f8;
padding-left: 1em;
padding-right: 1em;
margin-bottom: 1em;
} }
div.jobset-edit h3, div.jobset h3 { div.jobset-edit h3, div.jobset h3 {

View file

@ -14,7 +14,7 @@
<head> <head>
<title>[% title %]</title> <title>[% title %]</title>
<link rel="stylesheet" href="/hydra.css" type="text/css" /> <link rel="stylesheet" href="/hydra.css" type="text/css" />
<script type="text/javascript" src="/static/js/tablesorter/jquery-latest.js"></script> <script type="text/javascript" src="/static/js/jquery-pack.js"></script>
<script type="text/javascript" src="/static/js/tablesorter/jquery.tablesorter.js"></script> <script type="text/javascript" src="/static/js/tablesorter/jquery.tablesorter.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready( $(document).ready(

View file

@ -57,14 +57,25 @@
<h4>Inputs</h4> <h4>Inputs</h4>
[% IF edit %]
<p><button onclick='$(this).parents(".jobset").remove()'>Add a new input</button></p>
[% END %]
<table class="tablesorter"> <table class="tablesorter">
<thead> <thead>
<tr><th>Input name</th><th>Type</th><th>Values</th></tr> <tr>[% IF edit %]<th></th>[% END %]<th>Input name</th><th>Type</th><th>Values</th></tr>
</thead> </thead>
<tbody> <tbody>
[% FOREACH input IN jobset.jobsetinputs -%] [% FOREACH input IN jobset.jobsetinputs -%]
<tr> <tr class="input">
<td><tt>[% INCLUDE maybeEditString param="jobset-$baseName-input-$input.name-name" value=input.name extraClass="shortString" %]</tt></td> [% IF edit %]
<td>
[% IF edit %]<a href="javascript:" onclick='$(this).parents(".input").remove()'>[X]</a>[% END -%]
</td>
[% END %]
<td>
<tt>[% INCLUDE maybeEditString param="jobset-$baseName-input-$input.name-name" value=input.name extraClass="shortString" %]</tt>
</td>
<td> <td>
[% IF edit %] [% IF edit %]
<select name="[% "jobset-$baseName-input-$input.name-type" %]"> <select name="[% "jobset-$baseName-input-$input.name-type" %]">
@ -78,16 +89,18 @@
[% INCLUDE renderInputType type=input.type %] [% INCLUDE renderInputType type=input.type %]
[% END %] [% END %]
</td> </td>
<td> <td class="inputalts" id="[% "jobset-$baseName-input-$input.name" %]">
[% FOREACH alt IN input.jobsetinputalts -%] [% FOREACH alt IN input.jobsetinputalts -%]
<tt> <tt class="inputalt">
[% IF input.type == "string" && !edit %] [% IF input.type == "string" && !edit %]
"[% HTML.escape(alt.value) %]" "[% HTML.escape(alt.value) %]"
[% ELSE %] [% ELSE %]
[% INCLUDE maybeEditString param="jobset-$baseName-input-$input.name-values" value=alt.value %] [% INCLUDE maybeEditString param="jobset-$baseName-input-$input.name-values" value=alt.value %]
[% IF edit %]<a href="javascript:" onclick='$(this).parents(".inputalt").remove()'>[X]</a>[% END %]
[% END %] [% END %]
</tt> </tt>
[% END %] [% END %]
[% IF edit %]<a href="javascript:" class="addinputalt">[+]</a>[% END %]
</td> </td>
</tr> </tr>
[% END %] [% END %]
@ -95,7 +108,8 @@
</table> </table>
[% IF edit %] [% IF edit %]
<p><button onclick='$(this).parents(".jobset").remove()' id="jobset-[% baseName %]-delete">Delete this jobset</button></p> <hr />
<p><button onclick='$(this).parents(".jobset").remove()'>Delete this jobset</button></p>
[% END %] [% END %]
</div> </div>
@ -145,17 +159,30 @@
<div id="jobset-template" class="template"> <div id="jobset-template" class="template">
[% INCLUDE renderJobset jobset="" baseName="template" %] [% INCLUDE renderJobset jobset="" baseName="template" %]
</div> </div>
<tt id="inputalt-template" class="inputalt template">
<input type="text" class="string" />
<a href="javascript:" onclick='$(this).parents(".inputalt").remove()'>[X]</a>
</tt>
<script> <script>
var id = 0; $(document).ready(function() {
$("#add-jobset").click(function() { var id = 0;
var newid = "jobset-" + id++;
$("#jobset-template").clone(true).attr("id", newid).insertAfter($("#jobset-template")).show(); $("#add-jobset").click(function() {
$("#jobset-template-name", $("#" + newid)).attr("name", newid + "-name"); var newid = "jobset-" + id++;
$("#jobset-template-description", $("#" + newid)).attr("name", newid + "-description"); $("#jobset-template").clone(true).attr("id", newid).insertAfter($("#jobset-template")).slideDown("fast");
$("#jobset-template-nixexprpath", $("#" + newid)).attr("name", newid + "-nixexprpath"); $("#jobset-template-name", $("#" + newid)).attr("name", newid + "-name");
$("#jobset-template-nixexprinput", $("#" + newid)).attr("name", newid + "-nixexprinput"); $("#jobset-template-description", $("#" + newid)).attr("name", newid + "-description");
return false; $("#jobset-template-nixexprpath", $("#" + newid)).attr("name", newid + "-nixexprpath");
$("#jobset-template-nixexprinput", $("#" + newid)).attr("name", newid + "-nixexprinput");
return false;
});
$(".addinputalt").click(function() {
var x = $("#inputalt-template").clone(true).insertBefore($(this)).show();
$("input", x).attr("name", x.parent(".inputalts").attr("id") + "-values");
});
}); });
</script> </script>
[% END %] [% END %]

View file

@ -35,7 +35,7 @@ sub fetchInput {
my $type = $input->type; my $type = $input->type;
if ($type eq "path") { if ($type eq "path") {
my $uri = $alt->uri; my $uri = $alt->value;
my $storePath = `nix-store --add "$uri"` my $storePath = `nix-store --add "$uri"`
or die "cannot copy path $uri to the Nix store"; or die "cannot copy path $uri to the Nix store";
chomp $storePath; chomp $storePath;