]> gitweb.factorcode.org Git - factor.git/commitdiff
webapps.mason: show all the configured build machines, not just the failing ones.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 13 Aug 2012 23:21:32 +0000 (16:21 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 13 Aug 2012 23:21:32 +0000 (16:21 -0700)
extra/webapps/mason/backend/backend.factor
extra/webapps/mason/dashboard.xml
extra/webapps/mason/dashboard/dashboard.factor

index bb77dd81437a049792b3a2af3f7eb3be5968b0ff..ad9a66e3d7c532531c53cd9031556fc910b4c7da 100644 (file)
@@ -64,10 +64,19 @@ counter "COUNTER" {
 : increment-counter-value ( -- n )
     counter-tuple [ 0 or 1 + dup ] change-value update-tuple ;
 
+: all-builders ( -- builders )
+    builder new select-tuples ; inline
+
+: crashed? ( builder -- ? )
+    heartbeat-timestamp>> 30 minutes ago before? ;
+
+: broken? ( builder -- ? )
+    [ clean-git-id>> ] [ last-git-id>> ] bi = not ;
+
 : funny-builders ( -- crashed broken )
-    builder new select-tuples
-    [ [ heartbeat-timestamp>> 30 minutes ago before? ] filter ]
-    [ [ [ clean-git-id>> ] [ last-git-id>> ] bi = not ] filter ]
+    all-builders
+    [ [ crashed? ] filter ]
+    [ [ broken? ] filter ]
     bi ;
 
 : os/cpu ( builder -- string )
index 0a4908cced6edef245cba01e675c80fef3a49aa4..99a724e8d82b923b61a473554f9f9c94e2df5ab5 100644 (file)
@@ -3,13 +3,8 @@
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
        <t:title>Mason dashboard</t:title>
 
-       <h1>Crashed build machines</h1>
-       <p>Machines which are not sending heartbeats:</p>
-       <t:xml t:name="crashed" />
-
-       <h1>Broken build machines</h1>
-       <p>Machines with failing builds:</p>
-       <t:xml t:name="broken" />
+       <h1>Build machines</h1>
+       <t:xml t:name="builders" />
 
        <h1>Force build now</h1>
        <p>Requires build engineer status.</p>
index 3e40af9839e99e09e46976411b7ad443edb8ac8f..c96863e2ce10799508ea872bd747e2dc31503b0f 100644 (file)
@@ -1,13 +1,28 @@
 ! Copyright (C) 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel furnace.actions html.forms sequences
-xml.syntax webapps.mason.backend webapps.mason.utils ;
+USING: accessors combinators kernel furnace.actions html.forms
+sequences sorting xml.syntax webapps.mason.backend
+webapps.mason.utils ;
 IN: webapps.mason.downloads
 
+CONSTANT: CRASHED
+[XML <span style="background-color: yellow;">CRASHED</span> XML]
+
+CONSTANT: BROKEN
+[XML <span style="background-color: red; color: white;">BROKEN</span> XML]
+
+: builder-status ( builder -- status/f )
+    {
+        { [ dup crashed? ] [ drop CRASHED ] }
+        { [ dup broken? ] [ drop BROKEN ] }
+        [ drop f ]
+    } cond ;
+
 : builder-list ( seq -- xml )
+    [ os/cpu ] sort-with
     [
-        [ report-url ] [ os/cpu ] bi
-        [XML <li><a href=<->><-></a></li> XML]
+        [ report-url ] [ os/cpu ] [ builder-status ] tri
+        [XML <li><a href=<->><-></a> <-></li> XML]
     ] map
     [ [XML <p>No machines.</p> XML] ]
     [ [XML <ul><-></ul> XML] ]
@@ -17,9 +32,7 @@ IN: webapps.mason.downloads
     <page-action>
     [
         [
-            funny-builders
-            [ builder-list ] bi@
-            [ "crashed" set-value ]
-            [ "broken" set-value ] bi*
+            all-builders builder-list
+            "builders" set-value
         ] with-mason-db
     ] >>init ;