Add a dashboard

[?]
Oct 14, 2013, 6:07 PM
KSBB33RE2PK5SFN7ZMOTZJQHZB4JYIIUUKWDSD3LSZ5GD465AJHQC

Dependencies

  • [2] N4ODPYP7 Job page: Remove channel tab
  • [3] FTPCV25M Store aggregate members in the database
  • [4] SS4TZXNU Distinguish between permanent evaluation errors and transient input errors
  • [5] JATC3WQY Make actions dropdown easier to find by making the dropdown title bold
  • [6] C3AG65SW Add one-shot jobsets
  • [7] 7ZQAHJQM Fix indentation
  • [8] YTIDBFGU Drop unused "disabled" columns
  • [9] PCKLFRT5 Support push notification of repository changes
  • [10] GEADFVZ5 hydra-queue-runner: Improved scheduling
  • [11] S6OISBQ3 * Mark the "current" builds in a jobset, i.e. those corresponding to
  • [12] E7M2WP7A Remove unused Jobs columns
  • [13] ODNCGFQ5 * Improved the navigation bar: don't include all projects (since that
  • [14] JTRG7RDQ add support for git as jobinput
  • [15] SB2V735V Keep track of the database schema version
  • [16] QLOLZHRX Allow a per-jobset check interval
  • [17] LZVO64YG Merge in the first bits of the API work
  • [18] EVYSAFB2 Transpose the aggregate constituents table
  • [19] S5GCSCNS Update bootstrap to 2.3.1
  • [20] RBNQKATL * Adding persistant releases. A release is a named set of builds.
  • [21] X27GNHDV * Basic job info in the database.
  • [22] FGQPXZIX hydra: make nr of build to keep configurable per jobset
  • [23] RFE6T5LG * Store jobset evaluations in the database explicitly. This includes
  • [24] KN3VYE5P * Cleaned up the foreign key constraints.
  • [25] JM3DPYOM generated schema with new dbix class schema loader, grrrrrr
  • [26] 4D4U5IPY * Allow jobsets to be disabled.
  • [27] ZWCTAZGL added newsitems, added some admin options to clear various caches.
  • [28] S5PV6IIM * Represent jobs explicitly in the DB.
  • [29] OEPUOUNB Using twitter bootstrap for more consistent looks for Hydra
  • [30] Y6AHH4TH Remove the logfile and logSize columns from the database
  • [31] AHTEIK7G * Added a maintainers field to the Builds table.
  • [32] P5X4P6VK * Renaming "release sets" to "views" (not finished yet). Having
  • [33] PZL3SZM3 Give every page a consistent title
  • [34] QTFVCDIF added hide feature for project/jobset
  • [35] 3HCBU2FA
  • [*] DEMSSSB2 * Controller for jobs which inherits all actions in ListBuilds. So
  • [*] CQQSJLON On aggregate job pages, show a matrix showing all the constituent builds
  • [*] UWVMQIAC * Refactoring.
  • [*] XJRJ4J7M Add user registration
  • [*] D5QIOJGP * Move everything up one directory.
  • [*] S66BOMVU * Added authentication.
  • [*] IK53RV4V
  • [*] JIJDYWPY Remove the Build menu from the top bar
  • [*] OIBSCXGI Use a popover to show how to use the build reproduction script
  • [*] QCGCX2BR Generalize lazy tabs
  • [*] J5UVLXOK * Start of a basic Catalyst web interface.
  • [*] 2P7VNAAC Move common Javascript code into a separate file
  • [*] QL55ECJ6 - adapted ui for hydra, more in line with nixos.org website
  • [*] 2G63HKCH Fix some wellformedness issues
  • [*] JZVRK5QJ Group some menu items together under a "Status" menu
  • [*] N22GPKYT * Put info about logs / build products in the DB.
  • [*] FANTYCR7 Materialize the number of finished builds

