[Buildbot-commits] buildbot/buildbot/status html.py,1.72,1.73 classic.css,1.1,1.2

Brian Warner warner at users.sourceforge.net
Sun Oct 23 05:16:59 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot/status
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5819/buildbot/status

Modified Files:
	html.py classic.css 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-360
Creator:  Brian Warner <warner at lothar.com>

add countdown timer for upcoming builds, add "waiting" state

	* buildbot/status/html.py (StatusResourceBuild.body): revision
	might be numeric, so stringify it before html-escapifying it
	(CurrentBox.getBox): add a "waiting" state, and show a countdown
	timer for the upcoming build
	* buildbot/status/classic.css: add background-color attributes for
	offline/waiting/building classes


Index: classic.css
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/classic.css,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- classic.css	26 Apr 2005 02:43:12 -0000	1.1
+++ classic.css	23 Oct 2005 05:16:57 -0000	1.2
@@ -8,9 +8,18 @@
 }
 
 /* Activity states */
+.offline { 
+        background-color: red;
+}
 .idle {
 	background-color: white;
 }
+.waiting { 
+        background-color: yellow;
+}
+.building { 
+        background-color: yellow;
+}
 
 /* LastBuild, BuildStep states */
 .success {

Index: html.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/html.py,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- html.py	21 Oct 2005 08:03:39 -0000	1.72
+++ html.py	23 Oct 2005 05:16:57 -0000	1.73
@@ -316,7 +316,7 @@
         if branch:
             data += "  <li>Branch: %s</li>\n" % html.escape(branch)
         if revision:
-            data += "  <li>Revision: %s</li>\n" % html.escape(revision)
+            data += "  <li>Revision: %s</li>\n" % html.escape(str(revision))
         if patch:
             data += "  <li>Patch: YES</li>\n" # TODO: provide link to .diff
         if b.getChanges():
@@ -762,7 +762,20 @@
     def getBox(self, status):
         # getState() returns offline, idle, or building
         state, builds = self.original.getState()
-        color = "white"
+
+        # look for upcoming builds. We say the state is "waiting" if the
+        # builder is otherwise idle and there is a scheduler which tells us a
+        # build will be performed some time in the near future. TODO: this
+        # functionality used to be in BuilderStatus.. maybe this code should
+        # be merged back into it.
+        upcoming = []
+        builderName = self.original.getName()
+        for s in status.getSchedulers():
+            if builderName in s.listBuilderNames():
+                upcoming.extend(s.getPendingBuildTimes())
+        if state == "idle" and upcoming:
+            state = "waiting"
+
         if state == "building":
             color = "yellow"
             text = ["building"]
@@ -775,9 +788,14 @@
             color = "red"
             text = ["offline"]
         elif state == "idle":
+            color = "white"
             text = ["idle"]
+        elif state == "waiting":
+            color = "yellow"
+            text = ["waiting"]
         else:
             # just in case I add a state and forget to update this
+            color = "white"
             text = [state]
 
         # TODO: for now, this pending/upcoming stuff is in the "current
@@ -789,15 +807,17 @@
         pbs = self.original.getPendingBuilds()
         if pbs:
             text.append("%d pending" % len(pbs))
-        # how about upcoming ones?
-        upcoming = []
-        builderName = self.original.getName()
-        for s in status.getSchedulers():
-            if builderName in s.listBuilderNames():
-                upcoming.extend(s.getPendingBuildTimes())
         for t in upcoming:
             text.extend(["next at", 
-                         time.strftime("%H:%M:%S", time.localtime(t))])
+                         time.strftime("%H:%M:%S", time.localtime(t)),
+                         "[%d secs]" % (t - util.now()),
+                         ])
+            # TODO: the upcoming-builds box looks like:
+            #  ['waiting', 'next at', '22:14:15', '[86 secs]']
+            # while the currently-building box is reversed:
+            #  ['building', 'ETA in', '2 secs', 'at 22:12:50']
+            # consider swapping one of these to make them look the same. also
+            # consider leaving them reversed to make them look different.
         return Box(text, color=color, class_="Activity " + state)
 
 components.registerAdapter(CurrentBox, builder.BuilderStatus, ICurrentBox)





More information about the Commits mailing list