Use the REST API in the web interface for editing projects
[?]
Oct 3, 2013, 3:23 PM
DAPOSS44WRFQZ7XUWSMYCCORY4POKD42DGAIXMGP4ZRBOEPNNRGACDependencies
- [2]
6LTPI6B2 - [3]
6Q2JPSWGFix lazy tab loading - [4]
D7PL2VWUMove more actions from the top bar - [5]
BV7V5RGNAllow only project owners to delete projects / jobsets - [6]
H66SHOS7Fix and clean up editing project settings - [7]
LZO3C2KI* Hack around those SQLite timeouts: just retry the transaction. - [8]
K22TMPH5Make the info tables less compressed - [9]
FPK5LF53* Put the project-related actions in a separate controller. Put the - [10]
JY7BXXOPSplit viewing and editing a project - [11]
LZVO64YGMerge in the first bits of the API work - [12]
M6UBWKN2Fix project/jobset deletion - [13]
ZRRPBEI4Make jobset deletion consistent with project deletion - [14]
JARRBLZDBootstrapify the Hydra forms (except the project and jobset edit pages) - [15]
225GEK4NAfter editing a project/jobset, redirect back to the config tab - [16]
ODNCGFQ5* Improved the navigation bar: don't include all projects (since that - [17]
UWVMQIAC* Refactoring. - [18]
QTFVCDIFadded hide feature for project/jobset - [19]
2VBQRQ2QFix some XML well-formedness problems - [20]
A6XVP6FEMake the hide/unhide actions a checkbox in the project settings - [21]
MJ4RWQ3TAdd links to the project/jobset edit pages in the logical place - [22]
3PNG7NIBRemove trailing whitespace - [*]
7YBYT2LQ - [*]
ZI535LI6* hydra: 'new' UI for project/jobset/job/build - [*]
W6DC6K4I* Happy Javascript hacking. - [*]
2P7VNAACMove common Javascript code into a separate file
Change contents
- edit in src/lib/Hydra/Controller/Project.pm at line 3
use utf8; - edit in src/lib/Hydra/Controller/Project.pm at line 55
- replacement in src/lib/Hydra/Controller/Project.pm at line 60
if ($c->req->looks_like_browser) {$c->res->redirect($c->uri_for($self->action_for("project"), [$c->stash->{project}->name]) . "#tabs-configuration");} else {$self->status_no_content($c);}my $uri = $c->uri_for($self->action_for("project"), [$c->stash->{project}->name]) . "#tabs-configuration";$self->status_ok($c, entity => { redirect => "$uri" }); - replacement in src/lib/Hydra/Controller/Project.pm at line 74
{ name => ".tmp.$$." . int(rand(100000)), displayname => "", owner => $owner });{ name => ".tmp", displayname => "", owner => $owner }); - replacement in src/lib/Hydra/Controller/Project.pm at line 79
if ($c->req->looks_like_browser) {$c->res->redirect($uri . "#tabs-configuration");} else {$self->status_created($c,location => "$uri",entity => { name => $project->name, uri => "$uri", type => "project" });}$self->status_created($c,location => "$uri",entity => { name => $project->name, uri => "$uri", redirect => "$uri", type => "project" }); - replacement in src/lib/Hydra/Controller/Project.pm at line 85
sub edit : Chained('projectChain') PathPart Args(0) {sub project_DELETE { - replacement in src/lib/Hydra/Controller/Project.pm at line 90
$c->stash->{template} = 'edit-project.tt';$c->stash->{edit} = 1;txn_do($c->model('DB')->schema, sub {$c->stash->{project}->jobsetevals->delete_all;$c->stash->{project}->builds->delete_all;$c->stash->{project}->delete;});my $uri = $c->res->redirect($c->uri_for("/"));$self->status_ok($c, entity => { redirect => "$uri" }); - replacement in src/lib/Hydra/Controller/Project.pm at line 101
sub submit : Chained('projectChain') PathPart Args(0) {sub edit : Chained('projectChain') PathPart Args(0) { - edit in src/lib/Hydra/Controller/Project.pm at line 104
requirePost($c); - edit in src/lib/Hydra/Controller/Project.pm at line 105[5.103]→[5.103:104](∅→∅),[5.104]→[7.230:291](∅→∅),[7.2217]→[7.230:291](∅→∅),[7.291]→[7.211:424](∅→∅),[7.424]→[7.292:344](∅→∅),[7.740]→[7.292:344](∅→∅),[7.344]→[7.785:791](∅→∅),[7.785]→[7.785:791](∅→∅)
if (($c->request->params->{submit} // "") eq "delete") {txn_do($c->model('DB')->schema, sub {$c->stash->{project}->jobsetevals->delete_all;$c->stash->{project}->builds->delete_all;$c->stash->{project}->delete;});return $c->res->redirect($c->uri_for("/"));} - replacement in src/lib/Hydra/Controller/Project.pm at line 106
project_PUT($self, $c);$c->stash->{template} = 'edit-project.tt';$c->stash->{edit} = 1; - edit in src/lib/Hydra/Controller/Project.pm at line 132[7.3096]→[2.40:93](∅→∅),[2.93]→[7.3148:3173](∅→∅),[7.3148]→[7.3148:3173](∅→∅),[7.2233]→[7.19953:19981](∅→∅),[7.19981]→[7.4769:4773](∅→∅),[7.3745]→[7.4769:4773](∅→∅)
sub create_submit : Path('/create-project/submit') {my ($self, $c) = @_;project_PUT($self, $c);} - replacement in src/lib/Hydra/Controller/Project.pm at line 164
error($c, "Invalid project name ‘$projectName’.") if $projectName !~ /^$projectNameRE$/;error($c, "Invalid project identifier ‘$projectName’.") if $projectName !~ /^$projectNameRE$/; - replacement in src/lib/Hydra/Controller/Project.pm at line 166
error($c, "Cannot rename project to ‘$projectName’ since that name is already taken.")error($c, "Cannot rename project to ‘$projectName’ since that identifier is already taken.") - replacement in src/root/edit-project.tt at line 4
<form class="form-horizontal" action="[% IF create %][% c.uri_for('/create-project/submit') %][% ELSE %][% c.uri_for('/project' project.name 'submit') %][% END %]" method="post"><form class="form-horizontal"> - replacement in src/root/edit-project.tt at line 57
<button type="submit" class="btn btn-primary"><button id="submit-project" type="submit" class="btn btn-primary"> - edit in src/root/edit-project.tt at line 60
</button>[% IF !create %]<button id="delete-project" type="submit" class="btn btn-danger" name="submit" value="delete"><i class="icon-trash icon-white"></i>Delete this project</button> - replacement in src/root/edit-project.tt at line 61
$("#delete-project").click(function() {return confirm("Are you sure you want to delete this project?");$("#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; - replacement in src/root/edit-project.tt at line 77
[% END %]</button> - replacement in src/root/project.tt at line 12
[% INCLUDE menuItem uri = c.uri_for('/project' project.name 'edit') title="Edit configuration" %]<li><a href="[% c.uri_for('/project' project.name 'edit') %]"><i class="icon-edit icon-black"></i> Edit configuration</a></li><li><a href="javascript:deleteProject()"><i class="icon-trash icon-black"></i> Delete this project</a></li> - edit in src/root/project.tt at line 98
<a class="btn pull-right" href="[% c.uri_for('/project' project.name "edit") %]"><i class="icon-edit"></i> Edit</a> - edit in src/root/project.tt at line 188
<script>function deleteProject() {bootbox.confirm('Are you sure you want to delete this project?',function(c) {if (!c) return;redirectJSON({url: "[% c.uri_for('/project' project.name) %]",type: 'DELETE'});});};</script> - edit in src/root/static/js/common.js at line 90
}var requestJSON = function(args) {args.dataType = 'json';args.error = function(data) {json = {};try {if (data.responseText)json = $.parseJSON(data.responseText);} catch (err) {}if (json.error)bootbox.alert(json.error);else if (data.responseText)bootbox.alert("Server error: " + data.responseText);elsebootbox.alert("Unknown server error!");};return $.ajax(args); - edit in src/root/static/js/common.js at line 110[3.644]
var redirectJSON = function(args) {args.success = function(data) {window.location = data.redirect;};return requestJSON(args);}