Implement DELETE for jobsets and use it in the web interface

[?]
Oct 3, 2013, 3:54 PM
4NTIBJ74F2QUMISJPB4DGM7VPYFVZDS6ZDITVIAQCSWO6C3UIQ6QC

Dependencies

  • [2] DAPOSS44 Use the REST API in the web interface for editing projects
  • [3] JIJDYWPY Remove the Build menu from the top bar
  • [4] M6UBWKN2 Fix project/jobset deletion
  • [5] JY7BXXOP Split viewing and editing a project
  • [6] 3PNG7NIB Remove trailing whitespace
  • [7] TFK74CQR Put job status on a separate tab
  • [8] VJFLX7B6 Fix rendering of jobset inputs
  • [9] UMFB2767 Hydra/64: Leaving number of builds empty gives DBIx error
  • [10] D7PL2VWU Move more actions from the top bar
  • [11] ODNCGFQ5 * Improved the navigation bar: don't include all projects (since that
  • [12] MJ4RWQ3T Add links to the project/jobset edit pages in the logical place
  • [13] OX6NYJDV Split viewing and editing a jobset
  • [14] ZRRPBEI4 Make jobset deletion consistent with project deletion
  • [15] BV7V5RGN Allow only project owners to delete projects / jobsets
  • [16] LZVO64YG Merge in the first bits of the API work
  • [17] 225GEK4N After editing a project/jobset, redirect back to the config tab
  • [18] OIBSCXGI Use a popover to show how to use the build reproduction script
  • [*] 3HZY24CX * Make jobsets viewable under
  • [*] IK53RV4V
  • [*] 7YBYT2LQ

