On aggregate job pages, show a matrix showing all the constituent builds

[?]
Aug 26, 2013, 4:58 PM
CQQSJLONTAKIWT4AEEDZFLFAFCSIPEGWLBJDJIS7VJK6FJ3LZ2RAC

Dependencies

  • [2] 5GRW5XU4 Job page: Put latest builds on top
  • [3] R6B5CAFF Let Builds.timestamp refer to the time the build was added
  • [4] 2QISRMJK Job page: show queued as well as running builds
  • [5] 777XFGVY Hydra/22: on job page, 'finished builds' shows nothing for old (non-current) jobs
  • [6] MOX7XJ2E Merge the BuildSchedulingInfo table into the Builds table
  • [7] CQTN62OH Die tabs die
  • [8] 3PNG7NIB Remove trailing whitespace
  • [*] DEMSSSB2 * Controller for jobs which inherits all actions in ListBuilds. So
  • [*] ODNCGFQ5 * Improved the navigation bar: don't include all projects (since that
  • [*] WGUKOIQZ Fix indentation

Change contents

  • edit in src/lib/Hydra/Controller/Job.pm at line 23
    [11.80]
    [10.429]
    my $job = $c->stash->{job};
  • replacement in src/lib/Hydra/Controller/Job.pm at line 28
    [4.1827][4.1827:1889]()
    [ $c->stash->{job}->builds->search({ finished => 1 },
    [4.1827]
    [3.832]
    [ $job->builds->search({ finished => 1 },
  • replacement in src/lib/Hydra/Controller/Job.pm at line 32
    [4.34][4.1888:1930](),[4.1680][4.1888:1930]()
    $c->stash->{job}->builds->search(
    [4.34]
    [4.35]
    $job->builds->search(
  • edit in src/lib/Hydra/Controller/Job.pm at line 40
    [4.2115]
    [10.544]
    # If this is an aggregate job, then get its constituents.
    my @constituents = $c->model('DB::Builds')->search(
    { aggregate => { -in => $job->builds->search({}, { columns => ["id"], order_by => "id desc", rows => 10 })->as_query } },
    { join => 'aggregateconstituents_constituents',
    columns => ['id', 'job', 'finished', 'buildstatus'],
    +select => ['aggregateconstituents_constituents.aggregate'],
    +as => ['aggregate']
    });
    my $aggregates = {};
    my %constituentJobs;
    foreach my $b (@constituents) {
    my $jobName = $b->get_column('job');
    $aggregates->{$b->get_column('aggregate')}->{$jobName} =
    { id => $b->id, finished => $b->finished, buildstatus => $b->buildstatus};
    $constituentJobs{$jobName} = 1;
    }
    $c->stash->{aggregates} = $aggregates;
    $c->stash->{constituentJobs} = [sort (keys %constituentJobs)];
  • edit in src/root/job.tt at line 7
    [12.105]
    [2.226]
    [% IF constituentJobs.size > 0 %]
    <li><a href="#tabs-constituents" data-toggle="tab">Constituents</a></li>
    [% END %]
  • edit in src/root/job.tt at line 26
    [12.816]
    [12.816]
    [% IF constituentJobs.size > 0 %]
    <div id="tabs-constituents" class="tab-pane">
    <table class="table table-striped table-condensed">
    <thead>
    <tr>
    <th>#</th>
    [% FOREACH j IN constituentJobs %]
    <th>[% HTML.escape(j) %]</th>
    [% END %]
    </tr>
    </thead>
    <tbody>
    [% FOREACH agg IN aggregates.keys.nsort.reverse %]
    <tr>
    <td><a class="row-link" href="[% c.uri_for('/build' agg) %]">[% agg %]</a></td>
    [% FOREACH j IN constituentJobs %]
    <td>
    [% r = aggregates.$agg.$j; IF r.id %]
    <a href="[% c.uri_for('/build' r.id) %]">
    [% INCLUDE renderBuildStatusIcon size=16 build=r %]
    </a>
    [% END %]
    </td>
    [% END %]
    </tr>
    [% END %]
    </tbody>
    </table>
    <hr/>
    <table class="table table-striped table-condensed">
    <thead>
    <tr>
    <th>#</th>
    [% FOREACH j IN constituentJobs %]
    <th>[% HTML.escape(j) %]</th>
    [% END %]
    </tr>
    </thead>
    <tbody>
    [% FOREACH agg IN aggregates.keys.nsort.reverse %]
    <tr>
    <td><a class="row-link" href="[% c.uri_for('/build' agg) %]">[% agg %]</a></td>
    [% FOREACH j IN constituentJobs %]
    <td>
    [% r = aggregates.$agg.$j; IF r.id %]
    <a href="[% c.uri_for('/build' r.id) %]">
    [% INCLUDE renderBuildStatusIcon size=16 build=r %]
    </a>
    [% END %]
    </td>
    [% END %]
    </tr>
    [% END %]
    </tbody>
    </table>
    </div>
    [% END %]