Merge in the first bits of the API work

The catalyst-action-rest branch from shlevy/hydra was an exploration of
using Catalyst::Action::REST to create a JSON API for hydra. This commit
merges in the best bits from that experiment, with the goal that further
API endpoints can be added incrementally.

In addition to migrating more endpoints, there is potential for
improvement in what's already been done:
* The web interface can be updated to use the same non-GET endpoints as
  the JSON interface (using x-tunneled-method) instead of having a
  separate endpoint
* The web rendering should use the $c->stash->{resource} data structure
  where applicable rather than putting the same data in two places in
  the stash
* Which columns to render for each endpoint is a completely debatable
  question
* Hydra::Component::ToJSON should turn has_many relations that have
  strings as their primary keys into objects instead of arrays

Fixes NixOS/hydra#98

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy
2013-06-17 12:34:21 -04:00
parent d18fc4fc38
commit 002ac9ef63
52 changed files with 1163 additions and 272 deletions

View File

@ -7,7 +7,7 @@
[% ELSE %]
[% INCLUDE renderBuildList builds=queue showSchedulingInfo=1 hideResultInfo=1 %]
[% INCLUDE renderBuildList builds=resource showSchedulingInfo=1 hideResultInfo=1 %]
[% END %]

View File

@ -6,7 +6,7 @@
<tr><th>Machine</th><th>Job</th><th>Type</th><th>Build</th><th>Step</th><th>What</th><th>Since</th></tr>
</thead>
<tbody>
[% FOREACH step IN steps %]
[% FOREACH step IN resource %]
<tr>
<td><tt>[% IF step.machine; step.machine.match('@(.*)').0; ELSE; 'localhost'; END %]</tt></td>
<td><tt>[% INCLUDE renderFullJobName project = step.build.project.name jobset = step.build.jobset.name job = step.build.job.name %]</tt></td>

View File

@ -37,7 +37,7 @@
[% WRAPPER makeSubMenu title="Project" %]
<li class="nav-header">[% HTML.escape(project.name) %]</li>
<li class="divider"></li>
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('view'), [project.name]) title = "Overview" %]
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('project'), [project.name]) title = "Overview" %]
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('all'), [project.name]) title = "Latest builds" %]
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('jobstatus'), [project.name]) title = "Job status" %]
[% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('errors'), [project.name]) title = "Errors" %]
@ -56,7 +56,7 @@
<li class="nav-header">[% HTML.escape(jobset.name) %]</li>
<li class="divider"></li>
[% INCLUDE menuItem
uri = c.uri_for(c.controller('Jobset').action_for('index'), [project.name, jobset.name])
uri = c.uri_for(c.controller('Jobset').action_for('jobset'), [project.name, jobset.name])
title = "Overview" %]
[% INCLUDE menuItem
uri = c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name])