launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22064
[Merge] lp:~wgrant/launchpad/buildqueue-hide-empty into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/buildqueue-hide-empty into lp:launchpad.
Commit message:
Hide the virt/nonvirt queue portlets on BuilderSet:+index if they'd be empty.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/buildqueue-hide-empty/+merge/335533
Hide the virt/nonvirt queue portlets on BuilderSet:+index if they'd be empty.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/buildqueue-hide-empty into lp:launchpad.
=== modified file 'lib/lp/buildmaster/browser/tests/test_builder.py'
--- lib/lp/buildmaster/browser/tests/test_builder.py 2015-10-21 09:37:08 +0000
+++ lib/lp/buildmaster/browser/tests/test_builder.py 2017-12-21 21:06:05 +0000
@@ -12,6 +12,7 @@
from lp.buildmaster.interfaces.builder import IBuilderSet
from lp.services.job.model.job import Job
from lp.testing import (
+ admin_logged_in,
record_two_runs,
TestCaseWithFactory,
)
@@ -22,7 +23,7 @@
def builders_homepage_render():
builders = getUtility(IBuilderSet)
- create_initialized_view(builders, "+index").render()
+ return create_initialized_view(builders, "+index").render()
class TestBuildersHomepage(TestCaseWithFactory, BuildCreationMixin):
@@ -90,3 +91,27 @@
recorder1, recorder2 = record_two_runs(
builders_homepage_render, create_builds, nb_objects)
self.assertThat(recorder2, HasQueryCount.byEquality(recorder1))
+
+ def test_category_portlet_not_shown_if_empty(self):
+ content = builders_homepage_render()
+ self.assertIn("Virtual build status", content)
+ self.assertIn("Non-virtual build status", content)
+
+ with admin_logged_in():
+ getUtility(IBuilderSet).getByName('frog').active = False
+ content = builders_homepage_render()
+ self.assertNotIn("Virtual build status", content)
+ self.assertIn("Non-virtual build status", content)
+
+ with admin_logged_in():
+ getUtility(IBuilderSet).getByName('bob').active = False
+ getUtility(IBuilderSet).getByName('frog').active = True
+ content = builders_homepage_render()
+ self.assertIn("Virtual build status", content)
+ self.assertNotIn("Non-virtual build status", content)
+
+ with admin_logged_in():
+ getUtility(IBuilderSet).getByName('frog').active = False
+ content = builders_homepage_render()
+ self.assertNotIn("Virtual build status", content)
+ self.assertNotIn("Non-virtual build status", content)
=== modified file 'lib/lp/buildmaster/templates/builders-index.pt'
--- lib/lp/buildmaster/templates/builders-index.pt 2016-10-03 13:02:24 +0000
+++ lib/lp/buildmaster/templates/builders-index.pt 2017-12-21 21:06:05 +0000
@@ -79,17 +79,19 @@
</div><!-- portlet -->
</div><!-- yui-u -->
- <div class="yui-u">
+ <div tal:define="category view/virt_builders"
+ tal:condition="category/groups" class="yui-u">
<div id="virt-queue-status" class="portlet">
- <div tal:define="category view/virt_builders">
+ <div>
<div metal:use-macro="template/macros/builder-category" />
</div>
</div><!-- portlet -->
</div><!-- yui-u -->
- <div class="yui-u">
+ <div tal:define="category view/nonvirt_builders"
+ tal:condition="category/groups" class="yui-u">
<div id="nonvirt-queue-status" class="portlet">
- <div tal:define="category view/nonvirt_builders">
+ <div>
<div metal:use-macro="template/macros/builder-category" />
</div>
</div><!-- portlet -->
Follow ups