Author: justi9
Date: 2008-03-19 14:26:52 -0400 (Wed, 19 Mar 2008)
New Revision: 1782
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
Log:
Add a first cut of the broker links tab.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-19 16:27:12 UTC (rev 1781)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-19 18:26:52 UTC (rev 1782)
@@ -123,6 +123,35 @@
return link
+class BrokerLinkSet(CuminTable):
+ def __init__(self, app, name):
+ super(BrokerLinkSet, self).__init__(app, name)
+
+ col = self.AddressColumn(app, "addr")
+ self.add_column(col)
+
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, broker):
+ count = self.get_item_count(session, broker)
+ return "Broker Links %s" % fmt_count(count)
+
+ def render_sql_where(self, session, reg):
+ vhost = reg.getDefaultVhost()
+ return "where v.id = %(vhost_id)r"
+
+ def get_sql_values(self, session, reg):
+ vhost = reg.getDefaultVhost()
+ return {"vhost_id": vhost.id}
+
+ class AddressColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Address"
+
+ def render_content(self, session, data):
+ return data[name]
+
class BrokerFrame(CuminFrame):
def __init__(self, app, name):
super(BrokerFrame, self).__init__(app, name)
@@ -208,6 +237,7 @@
self.tabs.add_tab(self.BrokerQueueTab(app, "queues"))
self.tabs.add_tab(self.BrokerExchangeTab(app, "exchanges"))
self.tabs.add_tab(self.BrokerClientTab(app, "clients"))
+ self.tabs.add_tab(BrokerLinkSet(app, "links"))
self.missing = self.BrokerMissing(app, "missing")
self.body.add_mode(self.missing)
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-03-19 16:27:12 UTC (rev 1781)
+++ mgmt/cumin/python/cumin/broker.strings 2008-03-19 18:26:52 UTC (rev 1782)
@@ -39,6 +39,20 @@
{hidden_inputs}
</form>
+[BrokerLinkSet.sql]
+select l.id, l.address as addr
+from link as l
+join vhost as v on v.id = l.vhost_id
+{sql_where}
+{sql_orderby}
+{sql_limit}
+
+[BrokerLinkSet.count_sql]
+select count(*)
+from link as l
+join vhost as v on v.id = l.vhost_id
+{sql_where}
+
[BrokerView.javascript]
function updateBroker(data) {
var model = data.objectify();