[Buildbot-commits] buildbot/buildbot/status/web baseweb.py, 1.19, 1.20 index.html, 1.3, 1.4

Brian Warner warner at users.sourceforge.net
Wed Sep 26 06:32:26 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/status/web
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15834/buildbot/status/web

Modified Files:
	baseweb.py index.html 
Log Message:
[project @ web: add OneBoxPerBuilder]

Original author: warner at lothar.com
Date: 2007-09-26 06:31:16+00:00

Index: baseweb.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/baseweb.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- baseweb.py	13 Aug 2007 17:22:49 -0000	1.19
+++ baseweb.py	26 Sep 2007 06:32:24 -0000	1.20
@@ -1,16 +1,16 @@
 
-import os, sys, time
+import os, sys, time, urllib
 from itertools import count
 
 from zope.interface import implements
 from twisted.python import log
 from twisted.application import strports, service
-from twisted.web import server, distrib, static
+from twisted.web import server, distrib, static, html
 from twisted.spread import pb
 
 from buildbot.interfaces import IControl, IStatusReceiver
 
-from buildbot.status.web.base import HtmlResource, css_classes
+from buildbot.status.web.base import HtmlResource, css_classes, Box, build_get_class, ICurrentBox
 from buildbot.status.web.waterfall import WaterfallStatusResource
 from buildbot.status.web.changes import ChangesResource
 from buildbot.status.web.builder import BuildersResource
@@ -182,6 +182,58 @@
 
         return data
 
+# /one_box_per_builder
+#  accepts builder=, branch=
+class OneBoxPerBuilder(HtmlResource):
+    """This shows a narrow table with one row per build. The leftmost column
+    contains the builder name. The next column contains the results of the
+    most recent build. The right-hand column shows the builder's current
+    activity.
+
+    builder=: show only builds for this builder. Multiple builder= arguments
+              can be used to see builds from any builder in the set.
+    """
+
+    title = "Latest Build"
+
+    def body(self, req):
+        status = self.getStatus(req)
+        
+        builders = req.args.get("builder", status.getBuilderNames())
+        branches = [b for b in req.args.get("branch", []) if b]
+
+        data = ""
+
+        data += "<h2>Latest builds</h2>\n"
+        data += "<table>\n"
+        for bn in builders:
+            builder = status.getBuilder(bn)
+            data += "<tr>\n"
+            data += "<td>%s</td>\n" % html.escape(bn)
+            b = builder.getLastFinishedBuild()
+            if b:
+                url = "%s/builders/%s/builds/%d" % \
+                      (self.path_to_root(req),
+                       urllib.quote(bn, safe=''),
+                       b.getNumber())
+                try:
+                    label = b.getProperty("got_revision")
+                except KeyError:
+                    label = None
+                if not label or len(str(label)) > 20:
+                    label = "#%d" % b.getNumber()
+                text = ['<a href="%s">%s</a>' % (url, label)]
+                text.extend(b.getText())
+                box = Box(text, b.getColor(),
+                          class_="LastBuild %s" % build_get_class(b))
+                data += box.td(align="center")
+            else:
+                data += "<td></td>\n"
+            current_box = ICurrentBox(builder).getBox(status)
+            data += current_box.td(align="center")
+        data += "</table>\n"
+        return data
+
 
 
 HEADER = '''
@@ -364,6 +416,7 @@
         self.putChild("buildslaves", BuildSlavesResource())
         #self.putChild("schedulers", SchedulersResource())
         self.putChild("one_line_per_build", OneLinePerBuild())
+        self.putChild("one_box_per_builder", OneBoxPerBuilder())
         self.putChild("xmlrpc", XMLRPCServer())
         self.putChild("about", AboutBuildbot())
 

Index: index.html
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/index.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- index.html	13 Aug 2007 17:22:49 -0000	1.3
+++ index.html	26 Sep 2007 06:32:24 -0000	1.4
@@ -12,7 +12,11 @@
   <li>the <a href="waterfall">Waterfall Display</a> will give you a
   time-oriented summary of recent buildbot activity.</li>
 
-  <li><a href="one_line_per_build">Recent Builds</a> are summarized here.</li>
+  <li>The <a href="one_box_per_builder">Latest Build</a> for each builder is
+  here.</li>
+
+  <li><a href="one_line_per_build">Recent Builds</a> are summarized here, one
+  per line.</li>
 
   <li><a href="buildslaves">Buildslave</a> information</li>
   <li><a href="changes">ChangeSource</a> information.</li>





More information about the Commits mailing list