Change contents

  • edit in src/lib/Hydra/Controller/Job.pm at line 63
    [38.969]
    [37.544]
    $c->stash->{starred} = $c->user->starredjobs(
    { project => $c->stash->{project}->name
    , jobset => $c->stash->{jobset}->name
    , job => $c->stash->{job}->name
    })->count == 1 if $c->user_exists;
  • edit in src/lib/Hydra/Controller/Job.pm at line 80
    [39.521]
    [37.902]
    }
    sub star : Chained('job') PathPart('star') Args(0) {
    my ($self, $c) = @_;
    requirePost($c);
    requireUser($c);
    my $args =
    { project => $c->stash->{project}->name
    , jobset => $c->stash->{jobset}->name
    , job => $c->stash->{job}->name
    };
    if ($c->request->params->{star} eq "1") {
    $c->user->starredjobs->update_or_create($args);
    } else {
    $c->user->starredjobs->find($args)->delete;
    }
    $c->stash->{resource}->{success} = 1;
  • edit in src/lib/Hydra/Controller/User.pm at line 270
    [40.3415]
    [40.3415]
  • edit in src/lib/Hydra/Controller/User.pm at line 272
    [40.3416]
    [40.3416]
    sub dashboard :Chained('user') :Args(0) {
    my ($self, $c) = @_;
    $c->stash->{template} = 'dashboard.tt';
  • edit in src/lib/Hydra/Controller/User.pm at line 276
    [40.3417]
    [40.3417]
    # Get the N most recent builds for each starred job.
    $c->stash->{starredJobs} = [];
    foreach my $j ($c->stash->{user}->starredjobs->search({}, { order_by => ['project', 'jobset', 'job'] })) {
    my @builds = $j->job->builds->search(
    { },
    { rows => 20, order_by => "id desc" });
    push $c->stash->{starredJobs}, { job => $j->job, builds => [@builds] };
    }
    }
  • edit in src/lib/Hydra/Schema/Jobs.pm at line 139
    [7.3830]
    [7.2611]
    =head2 starredjobs
    Type: has_many
    Related object: L<Hydra::Schema::StarredJobs>
  • edit in src/lib/Hydra/Schema/Jobs.pm at line 146
    [7.2612]
    [7.2612]
    =cut
  • replacement in src/lib/Hydra/Schema/Jobs.pm at line 148
    [7.2613][7.30150:30292]()
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:t2CCfUjFEz/lO4szROz1AQ
    [7.2613]
    [7.2756]
    __PACKAGE__->has_many(
    "starredjobs",
    "Hydra::Schema::StarredJobs",
    {
    "foreign.job" => "self.name",
    "foreign.jobset" => "self.jobset",
    "foreign.project" => "self.project",
    },
    undef,
    );
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uYKWjewvKBEAuK53u7vKuw
  • edit in src/lib/Hydra/Schema/Jobsets.pm at line 288
    [7.6041]
    [7.22483]
    =head2 starredjobs
    Type: has_many
  • edit in src/lib/Hydra/Schema/Jobsets.pm at line 293
    [7.22484]
    [7.3135]
    Related object: L<Hydra::Schema::StarredJobs>
  • replacement in src/lib/Hydra/Schema/Jobsets.pm at line 295
    [7.3136][4.214:356]()
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-09-25 14:10:28
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cAZ4+c7OhqGW8ATru8Foiw
    [7.3136]
    [7.22627]
    =cut
    __PACKAGE__->has_many(
    "starredjobs",
    "Hydra::Schema::StarredJobs",
    {
    "foreign.jobset" => "self.name",
    "foreign.project" => "self.project",
    },
    undef,
    );
  • edit in src/lib/Hydra/Schema/Jobsets.pm at line 307
    [7.22628]
    [7.3226]
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DTAGxP5RFvcNxP/ciJGo4Q
  • edit in src/lib/Hydra/Schema/Projects.pm at line 228
    [7.2375]
    [7.21130]
    =head2 starredjobs
    Type: has_many
    Related object: L<Hydra::Schema::StarredJobs>
  • edit in src/lib/Hydra/Schema/Projects.pm at line 235
    [7.21131]
    [7.25357]
    =cut
    __PACKAGE__->has_many(
    "starredjobs",
    "Hydra::Schema::StarredJobs",
    { "foreign.project" => "self.name" },
    undef,
    );
  • replacement in src/lib/Hydra/Schema/Projects.pm at line 285
    [7.7308][7.32751:32893]()
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RffghAo9jAaqYk41y1Sdqw
    [7.7308]
    [7.4514]
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PdNQ2mf5azBB6nI+iAm8fQ
  • file addition: StarredJobs.pm (----------)
    [41.477]
    use utf8;
    package Hydra::Schema::StarredJobs;
    # Created by DBIx::Class::Schema::Loader
    # DO NOT MODIFY THE FIRST PART OF THIS FILE
    =head1 NAME
    Hydra::Schema::StarredJobs
    =cut
    use strict;
    use warnings;
    use base 'DBIx::Class::Core';
    =head1 COMPONENTS LOADED
    =over 4
    =item * L<Hydra::Component::ToJSON>
    =back
    =cut
    __PACKAGE__->load_components("+Hydra::Component::ToJSON");
    =head1 TABLE: C<StarredJobs>
    =cut
    __PACKAGE__->table("StarredJobs");
    =head1 ACCESSORS
    =head2 username
    data_type: 'text'
    is_foreign_key: 1
    is_nullable: 0
    =head2 project
    data_type: 'text'
    is_foreign_key: 1
    is_nullable: 0
    =head2 jobset
    data_type: 'text'
    is_foreign_key: 1
    is_nullable: 0
    =head2 job
    data_type: 'text'
    is_foreign_key: 1
    is_nullable: 0
    =cut
    __PACKAGE__->add_columns(
    "username",
    { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
    "project",
    { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
    "jobset",
    { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
    "job",
    { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
    );
    =head1 PRIMARY KEY
    =over 4
    =item * L</username>
    =item * L</project>
    =item * L</jobset>
    =item * L</job>
    =back
    =cut
    __PACKAGE__->set_primary_key("username", "project", "jobset", "job");
    =head1 RELATIONS
    =head2 job
    Type: belongs_to
    Related object: L<Hydra::Schema::Jobs>
    =cut
    __PACKAGE__->belongs_to(
    "job",
    "Hydra::Schema::Jobs",
    { jobset => "jobset", name => "job", project => "project" },
    { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
    );
    =head2 jobset
    Type: belongs_to
    Related object: L<Hydra::Schema::Jobsets>
    =cut
    __PACKAGE__->belongs_to(
    "jobset",
    "Hydra::Schema::Jobsets",
    { name => "jobset", project => "project" },
    { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
    );
    =head2 project
    Type: belongs_to
    Related object: L<Hydra::Schema::Projects>
    =cut
    __PACKAGE__->belongs_to(
    "project",
    "Hydra::Schema::Projects",
    { name => "project" },
    { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
    );
    =head2 username
    Type: belongs_to
    Related object: L<Hydra::Schema::Users>
    =cut
    __PACKAGE__->belongs_to(
    "username",
    "Hydra::Schema::Users",
    { username => "username" },
    { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
    );
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:naj5aKWuw8hLE6klmvW9Eg
    # You can replace this text with custom code or comments, and it will be preserved on regeneration
    1;
  • edit in src/lib/Hydra/Schema/Users.pm at line 137
    [7.7219]
    [7.7219]
    =head2 starredjobs
    Type: has_many
    Related object: L<Hydra::Schema::StarredJobs>
  • edit in src/lib/Hydra/Schema/Users.pm at line 144
    [7.7220]
    [7.30336]
    =cut
    __PACKAGE__->has_many(
    "starredjobs",
    "Hydra::Schema::StarredJobs",
    { "foreign.username" => "self.username" },
    undef,
    );
  • replacement in src/lib/Hydra/Schema/Users.pm at line 179
    [7.8787][7.34774:34916]()
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hy3MKvFxfL+1bTc7Hcb1zA
    [7.8787]
    [7.7363]
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Hv9Ukqud0d3uIUot0ErKeg
  • edit in src/root/common.tt at line 461
    [44.2473]
    [45.1165]
  • edit in src/root/common.tt at line 463
    [45.1166]
    [46.679]
    BLOCK makeStar %]
    <span class="star" data-post="[% starUri %]">[% IF starred; "★"; ELSE; "☆"; END %]</span>
    [% END;
  • file addition: dashboard.tt (----------)
    [41.1486]
    [% WRAPPER layout.tt title="Dashboard" %]
    [% PROCESS common.tt %]
    <ul class="nav nav-tabs">
    <li class="active"><a href="#tabs-starred-jobs" data-toggle="tab">Starred jobs</a></li>
    </ul>
    <div id="generic-tabs" class="tab-content">
    <div id="tabs-starred-jobs" class="tab-pane active">
    [% IF starredJobs.size > 0 %]
    <p>Below are the 20 most recent builds of your starred jobs.</p>
    <table class="table table-striped table-condensed">
    <thead>
    <tr><th>Job</th></tr>
    </thead>
    <tdata>
    [% FOREACH j IN starredJobs %]
    <tr>
    <td>[% INCLUDE renderFullJobName project=j.job.get_column('project') jobset=j.job.get_column('jobset') job=j.job.name %]</td>
    [% FOREACH b IN j.builds %]
    <td><a href="[% c.uri_for('/build' b.id) %]">[% INCLUDE renderBuildStatusIcon size=16 build=b %]</a></td>
    [% END %]
    </tr>
    [% END %]
    </tdata>
    </table>
    [% ELSE %]
    <div class="alert alert-warning">You have no starred jobs. You can add them by visiting a job page and clicking on the ☆ icon.</div>
    [% END %]
    </div>
    </div>
    [% END %]
  • replacement in src/root/job.tt at line 1
    [7.7675][2.0:73]()
    [% WRAPPER layout.tt title="Job $project.name:$jobset.name:$job.name" %]
    [7.7675]
    [7.7755]
    [% WRAPPER layout.tt
    title="Job $project.name:$jobset.name:$job.name"
    starUri=c.uri_for(c.controller('Job').action_for('star'), c.req.captures)
    %]
  • replacement in src/root/layout.tt at line 85
    [7.3204][7.3204:3263]()
    <h1><small>[% HTML.escape(title) %]</small></h1>
    [7.3204]
    [7.3263]
    <h1><small>[% IF c.user_exists && starUri; INCLUDE makeStar; " "; END; HTML.escape(title) %]</small></h1>
  • replacement in src/root/static/css/hydra.css at line 100
    [5.87][5.87:107]()
    font-weight:bold;
    [5.87]
    [7.296]
    font-weight: bold;
    }
    .star {
    color: black;
    font-size: 110%;
  • edit in src/root/static/css/hydra.css at line 107
    [7.298]
    .star:hover {
    cursor: pointer;
    }
  • edit in src/root/static/js/common.js at line 83
    [6.1482]
    [48.2151]
    $(".star").click(function(event) {
    var star = $(this);
    var active = star.text() != '★';
    requestJSON({
    url: star.attr("data-post"),
    data: active ? "star=1" : "star=0",
    type: 'POST',
    success: function(res) {
    if (active) {
    star.text('★');
    } else {
    star.text('☆');
    }
    }
    });
    });
  • edit in src/root/topbar.tt at line 11
    [50.4142]
    [51.0]
    [% IF c.user_exists %]
    [% INCLUDE menuItem uri = c.uri_for(c.controller('User').action_for('dashboard'), [c.user.username]) title = "Dashboard" %]
    [% END %]
  • edit in src/sql/hydra.sql at line 535
    [3.6000]
    [53.1368]
    create table StarredJobs (
    userName text not null,
    project text not null,
    jobset text not null,
    job text not null,
    primary key (userName, project, jobset, job),
    foreign key (userName) references Users(userName) on update cascade on delete cascade,
    foreign key (project) references Projects(name) on update cascade on delete cascade,
    foreign key (project, jobset) references Jobsets(project, name) on update cascade on delete cascade,
    foreign key (project, jobset, job) references Jobs(project, jobset, name) on update cascade on delete cascade
    );
  • file addition: upgrade-23.sql (----------)
    [41.3004]
    create table StarredJobs (
    userName text not null,
    project text not null,
    jobset text not null,
    job text not null,
    primary key (userName, project, jobset, job),
    foreign key (userName) references Users(userName) on update cascade on delete cascade,
    foreign key (project) references Projects(name) on update cascade on delete cascade,
    foreign key (project, jobset) references Jobsets(project, name) on update cascade on delete cascade,
    foreign key (project, jobset, job) references Jobs(project, jobset, name) on update cascade on delete cascade
    );