Use the REST API in the web interface for editing jobsets
[?]
Oct 3, 2013, 4:49 PM
TQVKZQUGCFYNH5P56LXMXRXZNTD56MH5T5GX2BMQ5YSRPGHAUYMACDependencies
- [2]
ORIQGBTPFix jobset update - [3]
KZRH4VFKInclude the email override list in the Jobset serialization - [4]
ZCTQCN3EUse inputTypes from plugins to determine valid input types - [5]
GEADFVZ5hydra-queue-runner: Improved scheduling - [6]
KYSBJAYNAllow dashes in jobset input names - [7]
IRRNAEVLUse notFound instead of status_not_found - [8]
DAPOSS44Use the REST API in the web interface for editing projects - [9]
2G63HKCHFix some wellformedness issues - [10]
UWVMQIAC* Refactoring. - [11]
UMFB2767Hydra/64: Leaving number of builds empty gives DBIx error - [12]
3PNG7NIBRemove trailing whitespace - [13]
A6XVP6FEMake the hide/unhide actions a checkbox in the project settings - [14]
LZO3C2KI* Hack around those SQLite timeouts: just retry the transaction. - [15]
OX6NYJDVSplit viewing and editing a jobset - [16]
VJFLX7B6Fix rendering of jobset inputs - [17]
HQGXL4MXAdd validation for project and jobset names - [18]
75XUS62Y* Added a page to quickly see all failed builds and failed evaluations - [19]
FPK5LF53* Put the project-related actions in a separate controller. Put the - [20]
QTC3SYBMJobset page: Load the jobs and status tabs on demand - [21]
JAH3UPWASupport revision control systems via plugins - [22]
OOQ2D3KC* Refactoring: move fetchInput out of hydra_scheduler into a separate - [23]
BV7V5RGNAllow only project owners to delete projects / jobsets - [24]
ODNCGFQ5* Improved the navigation bar: don't include all projects (since that - [25]
JARRBLZDBootstrapify the Hydra forms (except the project and jobset edit pages) - [26]
2P7VNAACMove common Javascript code into a separate file - [27]
M4TBFHHJ"limit" -> "rows" - [28]
4NTIBJ74Implement DELETE for jobsets and use it in the web interface - [29]
6Q2JPSWGFix lazy tab loading - [30]
JY7BXXOPSplit viewing and editing a project - [31]
3HZY24CX* Make jobsets viewable under - [32]
ZRRPBEI4Make jobset deletion consistent with project deletion - [33]
LZVO64YGMerge in the first bits of the API work
Change contents
- edit in src/lib/Hydra/Controller/Jobset.pm at line 13
$c->stash->{jobsetName} //= $jobsetName; - replacement in src/lib/Hydra/Controller/Jobset.pm at line 21
$c->stash->{jobset_} = $project->jobsets->search({'me.name' => $jobsetName});my $jobset = $c->stash->{jobset_}->single;$c->stash->{jobset} = $project->jobsets->find({ name => $jobsetName }); - replacement in src/lib/Hydra/Controller/Jobset.pm at line 23[7.245]→[7.245:444](∅→∅),[7.444]→[9.6555:6572](∅→∅),[9.6555]→[9.6555:6572](∅→∅),[9.6572]→[7.445:514](∅→∅),[7.514]→[9.6922:6932](∅→∅),[9.6922]→[9.6922:6932](∅→∅),[9.7086]→[9.7086:7092](∅→∅)
if ($jobset) {$c->stash->{jobset} = $jobset;} else {if ($c->action->name eq "jobset" and $c->request->method eq "PUT") {$c->stash->{jobsetName} = $jobsetName;} else {notFound($c, "Jobset ‘$jobsetName’ doesn't exist.");}}notFound($c, "Jobset ‘$jobsetName’ doesn't exist.")if !$c->stash->{jobset} && !($c->action->name eq "jobset" and $c->request->method eq "PUT"); - replacement in src/lib/Hydra/Controller/Jobset.pm at line 41[9.7209]→[9.7209:7423](∅→∅),[9.7423]→[3.0:40](∅→∅),[3.40]→[9.7423:7860](∅→∅),[9.7423]→[9.7423:7860](∅→∅)
$self->status_ok($c,entity => $c->stash->{jobset_}->find({}, {columns => ['me.name','me.project','me.errormsg','me.emailoverride','jobsetinputs.name',{'jobsetinputs.jobsetinputalts.altnr' => 'jobsetinputalts.altnr','jobsetinputs.jobsetinputalts.value' => 'jobsetinputalts.value'}],join => { 'jobsetinputs' => 'jobsetinputalts' },collapse => 1,order_by => "me.name"}));$self->status_ok($c, entity => $c->stash->{jobset}); - edit in src/lib/Hydra/Controller/Jobset.pm at line 50
error($c, "Cannot rename jobset `$c->stash->{params}->{oldName}' over existing jobset `$c->stash->{jobset}->name") if defined $c->stash->{params}->{oldName} and $c->stash->{params}->{oldName} ne $c->stash->{jobset}->name; - edit in src/lib/Hydra/Controller/Jobset.pm at line 53
if ($c->req->looks_like_browser) {$c->res->redirect($c->uri_for($self->action_for("jobset"),[$c->stash->{project}->name, $c->stash->{jobset}->name]) . "#tabs-configuration");} else {$self->status_no_content($c);}} elsif (defined $c->stash->{params}->{oldName}) {my $jobset = $c->stash->{project}->jobsets->find({'me.name' => $c->stash->{params}->{oldName}});if (defined $jobset) {txn_do($c->model('DB')->schema, sub {updateJobset($c, $jobset);});my $uri = $c->uri_for($self->action_for("jobset"), [$c->stash->{project}->name, $jobset->name]);if ($c->req->looks_like_browser) {$c->res->redirect($uri . "#tabs-configuration");} else {$self->status_created($c,location => "$uri",entity => { name => $jobset->name, uri => "$uri", type => "jobset" });}} else {$self->status_not_found($c,message => "Jobset $c->stash->{params}->{oldName} doesn't exist.");}} else {my $exprType =$c->stash->{params}->{"nixexprpath"} =~ /.scm$/ ? "guile" : "nix"; - replacement in src/lib/Hydra/Controller/Jobset.pm at line 54
error($c, "Invalid jobset name: ‘$c->stash->{jobsetName}’") if $c->stash->{jobsetName} !~ /^$jobsetNameRE$/;my $uri = $c->uri_for($self->action_for("jobset"), [$c->stash->{project}->name, $c->stash->{jobset}->name]) . "#tabs-configuration";$self->status_ok($c, entity => { redirect => "$uri" });} - edit in src/lib/Hydra/Controller/Jobset.pm at line 58
else { - replacement in src/lib/Hydra/Controller/Jobset.pm at line 64
{name => $c->stash->{jobsetName}, nixexprinput => "", nixexprpath => "", emailoverride => ""});{name => ".tmp", nixexprinput => "", nixexprpath => "", emailoverride => ""}); - replacement in src/lib/Hydra/Controller/Jobset.pm at line 69
if ($c->req->looks_like_browser) {$c->res->redirect($uri . "#tabs-configuration");} else {$self->status_created($c,location => "$uri",entity => { name => $jobset->name, uri => "$uri", type => "jobset" });}$self->status_created($c,location => "$uri",entity => { name => $jobset->name, uri => "$uri", redirect => "$uri", type => "jobset" }); - edit in src/lib/Hydra/Controller/Jobset.pm at line 153[5.867]→[9.705:709](∅→∅),[9.705]→[9.705:709](∅→∅),[9.709]→[9.10938:10993](∅→∅),[9.10993]→[9.759:784](∅→∅),[9.759]→[9.759:784](∅→∅),[9.784]→[9.14:15](∅→∅),[9.840]→[9.840:861](∅→∅),[9.861]→[9.0:51](∅→∅),[9.229]→[9.16:17](∅→∅),[9.861]→[9.16:17](∅→∅),[9.17]→[9.11122:11423](∅→∅)
}sub submit : Chained('jobsetChain') PathPart Args(0) {my ($self, $c) = @_;requirePost($c);requireProjectOwner($c, $c->stash->{project});my $newName = trim $c->stash->{params}->{name};my $oldName = trim $c->stash->{jobset}->name;unless ($oldName eq $newName) {$c->stash->{params}->{oldName} = $oldName;$c->stash->{jobsetName} = $newName;undef $c->stash->{jobset};}jobset_PUT($self, $c); - replacement in src/lib/Hydra/Controller/Jobset.pm at line 161
error($c, "Invalid Nix expression path: $nixExprPath") if $nixExprPath !~ /^$relPathRE$/;error($c, "Invalid Nix expression path ‘$nixExprPath’.") if $nixExprPath !~ /^$relPathRE$/; - replacement in src/lib/Hydra/Controller/Jobset.pm at line 164
error($c, "Invalid Nix expression input name: $nixExprInput") unless $nixExprInput =~ /^[[:alpha:]][\w-]*$/;error($c, "Invalid Nix expression input name ‘$nixExprInput’.") unless $nixExprInput =~ /^[[:alpha:]][\w-]*$/; - replacement in src/lib/Hydra/Controller/Jobset.pm at line 173
error($c, "Invalid Boolean value: $value") iferror($c, "Invalid Boolean value ‘$value’.") if - edit in src/lib/Hydra/Controller/Jobset.pm at line 181
my $jobsetName = $c->stash->{params}->{name};error($c, "Invalid jobset identifier ‘$jobsetName’.") if $jobsetName !~ /^$jobsetNameRE$/; - replacement in src/lib/Hydra/Controller/Jobset.pm at line 185
my $jobsetName = $c->stash->{jobsetName} // $jobset->name;error($c, "Invalid jobset name: ‘$jobsetName’") if $jobsetName !~ /^$jobsetNameRE$/;error($c, "Cannot rename jobset to ‘$jobsetName’ since that identifier is already taken.")if $jobsetName ne $jobset->name && defined $c->stash->{project}->jobsets->find({ name => $jobsetName }); - replacement in src/lib/Hydra/Controller/Jobset.pm at line 228
error($c, "Invalid input name: $inputName") unless $inputName =~ /^[[:alpha:]][\w-]*$/;error($c, "Invalid input name ‘$inputName’.") unless $inputName =~ /^[[:alpha:]][\w-]*$/; - replacement in src/lib/Hydra/Controller/Jobset.pm at line 232
error($c, "Invalid input type: $inputType") unless defined $c->stash->{inputTypes}->{$inputType};error($c, "Invalid input type ‘$inputType’.") unless defined $c->stash->{inputTypes}->{$inputType}; - replacement in src/lib/Hydra/Controller/Project.pm at line 31
if (!$c->stash->{project} && !($c->action->name eq "project" and $c->request->method eq "PUT"));if !$c->stash->{project} && !($c->action->name eq "project" and $c->request->method eq "PUT"); - edit in src/lib/Hydra/Controller/Project.pm at line 142
- edit in src/lib/Hydra/Controller/Project.pm at line 143
sub create_jobset_submit : Chained('projectChain') PathPart('create-jobset/submit') Args(0) {my ($self, $c) = @_; - edit in src/lib/Hydra/Controller/Project.pm at line 144[9.5146]→[9.20158:20222](∅→∅),[9.20222]→[9.2236:2237](∅→∅),[9.5197]→[9.2236:2237](∅→∅),[9.2237]→[9.20223:20277](∅→∅),[9.5771]→[9.3745:3749](∅→∅),[9.20277]→[9.3745:3749](∅→∅),[9.3745]→[9.3745:3749](∅→∅)
$c->stash->{jobsetName} = trim $c->stash->{params}->{name};Hydra::Controller::Jobset::jobset_PUT($self, $c);} - replacement in src/root/edit-jobset.tt at line 47
<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"><form class="form-horizontal"> - replacement in src/root/edit-jobset.tt at line 135
<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> [%IF create %]Create[% ELSE %]Apply changes[% END %]</button><button id="submit-jobset" type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> [%IF create %]Create[% ELSE %]Apply changes[% END %]</button> - replacement in src/root/edit-jobset.tt at line 148
<script type="text/javascript">$(document).ready(function() {var id = 0;</form> - replacement in src/root/edit-jobset.tt at line 150
$(".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;});<script type="text/javascript">$(document).ready(function() {var id = 0; - replacement in src/root/edit-jobset.tt at line 154
$(".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");});$(".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; - replacement in src/root/edit-jobset.tt at line 162
</script>$(".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");});}); - replacement in src/root/edit-jobset.tt at line 169
</form>$("#submit-jobset").click(function() {requestJSON({[% IF create %]url: "[% c.uri_for('/jobset' project.name '.new') %]",[% ELSE %]url: "[% c.uri_for('/jobset' project.name jobset.name) %]",[% END %]data: $(this).parents("form").serialize(),type: 'PUT',success: function(data) {window.location = data.redirect;},});return false;});</script> - edit in src/root/edit-project.tt at line 60[9.2553]→[9.2553:2593](∅→∅),[9.2593]→[8.1209:1720](∅→∅),[8.1720]→[9.2720:2752](∅→∅),[9.2720]→[9.2720:2752](∅→∅)
<script type="text/javascript">$("#submit-project").click(function() {requestJSON({[% IF create %]url: "[% c.uri_for('/project' '.new') %]",[% ELSE %]url: "[% c.uri_for('/project' project.name) %]",[% END %]data: $(this).parents("form").serialize(),type: 'PUT',success: function(data) {window.location = data.redirect;},});return false;});</script> - edit in src/root/edit-project.tt at line 66
<script type="text/javascript">$("#submit-project").click(function() {requestJSON({[% IF create %]url: "[% c.uri_for('/project' '.new') %]",[% ELSE %]url: "[% c.uri_for('/project' project.name) %]",[% END %]data: $(this).parents("form").serialize(),type: 'PUT',success: function(data) {window.location = data.redirect;},});return false;});</script> - edit in src/root/edit-project.tt at line 85
- replacement in src/root/static/js/common.js at line 77
var makeLazyTab = function(tabName, uri) {function makeLazyTab(tabName, uri) { - replacement in src/root/static/js/common.js at line 90
}}; - replacement in src/root/static/js/common.js at line 92
var requestJSON = function(args) {function escapeHTML(s) {return $('<div/>').text(s).html();};function requestJSON(args) { - replacement in src/root/static/js/common.js at line 106
bootbox.alert(json.error);bootbox.alert(escapeHTML(json.error)); - replacement in src/root/static/js/common.js at line 108
bootbox.alert("Server error: " + data.responseText);bootbox.alert("Server error: " + escapeHTML(data.responseText)); - replacement in src/root/static/js/common.js at line 113
}}; - replacement in src/root/static/js/common.js at line 115
var redirectJSON = function(args) {function redirectJSON(args) { - replacement in src/root/static/js/common.js at line 120
}[8.2964]};