Author: eallen
Date: 2008-08-18 13:54:17 -0400 (Mon, 18 Aug 2008)
New Revision: 2317
Modified:
mgmt/trunk/cumin/python/cumin/exchange.py
mgmt/trunk/cumin/python/cumin/exchange.strings
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/cumin/queue.strings
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/cumin/python/cumin/widgets.strings
Log:
Implement ExchangeBindingSet and QueueBindingSet using hidden columns
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-15 19:17:19 UTC (rev 2316)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-08-18 17:54:17 UTC (rev 2317)
@@ -305,9 +305,8 @@
self.__remove = self.Remove(app, "remove", self)
self.add_child(self.__remove)
- def get_name_col(self, app):
- return self.NameColumn(app, "q_id")
-
+ self.show_column("q_id")
+
def render_title(self, session, exchange):
return "Queue Bindings %s" % \
fmt_count(exchange.bindings.count())
@@ -318,16 +317,6 @@
elems.append(self.phase.get_sql_constraint(session, exchange))
return "where %s" % " and ".join(elems)
- class NameColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Queue"
-
- def render_content(self, session, data):
- queue = Identifiable(data["q_id"])
- branch = session.branch()
- self.frame.frame.show_queue(branch, queue).show_view(branch)
- return fmt_olink(branch, Queue.get(data["q_id"]))
-
class Remove(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
Modified: mgmt/trunk/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.strings 2008-08-15 19:17:19 UTC (rev 2316)
+++ mgmt/trunk/cumin/python/cumin/exchange.strings 2008-08-18 17:54:17 UTC (rev 2317)
@@ -191,23 +191,6 @@
cumin.runObjectListeners(exchange);
}
-[ExchangeBindingSet.sql]
-select
- b.id,
- b.queue_id as q_id,
- b.binding_key as key
-from binding as b
-left outer join binding_stats as c on c.id = b.stats_curr_id
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[ExchangeBindingSet.count_sql]
-select count(*)
-from binding as b
-left outer join binding_stats as c on c.id = b.stats_curr_id
-{sql_where}
-
[ExchangeBindingSet.html]
<form id="{id}" method="post" action="?">
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-08-15 19:17:19 UTC (rev 2316)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-08-18 17:54:17 UTC (rev 2317)
@@ -287,9 +287,8 @@
self.__remove = self.Remove(app, "remove", self)
self.add_child(self.__remove)
- def get_name_col(self, app):
- return self.NameColumn(app, "e_id")
-
+ self.show_column("e_id")
+
def render_add_queue_binding_url(self, session, vhost):
branch = session.branch()
self.frame.show_queue_binding_add(branch)
@@ -305,17 +304,6 @@
return "Exchange Bindings %s" % \
fmt_count(queue.bindings.count())
- class NameColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Exchange"
-
- def render_content(self, session, data):
- exchange = Identifiable(data["e_id"])
- branch = session.branch()
- self.frame.frame.show_exchange(branch, exchange).show_view(branch)
- name = Exchange.get(data["e_id"]).name or
"<em>Default</em>"
- return fmt_olink(branch, exchange, name=name)
-
class Remove(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
Modified: mgmt/trunk/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.strings 2008-08-15 19:17:19 UTC (rev 2316)
+++ mgmt/trunk/cumin/python/cumin/queue.strings 2008-08-18 17:54:17 UTC (rev 2317)
@@ -126,23 +126,6 @@
//throw new Error();
}
-[QueueBindingSet.sql]
-select
- b.id,
- b.exchange_id as e_id,
- b.binding_key as key
-from binding as b
-left outer join binding_stats as c on c.id = b.stats_curr_id
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[QueueBindingSet.count_sql]
-select count(*)
-from binding as b
-left outer join binding_stats as c on c.id = b.stats_curr_id
-{sql_where}
-
[QueueBindingSet.html]
<form id="{id}" method="post" action="?">
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-15 19:17:19 UTC (rev 2316)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-18 17:54:17 UTC (rev 2317)
@@ -493,9 +493,12 @@
self.ids = CheckboxIdColumn(app, "id", self)
self.add_column(self.ids)
- col = self.get_name_col(app)
+ col = self.QNameColumn(app, "q_id", hidden=True)
self.add_column(col)
+ col = self.ENameColumn(app, "e_id", hidden=True)
+ self.add_column(col)
+
col = self.KeyColumn(app, "key")
self.add_column(col)
@@ -514,13 +517,30 @@
obj = self.frame.get_object(session)
return (obj,)
- def get_name_col(self):
- # implemented in derived class
- pass
-
def get_sql_values(self, session, obj):
return {"id": obj.id}
+ class QNameColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Queue"
+
+ def render_content(self, session, data):
+ queue = Identifiable(data["q_id"])
+ branch = session.branch()
+ self.frame.frame.show_queue(branch, queue).show_view(branch)
+ return fmt_olink(branch, Queue.get(data["q_id"]))
+
+ class ENameColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Exchange"
+
+ def render_content(self, session, data):
+ exchange = Identifiable(data["e_id"])
+ branch = session.branch()
+ self.frame.frame.show_exchange(branch, exchange).show_view(branch)
+ name = Exchange.get(data["e_id"]).name or
"<em>Default</em>"
+ return fmt_olink(branch, exchange, name=name)
+
class KeyColumn(SqlTableColumn):
def render_title(self, session, data):
return "Key"
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2008-08-15 19:17:19 UTC (rev 2316)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2008-08-18 17:54:17 UTC (rev 2317)
@@ -1,3 +1,22 @@
+[BindingSet.sql]
+select
+ b.id,
+ b.exchange_id as e_id,
+ b.queue_id as q_id,
+ b.binding_key as key
+from binding as b
+left outer join binding_stats as c on c.id = b.stats_curr_id
+{sql_where}
+{sql_orderby}
+{sql_limit}
+
+[BindingSet.count_sql]
+select count(*)
+from binding as b
+left outer join binding_stats as c on c.id = b.stats_curr_id
+{sql_where}
+
+
[CuminView.html]
<script type="text/javascript">
{script}