Author: justi9
Date: 2007-10-31 13:04:53 -0400 (Wed, 31 Oct 2007)
New Revision: 1196
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/brokercluster.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/queue.py
mgmt/notes/justin-todo.txt
Log:
Finishes making qs and es live directly under broker. Takes vhosts
out of the context navigation.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-10-31 16:17:27 UTC (rev 1195)
+++ mgmt/cumin/python/cumin/broker.py 2007-10-31 17:04:53 UTC (rev 1196)
@@ -110,21 +110,35 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
- self.vhost = VirtualHostFrame(app, "vhost")
- self.add_mode(self.vhost)
-
self.prop = BrokerConfigPropertyForm(app, "prop")
self.add_mode(self.prop)
- def show_virtual_host(self, session, vhost):
- self.vhost.set_object(session, vhost)
- return self.show_mode(session, self.vhost)
+ self.queue = QueueFrame(app, "queue")
+ self.add_mode(self.queue)
+ self.exchange = ExchangeFrame(app, "exchange")
+ self.add_mode(self.exchange)
+
+ self.client = ClientFrame(app, "client")
+ self.add_mode(self.client)
+
def show_config_property(self, session, prop):
self.prop.set_config_property(session, prop)
frame = self.show_mode(session, self.prop)
return self.page().set_current_frame(session, frame)
+ def show_queue(self, session, queue):
+ self.queue.set_object(session, queue)
+ return self.show_mode(session, self.queue)
+
+ def show_exchange(self, session, exchange):
+ self.exchange.set_object(session, exchange)
+ return self.show_mode(session, self.exchange)
+
+ def show_client(self, session, client):
+ self.client.set_object(session, client)
+ return self.show_mode(session, self.client)
+
def render_title(self, session, broker):
return "Broker '%s'" % broker.name
@@ -259,21 +273,24 @@
class BrokerQueueTab(QueueSet):
def render_title(self, session, broker):
- return "Queues"
+ count = len(broker.default_virtual_host.queue_items())
+ return "Queues (%i)" % count
def get_object(self, session, broker):
return broker.default_virtual_host
class BrokerExchangeTab(ExchangeSet):
def render_title(self, session, broker):
- return "Exchanges"
+ count = len(broker.default_virtual_host.exchange_items())
+ return "Exchanges (%i)" % count
def get_object(self, session, broker):
return broker.default_virtual_host
class BrokerClientTab(ClientSet):
def render_title(self, session, broker):
- return "Clients"
+ count = len(broker.default_virtual_host.client_items())
+ return "Clients (%i)" % count
def get_object(self, session, broker):
return broker.default_virtual_host
Modified: mgmt/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.py 2007-10-31 16:17:27 UTC (rev 1195)
+++ mgmt/cumin/python/cumin/brokercluster.py 2007-10-31 17:04:53 UTC (rev 1196)
@@ -57,17 +57,10 @@
self.broker = BrokerFrame(app, "broker")
self.add_mode(self.broker)
- self.vhost = VirtualHostFrame(app, "vhost")
- self.add_mode(self.vhost)
-
def show_broker(self, session, broker):
self.broker.set_object(session, broker)
return self.show_mode(session, self.broker)
- def show_virtual_host(self, session, vhost):
- self.vhost.set_object(session, vhost)
- return self.show_mode(session, self.vhost)
-
def render_title(self, session, cluster):
return "Broker Cluster '%s'" % cluster.name
@@ -79,7 +72,6 @@
self.add_child(self.tabs)
self.tabs.add_tab(self.ClusterBrokerTab(app, "brokers"))
- self.tabs.add_tab(self.ClusterVirtualHostTab(app, "vhosts"))
self.tabs.add_tab(self.ClusterStatsTab(app, "stats"))
def render_title(self, session, cluster):
@@ -95,13 +87,6 @@
def get_items(self, session, cluster):
return sorted_by(cluster.broker_items())
- class ClusterVirtualHostTab(VirtualHostSet):
- def render_title(self, session, cluster):
- return "Functional Hosts (%i)" % len(cluster.virtual_host_items())
-
- def get_items(self, session, cluster):
- return sorted_by(cluster.virtual_host_items())
-
class ClusterStatsTab(Widget):
def render_title(self, session, cluster):
return "Statistics"
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-10-31 16:17:27 UTC (rev 1195)
+++ mgmt/cumin/python/cumin/exchange.py 2007-10-31 17:04:53 UTC (rev 1196)
@@ -177,7 +177,7 @@
class ExchangeAdd(ExchangeForm):
def process_cancel(self, session, vhost):
branch = session.branch()
- self.page().show_virtual_host(branch, vhost).show_view(branch)
+ self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
session.set_redirect(branch.marshal())
def process_submit(self, session, vhost):
@@ -233,7 +233,7 @@
exchange.remove()
branch = session.branch()
- self.page().show_virtual_host(branch, vhost).show_view(branch)
+ self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
session.set_redirect(branch.marshal())
def process_cancel(self, session, exchange):
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-31 16:17:27 UTC (rev 1195)
+++ mgmt/cumin/python/cumin/page.py 2007-10-31 17:04:53 UTC (rev 1196)
@@ -96,33 +96,21 @@
frame.set_object(session, profile)
return self.set_current_frame(session, frame)
- def show_virtual_host(self, session, vhost):
- broker = vhost.get_broker()
- cluster = vhost.get_broker_cluster()
-
- if broker:
- frame = self.show_broker(session, broker)
- elif cluster:
- frame = self.show_broker_cluster(session, cluster)
- else:
- raise Exception()
-
- frame = frame.show_virtual_host(session, vhost)
-
- return self.set_current_frame(session, frame)
-
def show_queue(self, session, queue):
- frame = self.show_virtual_host(session, queue.virtual_host)
+ broker = queue.get_virtual_host().get_broker()
+ frame = self.show_broker(session, broker)
frame = frame.show_queue(session, queue)
return self.set_current_frame(session, frame)
def show_exchange(self, session, exchange):
- frame = self.show_virtual_host(session, exchange.virtual_host)
+ broker = exchange.get_virtual_host().get_broker()
+ frame = self.show_broker(session, broker)
frame = frame.show_exchange(session, exchange)
return self.set_current_frame(session, frame)
def show_client(self, session, client):
- frame = self.show_virtual_host(session, client.virtual_host)
+ broker = client.get_virtual_host().get_broker()
+ frame = self.show_broker(session, broker)
frame = frame.show_client(session, client)
return self.set_current_frame(session, frame)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-31 16:17:27 UTC (rev 1195)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-31 17:04:53 UTC (rev 1196)
@@ -200,7 +200,7 @@
class QueueAdd(QueueForm):
def process_cancel(self, session, vhost):
branch = session.branch()
- self.page().show_virtual_host(branch, vhost).show_view(branch)
+ self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
session.set_redirect(branch.marshal())
def process_submit(self, session, vhost):
@@ -256,7 +256,7 @@
queue.remove()
branch = session.branch()
- self.page().show_virtual_host(branch, vhost).show_view(branch)
+ self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
session.set_redirect(branch.marshal())
def process_cancel(self, session, queue):
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-10-31 16:17:27 UTC (rev 1195)
+++ mgmt/notes/justin-todo.txt 2007-10-31 17:04:53 UTC (rev 1196)
@@ -107,3 +107,9 @@
* Make the status lights also be links to an appropriate view
* Make status boxes display stats like those from list views
+
+ * Right now we're calling render_title outside of render in order to
+ produce tab labels, for instance. This is not good, especially in
+ cases where get_object is overriden and that fact is not reflected
+ in the render_title calls. Perhaps introduce a get_title to solve
+ this.