Author: eallen
Date: 2008-07-25 15:23:16 -0400 (Fri, 25 Jul 2008)
New Revision: 2220
Modified:
mgmt/trunk/cumin/python/cumin/broker.py
mgmt/trunk/cumin/python/cumin/broker.strings
Log:
Moved PeerSet to brokerlink.py
Added Add/Remove Queue
Added Add Exchange
Added Peer Mode
Modified: mgmt/trunk/cumin/python/cumin/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.py 2008-07-25 19:13:11 UTC (rev 2219)
+++ mgmt/trunk/cumin/python/cumin/broker.py 2008-07-25 19:23:16 UTC (rev 2220)
@@ -8,6 +8,7 @@
from virtualhost import *
from queue import *
from exchange import *
+from brokerlink import *
from client import *
from widgets import *
from parameters import *
@@ -121,72 +122,6 @@
return link
-class PeerSet(CuminTable):
- def __init__(self, app, name):
- super(PeerSet, self).__init__(app, name)
-
- col = self.AddressColumn(app, "addr")
- self.add_column(col)
-
- col = self.StateColumn(app, "state")
- self.add_column(col)
-
- col = self.LastErrorColumn(app, "last_error")
- self.add_column(col)
-
- #col = self.FromPeerColumn(app, "from_peer")
- #self.add_column(col)
-
- #col = self.ToPeerColumn(app, "to_peer")
- #self.add_column(col)
-
- def get_args(self, session):
- reg = self.frame.get_object(session)
- return (reg.getDefaultVhost(),)
-
- def render_title(self, session, vhost):
- count = self.get_item_count(session, vhost)
- return "Linked Brokers %s" % fmt_count(count)
-
- def render_sql_where(self, session, vhost):
- return "where v.id = %(vhost_id)r"
-
- def get_sql_values(self, session, vhost):
- return {"vhost_id": vhost.id}
-
- class AddressColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Address"
-
- def render_content(self, session, data):
- return "%s:%i" % (data["host"], data["port"])
-
- def get_orderby_sql(self, session):
- dir = self.parent.is_reversed(session) and "desc" or
"asc"
- return "order by host, port %s" % dir
-
- class StateColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "State"
-
- class LastErrorColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Last Error"
-
- class FromPeerColumn(NullSortColumn, FreshDataOnlyColumn):
- def render_title(self, session, data):
- return "Bytes from Broker"
-
- def render_value(self, session, value):
- return fmt_rate(value)
-
- class ToPeerColumn(NullSortColumn, FreshDataOnlyColumn):
- def render_title(self, session, data):
- return "Bytes to Broker"
-
- def render_value(self, session, value):
- return fmt_rate(value)
-
class BrokerFrame(CuminFrame):
def __init__(self, app, name):
super(BrokerFrame, self).__init__(app, name)
@@ -211,10 +146,22 @@
self.__queues_purge = QueueSetPurge(app, "queuespurge")
self.add_mode(self.__queues_purge)
+
+ self.__queues_remove = QueueSetRemove(app, "queuesremove")
+ self.add_mode(self.__queues_remove)
+
+ self.__queue_add = QueueAdd(app, "queueadd")
+ self.add_mode(self.__queue_add)
self.__exchange = ExchangeFrame(app, "exchange")
self.add_mode(self.__exchange)
+ self.__peer = PeerFrame(app, "peer")
+ self.add_mode(self.__peer)
+
+ self.__exchange_add = ExchangeAdd(app, "exchangeadd")
+ self.add_mode(self.__exchange_add)
+
self.__conn = ConnectionFrame(app, "conn")
self.add_mode(self.__conn)
@@ -229,12 +176,27 @@
def show_queues_purge(self, session):
self.page.set_current_frame(session, self.__queues_purge)
return self.show_mode(session, self.__queues_purge)
+
+ def show_queues_remove(self, session):
+ self.page.set_current_frame(session, self.__queues_remove)
+ return self.show_mode(session, self.__queues_remove)
+
+ def show_queue_add(self, session):
+ return self.show_mode(session, self.__queue_add)
def show_exchange(self, session, exchange):
self.__exchange.set_object(session, exchange)
self.page.set_current_frame(session, self.__exchange)
return self.show_mode(session, self.__exchange)
+ def show_peer(self, session, peer):
+ self.__peer.set_object(session, peer)
+ self.page.set_current_frame(session, self.__peer)
+ return self.show_mode(session, self.__peer)
+
+ def show_exchange_add(self, session):
+ return self.show_mode(session, self.__exchange_add)
+
def show_connection(self, session, conn):
self.__conn.set_object(session, conn)
self.page.set_current_frame(session, self.__conn)
Modified: mgmt/trunk/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.strings 2008-07-25 19:13:11 UTC (rev 2219)
+++ mgmt/trunk/cumin/python/cumin/broker.strings 2008-07-25 19:23:16 UTC (rev 2220)
@@ -36,30 +36,9 @@
</thead>
<tbody>{items}</tbody>
</table>
- {hidden_inputs}
+ <div>{hidden_inputs}</div>
</form>
-[PeerSet.sql]
-select
- l.id,
- l.host,
- l.port,
- c.state,
- c.last_error
-from link as l
-join vhost as v on v.id = l.vhost_id
-left outer join link_stats as c on c.id = l.stats_curr_id
-left outer join link_stats as p on p.id = l.stats_prev_id
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[PeerSet.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();
@@ -68,7 +47,7 @@
}
[BrokerView.html]
-<script>
+<script type="text/javascript">
{script}
</script>
@@ -83,7 +62,7 @@
The broker at this address is currently unavailable. This page will
reload in <span id="timer_count">10</span> <span
id="timer_word">seconds</span>.
</div>
-<script>
+<script type="text/javascript">
var secs = 10
function updateTimer() {
@@ -217,7 +196,7 @@
{cancel}
</div>
</form>
-<script defer="defer">
+<script type="text/javascript" defer="defer">
(function() {
var elem = wooly.doc().elembyid("{id}").node.elements[1];
elem.focus();
@@ -248,6 +227,6 @@
[BrokerGroupInputSet.item_html]
<div class="field">
- <input type="checkbox" name="{name}"
value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
- {item_content}
+ <input type="checkbox" id="{id}" name="{name}"
value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
+ <label for="{id}">{item_content}</label>
</div>