Author: justi9
Date: 2007-11-15 15:57:45 -0500 (Thu, 15 Nov 2007)
New Revision: 1321
Modified:
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/widgets.strings
Log:
Adds a purge action to queue that currently just fires the echo method
on the managed broker.
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-15 19:52:03 UTC (rev 1320)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-15 20:57:45 UTC (rev 1321)
@@ -99,6 +99,12 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
+ self.purge = QueuePurge(app, "purge")
+ self.add_mode(self.purge)
+
+ def show_purge(self, session):
+ return self.show_mode(session, self.purge)
+
# XXX not awesome
def get_object(self, session, object):
queue = self.param.get(session)
@@ -188,6 +194,11 @@
def render_updated(self, session, queue):
return fmt_datetime(datetime.utcnow())
+ def render_purge_href(self, session, queue):
+ branch = session.branch()
+ self.parent().show_purge(branch)
+ return branch.marshal()
+
class QueueBindingSet(ItemSet):
def get_title(self, session, queue):
return "Exchange Bindings %s" % fmt_count(len(queue.bindings))
@@ -332,6 +343,33 @@
def render_cancel_content(self, session, queue):
return "No, Cancel"
+def doit(error, args):
+ print error, args
+
+class QueuePurge(CuminConfirmForm):
+ def get_title(self, session, queue):
+ return "Purge Queue '%s'" % queue.name
+
+ def process_cancel(self, session, queue):
+ branch = session.branch()
+ self.page().show_queue(branch, queue).show_view(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def process_submit(self, session, queue):
+ print "open purge"
+
+ queue.mintVhost.mintBroker.echo(self.app.mint, doit, 1, "dude!")
+
+ print "close purge"
+
+ self.process_cancel(session, queue)
+
+ def render_submit_content(self, session, queue):
+ return "Yes, Purge Queue '%s'" % queue.name
+
+ def render_cancel_content(self, session, queue):
+ return "No, Cancel"
+
class QueueBindingAdd(CuminForm):
def __init__(self, app, name):
super(QueueBindingAdd, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-15 19:52:03 UTC (rev 1320)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-15 20:57:45 UTC (rev 1321)
@@ -179,7 +179,7 @@
<tr>
<th class="actions" colspan="2">
<h2>Act on This Queue:</h2>
- <a href="{href}">Purge Messages</a>
+ <a href="{purge_href}">Purge Messages</a>
</th>
</tr>
</table>
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2007-11-15 19:52:03 UTC (rev 1320)
+++ mgmt/cumin/python/cumin/widgets.strings 2007-11-15 20:57:45 UTC (rev 1321)
@@ -4,7 +4,7 @@
<h1>{title}</h1>
</div>
<div class="body">
- <div>{confirm}</div>
+ <div>{submit}</div>
<div>{cancel}</div>
{hidden_inputs}
</div>