Author: justi9
Date: 2007-11-02 12:12:10 -0400 (Fri, 02 Nov 2007)
New Revision: 1215
Modified:
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/widgets.py
Log:
Adds a reusable CuminStatus widget and uses it for queue status.
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-11-02 15:46:24 UTC (rev 1214)
+++ mgmt/cumin/python/cumin/page.strings 2007-11-02 16:12:10 UTC (rev 1215)
@@ -400,6 +400,9 @@
div.mstatus h2 {
font-weight: bold;
+}
+
+div.mstatus div, div.mstatus h2 {
margin: 0 0 0.5em 0;
}
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-02 15:46:24 UTC (rev 1214)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-02 16:12:10 UTC (rev 1215)
@@ -113,15 +113,7 @@
def render_title(self, session, queue):
return "Queue '%s'" % queue.name
-class QueueStatus(Widget):
- def render_class(self, session, queue):
- if queue.errors:
- return "QueueStatus red"
- elif queue.warnings:
- return "QueueStatus yellow"
- else:
- return "QueueStatus green"
-
+class QueueStatus(CuminStatus):
def render_url(self, session, queue):
return "queue.xml?id=%i" % queue.id
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-02 15:46:24 UTC (rev 1214)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-02 16:12:10 UTC (rev 1215)
@@ -120,9 +120,11 @@
//wooly.setIntervalUpdate("{id}", "{url}", updateStatus, 3000);
}())
</script>
-<div class="{class} mstatus" id="{id}">
+<div id="{id}" class="{class}">
<h2>Queue Status</h2>
+ <div>{status_info}</div>
+
<table>
<tr>
<th></th>
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-11-02 15:46:24 UTC (rev 1214)
+++ mgmt/cumin/python/cumin/widgets.py 2007-11-02 16:12:10 UTC (rev 1215)
@@ -2,6 +2,8 @@
from wooly.widgets import *
from wooly.forms import *
+from util import *
+
strings = StringCatalog(__file__)
def link(href, content, class_=""):
@@ -136,3 +138,19 @@
class CuminConfirmForm(CuminForm):
def __init__(self, app, name):
super(CuminConfirmForm, self).__init__(app, name)
+
+class CuminStatus(Widget):
+ def render_class(self, session, object):
+ if object.errors:
+ return "mstatus red"
+ elif object.warnings:
+ return "mstatus yellow"
+ else:
+ return "mstatus green"
+
+ def render_status_info(self, session, object):
+ error_count = len(object.errors)
+ warning_count = len(object.warnings)
+
+ return "%i error%s, %i warning%s" % (error_count, ess(error_count),
+ warning_count, ess(warning_count))
Show replies by date