Change contents

  • edit in src/lib/Hydra/Controller/Jobset.pm at line 3
    [20.141]
    [20.141]
    use utf8;
  • edit in src/lib/Hydra/Controller/Jobset.pm at line 139
    [3.10668]
    [3.10668]
    sub jobset_DELETE {
    my ($self, $c) = @_;
  • edit in src/lib/Hydra/Controller/Jobset.pm at line 142
    [3.10669]
    [3.10669]
    requireProjectOwner($c, $c->stash->{project});
    txn_do($c->model('DB')->schema, sub {
    $c->stash->{jobset}->jobsetevals->delete_all;
    $c->stash->{jobset}->builds->delete_all;
    $c->stash->{jobset}->delete;
    });
    my $uri = $c->uri_for($c->controller('Project')->action_for("project"), [$c->stash->{project}->name]);
    $self->status_ok($c, entity => { redirect => "$uri" });
    }
  • edit in src/lib/Hydra/Controller/Jobset.pm at line 225
    [3.51][3.0:62](),[3.861][3.0:62](),[3.62][3.0:210](),[3.210][3.10994:11121](),[3.11121][3.223:229](),[3.223][3.223:229]()
    if (($c->request->params->{submit} // "") eq "delete") {
    txn_do($c->model('DB')->schema, sub {
    $c->stash->{jobset}->jobsetevals->delete_all;
    $c->stash->{jobset}->builds->delete_all;
    $c->stash->{jobset}->delete;
    });
    return $c->res->redirect($c->uri_for($c->controller('Project')->action_for("project"), [$c->stash->{project}->name]));
    }
  • replacement in src/root/common.tt at line 455
    [3.2374][3.2374:2457]()
    <a href="[% uri %]" [% IF modal %]data-toggle="modal"[% END %]>[% title %]</a>
    [3.2374]
    [3.2457]
    <a href="[% uri %]" [% IF modal %]data-toggle="modal"[% END %]>
    [% IF icon %]<i class="[% icon %] icon-black"></i> [%+ END %]
    [% title %]
    </a>
  • edit in src/root/edit-jobset.tt at line 136
    [3.4659][3.345:779]()
    [% IF !create %]
    <button id="delete-jobset" type="submit" class="btn btn-danger" name="submit" value="delete">
    <i class="icon-trash icon-white"></i>
    Delete this jobset
    </button>
    <script type="text/javascript">
    $("#delete-jobset").click(function() {
    return confirm("Are you sure you want to delete this jobset?");
    });
    </script>
    [% END %]
  • replacement in src/root/jobset.tt at line 52
    [3.283][3.283:620]()
    [% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'edit') title="Edit configuration" %]
    [% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'clone') title="Clone this jobset" %]
    [% INCLUDE menuItem uri = "javascript:confirmEvaluateJobset()" title="Evaluate this jobset" %]
    [3.283]
    [3.620]
    [% INCLUDE menuItem title="Edit configuration" icon="icon-edit" uri=c.uri_for(c.controller('Jobset').action_for('edit'), [project.name, jobset.name]) %]
    [% INCLUDE menuItem title="Delete this jobset" icon="icon-trash" uri="javascript:deleteJobset()" %]
    [% INCLUDE menuItem title="Clone this jobset" uri=c.uri_for('/jobset' project.name jobset.name 'clone') %]
    [% INCLUDE menuItem title="Evaluate this jobset" uri="javascript:confirmEvaluateJobset()" %]
  • edit in src/root/jobset.tt at line 117
    [3.337][3.0:132](),[3.8848][3.0:132]()
    <a class="btn pull-right" href="[% c.uri_for('/jobset' project.name jobset.name "edit") %]"><i class="icon-edit"></i> Edit</a>
  • replacement in src/root/jobset.tt at line 169
    [3.834][3.834:1290]()
    $.post("[% HTML.escape(c.uri_for('/api/push', { jobsets = project.name _ ':' _ jobset.name, force = "1" })) %]")
    .done(function(data) {
    if (data.error)
    bootbox.alert("Unable to schedule the jobset for evaluation: " + data.error);
    else
    bootbox.alert("The jobset has been scheduled for evaluation.");
    })
    .fail(function() { bootbox.alert("Server request failed!"); });
    [3.834]
    [3.1290]
    requestJSON({
    url: "[% HTML.escape(c.uri_for('/api/push', { jobsets = project.name _ ':' _ jobset.name, force = "1" })) %]",
    success: function(data) {
    bootbox.alert("The jobset has been scheduled for evaluation.");
    }
    });
  • replacement in src/root/jobset.tt at line 176
    [3.1300][3.1300:1312]()
    return;
    [3.1300]
    [3.1312]
    };
    function deleteJobset() {
    bootbox.confirm(
    'Are you sure you want to delete this jobset?',
    function(c) {
    if (!c) return;
    redirectJSON({
    url: "[% c.uri_for(c.controller('Jobset').action_for('jobset'), [project.name, jobset.name]) %]",
    type: 'DELETE'
    });
    });
  • replacement in src/root/project.tt at line 12
    [3.1536][2.1738:1989](),[2.1989][3.1642:1896](),[3.1642][3.1642:1896]()
    <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>
    [% INCLUDE menuItem uri = c.uri_for(c.controller('Project').action_for('create_jobset'), [project.name]) title = "Create jobset" %]
    [% INCLUDE menuItem uri = c.uri_for('/project' project.name 'create-release') title = "Create release" %]
    [3.1536]
    [3.1896]
    [% INCLUDE menuItem title="Edit configuration" icon="icon-edit" uri=c.uri_for(c.controller('Project').action_for('edit'), [project.name]) %]
    [% INCLUDE menuItem title="Delete this project" icon="icon-trash" uri="javascript:deleteProject()" %]
    [% INCLUDE menuItem title="Create jobset" icon="icon-plus" uri=c.uri_for(c.controller('Project').action_for('create_jobset'), [project.name]) %]
    [% INCLUDE menuItem title="Create release" icon="icon-plus" uri=c.uri_for(c.controller('Project').action_for('create_release'), [project.name]) %]