[rhmessaging-commits] rhmessaging commits: r2689 - mgmt/trunk/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Oct 24 11:44:05 EDT 2008


Author: eallen
Date: 2008-10-24 11:44:05 -0400 (Fri, 24 Oct 2008)
New Revision: 2689

Modified:
   mgmt/trunk/cumin/python/cumin/collector.py
   mgmt/trunk/cumin/python/cumin/collector.strings
Log:
Added commented out code to determine collector start/stop status.
This code may be resurrected at a later date. 

Modified: mgmt/trunk/cumin/python/cumin/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.py	2008-10-24 15:43:03 UTC (rev 2688)
+++ mgmt/trunk/cumin/python/cumin/collector.py	2008-10-24 15:44:05 UTC (rev 2689)
@@ -36,9 +36,20 @@
         self.__stop = self.StopButton(app, "stop")
         self.add_child(self.__stop)
 
-    def render_title(self, session):
-        return "Collectors %s" % fmt_count(Collector.select().count())
+    def get_args(self, session):
+        return self.frame.get_args(session)
 
+    def render_title(self, session, collector):
+        count = self.get_item_count(session, collector)
+        return "Collectors %s" % fmt_count(count)
+
+    def render_sql_where(self, session, collector):
+        sql = "deletion_time is null"
+        #sql = "((cs.rec_time is null and c.rec_time > now() - interval '10 minutes') or " + \
+        #    "(cs.rec_time > now() - interval '10 minutes')" + \
+        #    " and deletion_time is null)"
+        return "where %s" % sql
+
     class NameColumn(SqlTableColumn):
         def render_title(self, session, data):
             return "Name"
@@ -111,9 +122,24 @@
         data = "model.xml?class=collector;id=%i" % coll.id
         return "wooly.setIntervalUpdate('%s', updateCollector, 3000)" % data
 
-class CollectorStatus(CuminStatus):
-    pass
+class CollectorStatus(CuminStatus, AjaxField):
+    def render_collector_status(self, session, collector):
+        return ""
+        #return "<span id=\"%s\"></span>%s" % \
+        #    (self.name, self.render_script(session))
 
+    def render_color(self, session, collector):
+        #return "transparent"
+        return "green"
+        
+    def get_url(self, session):
+        collector = self.get_args(session)[0]
+        if collector:
+            return "call.xml?class=collector;id=%i;method=GetStarted" % collector.id
+
+    def got_fn(self, session):
+        return "startstop_status"
+
 class CollectorStart(CuminBulkActionForm):
     def render_title(self, session, *args):
         return "Start Collector"

Modified: mgmt/trunk/cumin/python/cumin/collector.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.strings	2008-10-24 15:43:03 UTC (rev 2688)
+++ mgmt/trunk/cumin/python/cumin/collector.strings	2008-10-24 15:44:05 UTC (rev 2689)
@@ -6,12 +6,14 @@
   y.node_name as system_name
 from collector as c
 inner join system as y on c.system = y.node_name
+left outer join collector_stats as cs on cs.id = c.stats_curr_id
 {sql_where}
 {sql_orderby}
 {sql_limit}
 
 [CollectorSet.count_sql]
-select count(*) from collector as c
+select count(1) from collector as c
+left outer join collector_stats as cs on cs.id = c.stats_curr_id
 {sql_where}
 
 [CollectorView.javascript]
@@ -53,3 +55,11 @@
 	</table>
 	<div>{hidden_inputs}</div>
 </form>
+
+
+[CollectorStatus.html]
+<div id="{id}" class="CuminStatus {color}">
+  <h2>Collector Status</h2>
+  {collector_status}
+  <div id="recTime"></div>
+</div>




More information about the rhmessaging-commits mailing list