Author: eallen
Date: 2009-01-08 16:28:26 -0500 (Thu, 08 Jan 2009)
New Revision: 3037
Modified:
mgmt/trunk/cumin/python/cumin/broker.strings
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/pool.strings
Log:
Added ajax update of Broker Status
Modified: mgmt/trunk/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.strings 2009-01-08 15:54:37 UTC (rev 3036)
+++ mgmt/trunk/cumin/python/cumin/broker.strings 2009-01-08 21:28:26 UTC (rev 3037)
@@ -45,10 +45,21 @@
[BrokerView.javascript]
function updateBroker(data) {
var model = data.objectify();
+ var brokers = model.broker;
+ var broker;
+ for (var key in brokers) {
+ broker = brokers[key];
+ break;
+ }
+
cumin.runModelListeners(model);
+ cumin.runObjectListeners(broker);
+
+ //throw new Error();
}
+
[BrokerView.html]
<script type="text/javascript">
<![CDATA[
@@ -105,12 +116,25 @@
</tbody>
</table>
+[BrokerStatus.javascript]
+function updateBrokerStatus(id, broker) {
+ var s = broker.stat;
+ var sdata = {"div": [s.connection.value]};
+
+ wooly.doc().elembyid(id).update(sdata);
+}
+
[BrokerStatus.html]
<div id="{id}" class="CuminStatus {color}">
<h2>Broker Status</h2>
- {status}
+ <div>{status}</div>
</div>
+<script type="text/javascript">
+<![CDATA[
+ cumin.objectListeners["{id}"] = updateBrokerStatus;
+]]>
+</script>
[BrokerStats.html]
<table class="twocol">
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2009-01-08 15:54:37 UTC (rev 3036)
+++ mgmt/trunk/cumin/python/cumin/model.py 2009-01-08 21:28:26 UTC (rev 3037)
@@ -783,6 +783,9 @@
prop = CuminProperty(self, "dataDir")
prop.title = "Data Directory"
+ stat = self.StatusStat(self, "connection")
+ stat.category = "status"
+
action = self.AddExchange(self, "add_exchange")
action.summary = True
@@ -805,6 +808,24 @@
def get_object_name(self, broker):
return broker.id
+ class StatusStat(CuminStat):
+ def value_text(self, broker):
+ connected = False
+ if broker:
+ try:
+ mbroker = self.model.data.mintBrokersById[broker.qmfBrokerId]
+ connected = mbroker.connected
+ except KeyError:
+ pass
+
+ if connected:
+ return "Connected"
+ else:
+ return "Disconnected"
+
+ def rate_text(self, record):
+ return ""
+
class AddExchange(CuminAction):
MSG_SEQUENCE = "qpid.msg_sequence"
IVE = "qpid.ive"
Modified: mgmt/trunk/cumin/python/cumin/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.strings 2009-01-08 15:54:37 UTC (rev 3036)
+++ mgmt/trunk/cumin/python/cumin/pool.strings 2009-01-08 21:28:26 UTC (rev 3037)
@@ -57,7 +57,7 @@
function updatePoolStatus(id, pool) {
var s = pool.stat;
- var sdata = {"div": {"span": [s.active.value, s.all.value]}};
+ var sdata = {"div": {"span": [s.idl.value, s.all.value]}};
wooly.doc().elembyid(id).update(sdata);
if (pool_stats_last_all != "") {