← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:cibuild-icons into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:cibuild-icons into launchpad:master.

Commit message:
Configure icons for CIBuild objects

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/417911
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:cibuild-icons into launchpad:master.
diff --git a/lib/lp/app/browser/configure.zcml b/lib/lp/app/browser/configure.zcml
index 9419f7f..88985a9 100644
--- a/lib/lp/app/browser/configure.zcml
+++ b/lib/lp/app/browser/configure.zcml
@@ -588,6 +588,12 @@
       factory="lp.app.browser.tales.BuildImageDisplayAPI"
       name="image"
       />
+  <adapter
+      for="lp.code.interfaces.cibuild.ICIBuild"
+      provides="zope.traversing.interfaces.IPathAdapter"
+      factory="lp.app.browser.tales.BuildImageDisplayAPI"
+      name="image"
+      />
 
   <adapter
       for="lp.soyuz.interfaces.archive.IArchive"
diff --git a/lib/lp/app/doc/tales.txt b/lib/lp/app/doc/tales.txt
index 90c5080..b82bb61 100644
--- a/lib/lp/app/doc/tales.txt
+++ b/lib/lp/app/doc/tales.txt
@@ -229,6 +229,40 @@ But the 'failed to build' build is 16x14:
     >>> print(test_tales("build/image:icon", build=build))
     <img width="16" height="14"...src="/@@/build-failed" />
 
+Other build types have similar icon handling.
+
+    >>> from lp.charms.interfaces.charmrecipe import CHARM_RECIPE_ALLOW_CREATE
+    >>> from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
+    >>> from lp.services.features.testing import FeatureFixture
+    >>> from lp.soyuz.interfaces.livefs import LIVEFS_FEATURE_FLAG
+
+    >>> spr_build = factory.makeSourcePackageRecipeBuild()
+    >>> print(test_tales("build/image:icon", build=spr_build))
+    <img width="14" height="14"...src="/@@/build-needed" />
+
+    >>> with FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}):
+    ...     livefs_build = factory.makeLiveFSBuild()
+    >>> print(test_tales("build/image:icon", build=livefs_build))
+    <img width="14" height="14"...src="/@@/build-needed" />
+
+    >>> snap_build = factory.makeSnapBuild()
+    >>> print(test_tales("build/image:icon", build=snap_build))
+    <img width="14" height="14"...src="/@@/build-needed" />
+
+    >>> with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
+    ...     oci_recipe_build = factory.makeOCIRecipeBuild()
+    >>> print(test_tales("build/image:icon", build=oci_recipe_build))
+    <img width="14" height="14"...src="/@@/build-needed" />
+
+    >>> with FeatureFixture({CHARM_RECIPE_ALLOW_CREATE: "on"}):
+    ...     charm_recipe_build = factory.makeCharmRecipeBuild()
+    >>> print(test_tales("build/image:icon", build=charm_recipe_build))
+    <img width="14" height="14"...src="/@@/build-needed" />
+
+    >>> ci_build = factory.makeCIBuild()
+    >>> print(test_tales("build/image:icon", build=ci_build))
+    <img width="14" height="14"...src="/@@/build-needed" />
+
 Revision status reports have an icon for each result.
 
     >>> from lp.code.enums import RevisionStatusResult