Hide hidden jobsets for project admins by default

This unclutters project pages.

Fixes #390.
This commit is contained in:
Eelco Dolstra 2016-10-27 16:46:20 +02:00
parent 3c8f00c76f
commit a2be29377e
5 changed files with 34 additions and 4 deletions

View file

@ -14,6 +14,8 @@ sub projectChain :Chained('/') :PathPart('project') :CaptureArgs(1) {
$c->stash->{project} = $c->model('DB::Projects')->find($projectName); $c->stash->{project} = $c->model('DB::Projects')->find($projectName);
$c->stash->{isProjectOwner} = isProjectOwner($c, $c->stash->{project});
notFound($c, "Project $projectName doesn't exist.") notFound($c, "Project $projectName doesn't exist.")
if !$c->stash->{project} && !($c->action->name eq "project" and $c->request->method eq "PUT"); if !$c->stash->{project} && !($c->action->name eq "project" and $c->request->method eq "PUT");
} }

View file

@ -511,7 +511,7 @@ BLOCK renderJobsetOverview %]
<tbody> <tbody>
[% FOREACH j IN jobsets %] [% FOREACH j IN jobsets %]
[% successrate = 0 %] [% successrate = 0 %]
<tr> <tr class="[% IF j.hidden && !showHidden %] hidden-jobset [% END %] [% IF !j.enabled %] disabled-jobset [% END %]" >
<td> <td>
[% IF j.get_column('nrscheduled') > 0 %] [% IF j.get_column('nrscheduled') > 0 %]
<img src="[% c.uri_for("/static/images/help_16.png") %]" alt="Scheduled" /> <img src="[% c.uri_for("/static/images/help_16.png") %]" alt="Scheduled" />

View file

@ -7,6 +7,6 @@
[% ELSE %] [% ELSE %]
[% INCLUDE renderJobsetOverview showProject=1 %] [% INCLUDE renderJobsetOverview showProject=1 showHidden=1 %]
[% END %] [% END %]

View file

@ -26,14 +26,38 @@
<div class="tab-content"> <div class="tab-content">
<script type="text/javascript">
$(document).ready(function() {
$('#show-hidden').on('click', function (e) {
var show = !$(this).hasClass('active');
if (show)
$('tr.hidden-jobset').show();
else
$('tr.hidden-jobset').hide();
});
$('#show-disabled').on('click', function (e) {
var show = !$(this).hasClass('active');
if (show)
$('tr.disabled-jobset').show();
else
$('tr.disabled-jobset').hide();
});
});
</script>
<div id="tabs-project" class="tab-pane active"> <div id="tabs-project" class="tab-pane active">
[% IF project.jobsets %] [% IF project.jobsets %]
<p>This project has the following jobsets:</p> <p>This project has the following jobsets:
<button id="show-disabled" type="button" class="btn btn-small pull-right active" data-toggle="button">Show disabled jobsets</button>
[% IF isProjectOwner %]
<button id="show-hidden" type="button" class="btn btn-small pull-right" data-toggle="button">Show hidden jobsets</button>
[% END %]
</p>
[% INCLUDE renderJobsetOverview %] [% INCLUDE renderJobsetOverview %]
[% ELSE %] [% ELSE %]
<p>No jobsets have been defined yet.</p> <p>No jobsets have been defined yet.</p>
[% END %] [% END %]
</div> </div>
<div id="tabs-configuration" class="tab-pane"> <div id="tabs-configuration" class="tab-pane">

View file

@ -47,6 +47,10 @@ span.hidden-project a, span.hidden-jobset a {
color: gray; color: gray;
} }
tr.hidden-jobset {
display: none;
}
table.info-table th { table.info-table th {
padding-right: 1.0em; padding-right: 1.0em;
padding-bottom: 0.2em; padding-bottom: 0.2em;