Author: justi9
Date: 2008-04-09 07:29:58 -0400 (Wed, 09 Apr 2008)
New Revision: 1875
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/model.py
Log:
Add a custom details tab to BrokerView so we pick up the props and
actions of both the Broker and BrokerRegistration objects.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-04-08 21:24:31 UTC (rev 1874)
+++ mgmt/cumin/python/cumin/broker.py 2008-04-09 11:29:58 UTC (rev 1875)
@@ -249,7 +249,8 @@
self.__tabs.add_tab(self.BrokerQueueTab(app, "queues"))
self.__tabs.add_tab(ExchangeSet(app, "exchanges"))
self.__tabs.add_tab(ClientSet(app, "clients"))
- self.__tabs.add_tab(PeerSet(app, "links"))
+ self.__tabs.add_tab(PeerSet(app, "peers"))
+ self.__tabs.add_tab(self.BrokerDetailsTab(app, "details"))
self.__missing = self.BrokerMissing(app, "missing")
self.__body.add_mode(self.__missing)
@@ -273,9 +274,6 @@
data = "model.xml?class=broker;id=%i" % reg.broker.id
return "wooly.setIntervalUpdate('%s', updateBroker, 3000)"
% data
- def render_icon_resource(self, session, reg):
- return "broker-36.png"
-
def render_group_links(self, session, reg):
links = list()
@@ -320,6 +318,47 @@
def render_title(self, session, reg):
return "Log Messages"
+ class BrokerDetailsTab(Widget):
+ def __init__(self, app, name):
+ super(BrokerView.BrokerDetailsTab, self).__init__(app, name)
+
+ props = self.Properties(app, "properties")
+ self.add_child(props)
+
+ actions = self.Actions(app, "actions")
+ self.add_child(actions)
+
+ def render_title(self, session):
+ return "Details"
+
+ class Properties(CuminProperties):
+ def do_get_items(self, session, reg):
+ cls = self.app.model.get_class_by_object(reg)
+ props = [(x.get_title(session), x.value(reg))
+ for x in cls.properties]
+
+ if reg.broker:
+ cls = self.app.model.get_class_by_object(reg.broker)
+ props.extend([(x.get_title(session),
+ x.value(reg.broker))
+ for x in cls.properties])
+
+ return props
+
+ class Actions(CuminActions):
+ def do_get_items(self, session, reg):
+ cls = self.app.model.get_class_by_object(reg)
+ acts = [(x.get_href(session, reg), x.get_title(session))
+ for x in cls.actions]
+
+ if reg.broker:
+ cls = self.app.model.get_class_by_object(reg.broker)
+ acts.extend([(x.get_href(session, reg.broker),
+ x.get_title(session))
+ for x in cls.actions])
+
+ return acts
+
class BrokerBrowser(Widget):
def __init__(self, app, name):
super(BrokerBrowser, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-04-08 21:24:31 UTC (rev 1874)
+++ mgmt/cumin/python/cumin/broker.strings 2008-04-09 11:29:58 UTC (rev 1875)
@@ -108,6 +108,18 @@
{items}
+[BrokerDetailsTab.html]
+<table class="CuminDetails">
+ <tr>
+ <th>Properties</th>
+ <th>Actions</th>
+ </tr>
+ <tr>
+ <td>{properties}</td>
+ <td>{actions}</td>
+ </tr>
+</table>
+
[BrokerBrowser.html]
<table class="browser">
<tr>
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-04-08 21:24:31 UTC (rev 1874)
+++ mgmt/cumin/python/cumin/model.py 2008-04-09 11:29:58 UTC (rev 1875)
@@ -381,9 +381,6 @@
def __init__(self, model, name, mint_class):
super(LocalClass, self).__init__(model, name, mint_class)
- action = self.Add(self, "add")
- action.title = "Add"
-
action = self.Edit(self, "edit")
action.title = "Edit"