forked from lix-project/hydra
Add a "My jobsets" tab to the dashboard
This commit is contained in:
parent
589271bd72
commit
ae85d2df23
|
@ -311,4 +311,20 @@ sub my_jobs_tab :Chained('user') :PathPart('my-jobs-tab') :Args(0) {
|
|||
}
|
||||
|
||||
|
||||
sub my_jobsets_tab :Chained('user') :PathPart('my-jobsets-tab') :Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{template} = 'dashboard-my-jobsets-tab.tt';
|
||||
|
||||
my $jobsets = $c->model('DB::Jobsets')->search(
|
||||
{ "project.enabled" => 1, "me.enabled" => 1,
|
||||
, owner => $c->stash->{user}->username
|
||||
},
|
||||
{ order_by => ["project", "name"]
|
||||
, join => ["project"]
|
||||
});
|
||||
|
||||
$c->stash->{jobsets} = [jobsetOverview_($c, $jobsets)];
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
|
|
@ -17,7 +17,8 @@ our @EXPORT = qw(
|
|||
getPrimaryBuildsForView
|
||||
getPrimaryBuildTotal
|
||||
getViewResult getLatestSuccessfulViewResult
|
||||
jobsetOverview removeAsciiEscapes getDrvLogPath findLog logContents
|
||||
jobsetOverview jobsetOverview_
|
||||
removeAsciiEscapes getDrvLogPath findLog logContents
|
||||
getMainOutput
|
||||
getEvals getMachines
|
||||
pathIsInsidePrefix
|
||||
|
@ -173,9 +174,9 @@ sub findLastJobForBuilds {
|
|||
}
|
||||
|
||||
|
||||
sub jobsetOverview {
|
||||
my ($c, $project) = @_;
|
||||
return $project->jobsets->search( isProjectOwner($c, $project) ? {} : { hidden => 0 },
|
||||
sub jobsetOverview_ {
|
||||
my ($c, $jobsets) = @_;
|
||||
return $jobsets->search({},
|
||||
{ order_by => "name"
|
||||
, "+select" =>
|
||||
[ "(select count(*) from Builds as a where a.finished = 0 and me.project = a.project and me.name = a.jobset and a.isCurrent = 1)"
|
||||
|
@ -188,6 +189,13 @@ sub jobsetOverview {
|
|||
}
|
||||
|
||||
|
||||
sub jobsetOverview {
|
||||
my ($c, $project) = @_;
|
||||
my $jobsets = $project->jobsets->search(isProjectOwner($c, $project) ? {} : { hidden => 0 });
|
||||
return jobsetOverview_($c, $jobsets);
|
||||
}
|
||||
|
||||
|
||||
sub getViewResult {
|
||||
my ($primaryBuild, $jobs, $finished) = @_;
|
||||
|
||||
|
|
|
@ -464,4 +464,65 @@ BLOCK makeStar %]
|
|||
<span class="star" data-post="[% starUri %]">[% IF starred; "★"; ELSE; "☆"; END %]</span>
|
||||
[% END;
|
||||
|
||||
|
||||
BLOCK renderJobsetOverview %]
|
||||
<table class="table table-striped table-condensed clickable-rows">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Last evaluated</th>
|
||||
<th colspan="2">Success</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH j IN jobsets %]
|
||||
[% successrate = 0 %]
|
||||
<tr>
|
||||
<td>
|
||||
[% IF j.get_column('nrscheduled') > 0 %]
|
||||
<img src="[% c.uri_for("/static/images/help_16.png") %]" alt="Scheduled" />
|
||||
[% ELSIF j.get_column('nrfailed') == 0 %]
|
||||
<img src="[% c.uri_for("/static/images/checkmark_16.png") %]" alt="Succeeded" />
|
||||
[% ELSIF j.get_column('nrfailed') > 0 && j.get_column('nrsucceeded') > 0 %]
|
||||
<img src="[% c.uri_for("/static/images/error_some_16.png") %]" alt="Some Failed" />
|
||||
[% ELSE %]
|
||||
<img src="[% c.uri_for("/static/images/error_16.png") %]" alt="All Failed" />
|
||||
[% END %]
|
||||
</td>
|
||||
<td><span class="[% IF !j.enabled %]disabled-jobset[% END %] [%+ IF j.hidden %]hidden-jobset[% END %]">[% IF showProject; INCLUDE renderFullJobsetName project=j.get_column('project') jobset=j.name inRow=1; ELSE; INCLUDE renderJobsetName project=j.get_column('project') jobset=j.name inRow=1; END %]</span></td>
|
||||
<td>[% HTML.escape(j.description) %]</td>
|
||||
<td>[% IF j.lastcheckedtime; INCLUDE renderDateTime timestamp = j.lastcheckedtime; ELSE; "-"; END %]</td>
|
||||
[% IF j.get_column('nrtotal') > 0 %]
|
||||
[% successrate = ( j.get_column('nrsucceeded') / j.get_column('nrtotal') )*100 %]
|
||||
[% IF j.get_column('nrscheduled') > 0 %]
|
||||
[% class = 'label' %]
|
||||
[% ELSIF successrate < 25 %]
|
||||
[% class = 'label label-important' %]
|
||||
[% ELSIF successrate < 75 %]
|
||||
[% class = 'label label-warning' %]
|
||||
[% ELSIF successrate <= 100 %]
|
||||
[% class = 'label label-success' %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
<td><span class="[% class %]">[% successrate FILTER format('%d') %]%</span></td>
|
||||
<td>
|
||||
[% IF j.get_column('nrsucceeded') > 0 %]
|
||||
<span class="label label-success">[% j.get_column('nrsucceeded') %]</span>
|
||||
[% END %]
|
||||
[% IF j.get_column('nrfailed') > 0 %]
|
||||
<span class="label label-important">[% j.get_column('nrfailed') %]</span>
|
||||
[% END %]
|
||||
[% IF j.get_column('nrscheduled') > 0 %]
|
||||
<span class="label label">[% j.get_column('nrscheduled') %]</span>
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
[% END;
|
||||
|
||||
|
||||
%]
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<p>Below are the most recent builds of the [% builds.size %] jobs of which you
|
||||
(<tt>[% HTML.escape(user.emailaddress) %]</tt>) are a maintainer.</p>
|
||||
|
||||
|
||||
[% INCLUDE renderBuildList %]
|
||||
|
||||
[% END %]
|
||||
|
|
12
src/root/dashboard-my-jobsets-tab.tt
Normal file
12
src/root/dashboard-my-jobsets-tab.tt
Normal file
|
@ -0,0 +1,12 @@
|
|||
[% PROCESS common.tt %]
|
||||
|
||||
[% IF builds.size == 0 %]
|
||||
|
||||
<div class="alert alert-warning">You are not the owner of any
|
||||
jobset.</div>
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
[% INCLUDE renderJobsetOverview showProject=1 %]
|
||||
|
||||
[% END %]
|
|
@ -4,6 +4,7 @@
|
|||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#tabs-starred-jobs" data-toggle="tab">Starred jobs</a></li>
|
||||
<li><a href="#tabs-my-jobs" data-toggle="tab">My jobs</a></li>
|
||||
<li><a href="#tabs-my-jobsets" data-toggle="tab">My jobsets</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="generic-tabs" class="tab-content">
|
||||
|
@ -41,6 +42,7 @@
|
|||
</div>
|
||||
|
||||
[% INCLUDE makeLazyTab tabName="tabs-my-jobs" uri=c.uri_for(c.controller('User').action_for('my_jobs_tab'), [user.username]) %]
|
||||
[% INCLUDE makeLazyTab tabName="tabs-my-jobsets" uri=c.uri_for(c.controller('User').action_for('my_jobsets_tab'), [user.username]) %]
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -30,64 +30,7 @@
|
|||
<div id="tabs-project" class="tab-pane active">
|
||||
[% IF project.jobsets %]
|
||||
<p>This project has the following jobsets:</p>
|
||||
|
||||
<table class="table table-striped table-condensed clickable-rows">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Id</th>
|
||||
<th>Description</th>
|
||||
<th>Last evaluated</th>
|
||||
<th colspan="2">Success</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH j IN jobsets %]
|
||||
[% successrate = 0 %]
|
||||
<tr>
|
||||
<td>
|
||||
[% IF j.get_column('nrscheduled') > 0 %]
|
||||
<img src="[% c.uri_for("/static/images/help_16.png") %]" alt="Scheduled" />
|
||||
[% ELSIF j.get_column('nrfailed') == 0 %]
|
||||
<img src="[% c.uri_for("/static/images/checkmark_16.png") %]" alt="Succeeded" />
|
||||
[% ELSIF j.get_column('nrfailed') > 0 && j.get_column('nrsucceeded') > 0 %]
|
||||
<img src="[% c.uri_for("/static/images/error_some_16.png") %]" alt="Some Failed" />
|
||||
[% ELSE %]
|
||||
<img src="[% c.uri_for("/static/images/error_16.png") %]" alt="All Failed" />
|
||||
[% END %]
|
||||
</td>
|
||||
<td><span class="[% IF !j.enabled %]disabled-jobset[% END %] [%+ IF j.hidden %]hidden-jobset[% END %]">[% INCLUDE renderJobsetName project=project.name jobset=j.name inRow=1 %]</span></td>
|
||||
<td>[% HTML.escape(j.description) %]</td>
|
||||
<td>[% IF j.lastcheckedtime; INCLUDE renderDateTime timestamp = j.lastcheckedtime; ELSE; "-"; END %]</td>
|
||||
[% IF j.get_column('nrtotal') > 0 %]
|
||||
[% successrate = ( j.get_column('nrsucceeded') / j.get_column('nrtotal') )*100 %]
|
||||
[% IF j.get_column('nrscheduled') > 0 %]
|
||||
[% class = 'label' %]
|
||||
[% ELSIF successrate < 25 %]
|
||||
[% class = 'label label-important' %]
|
||||
[% ELSIF successrate < 75 %]
|
||||
[% class = 'label label-warning' %]
|
||||
[% ELSIF successrate <= 100 %]
|
||||
[% class = 'label label-success' %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
<td><span class="[% class %]">[% successrate FILTER format('%d') %]%</span></td>
|
||||
<td>
|
||||
[% IF j.get_column('nrsucceeded') > 0 %]
|
||||
<span class="label label-success">[% j.get_column('nrsucceeded') %]</span>
|
||||
[% END %]
|
||||
[% IF j.get_column('nrfailed') > 0 %]
|
||||
<span class="label label-important">[% j.get_column('nrfailed') %]</span>
|
||||
[% END %]
|
||||
[% IF j.get_column('nrscheduled') > 0 %]
|
||||
<span class="label label">[% j.get_column('nrscheduled') %]</span>
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
[% INCLUDE renderJobsetOverview %]
|
||||
[% ELSE %]
|
||||
<p>No jobsets have been defined yet.</p>
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in a new issue