[rhmessaging-commits] rhmessaging commits: r1166 - mgmt/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Oct 26 10:02:44 EDT 2007


Author: justi9
Date: 2007-10-26 10:02:43 -0400 (Fri, 26 Oct 2007)
New Revision: 1166

Modified:
   mgmt/cumin/python/cumin/broker.py
   mgmt/cumin/python/cumin/demo.py
   mgmt/cumin/python/cumin/model.py
   mgmt/cumin/python/cumin/page.strings
   mgmt/cumin/python/cumin/widgets.py
Log:
Replaces the 0 error, 0 warnings status with a simple indicator like
an led, either red, yellow, or green.



Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py	2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/broker.py	2007-10-26 14:02:43 UTC (rev 1166)
@@ -53,7 +53,7 @@
             return none()
 
     def render_item_status(self, session, broker):
-        return "0 errors, 0 warnings"
+        return status(len(broker.errors), len(broker.warnings))
 
     def render_item_load(self, session, broker):
         return "%.2f" % random()

Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py	2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/demo.py	2007-10-26 14:02:43 UTC (rev 1166)
@@ -189,6 +189,18 @@
             sleep(1)
 
             for broker in self.model.get_brokers():
+                if random() < 0.005:
+                    broker.errors.append(object())
+
+                if random() < 0.02 and len(broker.errors):
+                    del broker.errors[0]
+
+                if random() < 0.005:
+                    broker.warnings.append(object())
+
+                if random() < 0.02 and len(broker.warnings):
+                    del broker.warnings[0]
+
                 for vhost in broker.virtual_host_items():
                     for exchange in vhost.exchange_items():
                         exchange.lock()

Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/model.py	2007-10-26 14:02:43 UTC (rev 1166)
@@ -199,6 +199,9 @@
         self.name = None
         self.default_virtual_host = None
 
+        self.errors = list()
+        self.warnings = list()
+
     def write_xml(self, writer):
         writer.write("<broker id=\"broker-%i\">" % self.id)
         writer.write("<name>" + self.name + "</name>")

Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings	2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/page.strings	2007-10-26 14:02:43 UTC (rev 1166)
@@ -311,33 +311,53 @@
   content: url(resource?name=radio-button-checked.png);
 }
 
-.mstatus {
+div.mstatus {
   float: right;
   margin: 1em;
   padding: 0.75em 1em;
   width: 15em;
 }
 
-.mstatus h2 {
+div.mstatus h2 {
   font-weight: bold;
   margin: 0 0 0.5em 0;
 }
 
-.mstatus.red {
+div.mstatus.red {
   border: 1px solid #c99;
   background-color: #fcc;
 }
 
-.mstatus.yellow {
+div.mstatus.yellow {
   border: 1px solid #cc9;
   background-color: #ffc;
 }
 
-.mstatus.green {
+div.mstatus.green {
   border: 1px solid #9c9;
   background-color: #cfc;
 }
 
+div.statuslight {
+  float: left;
+  width: 1em;
+  height: 1em;
+  margin: 0.25em 1px 0 0;
+  padding: 0;
+}
+
+div.statuslight.red {
+  background-color: #e33;
+}
+
+div.statuslight.yellow {
+  background-color: #ee6;
+}
+
+div.statuslight.green {
+  background-color: #9e9;
+}
+
 pre.code {
   background-color: #f7f7f7;
   padding: 1em;

Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py	2007-10-26 13:21:14 UTC (rev 1165)
+++ mgmt/cumin/python/cumin/widgets.py	2007-10-26 14:02:43 UTC (rev 1166)
@@ -14,6 +14,10 @@
 def none():
     return "<span class=\"none\">None</span>"
 
+def status(errs, warns):
+    return "<div class=\"statuslight %s\"/>" % \
+           (errs + warns == 0 and "green" or (errs and "red" or "yellow"))
+
 class CuminFrame(Frame, ModeSet):
     def __init__(self, app, name):
         super(CuminFrame, self).__init__(app, name)




More information about the rhmessaging-commits mailing list