Author: justi9
Date: 2009-03-27 16:51:17 -0400 (Fri, 27 Mar 2009)
New Revision: 3235
Modified:
mgmt/trunk/cumin/python/cumin/action.strings
mgmt/trunk/cumin/python/cumin/broker.py
mgmt/trunk/cumin/python/cumin/broker.strings
mgmt/trunk/cumin/python/cumin/brokerlink.py
mgmt/trunk/cumin/python/cumin/brokerlink.strings
mgmt/trunk/cumin/python/cumin/client.py
mgmt/trunk/cumin/python/cumin/client.strings
mgmt/trunk/cumin/python/cumin/collector.py
mgmt/trunk/cumin/python/cumin/collector.strings
mgmt/trunk/cumin/python/cumin/exchange.py
mgmt/trunk/cumin/python/cumin/exchange.strings
mgmt/trunk/cumin/python/cumin/negotiator.strings
mgmt/trunk/cumin/python/cumin/page.py
mgmt/trunk/cumin/python/cumin/page.strings
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/pool.strings
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/cumin/queue.strings
mgmt/trunk/cumin/python/cumin/scheduler.py
mgmt/trunk/cumin/python/cumin/scheduler.strings
mgmt/trunk/cumin/python/cumin/stat.strings
mgmt/trunk/cumin/python/cumin/submitter.py
mgmt/trunk/cumin/python/cumin/submitter.strings
mgmt/trunk/cumin/python/cumin/system.py
mgmt/trunk/cumin/python/cumin/system.strings
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/cumin/python/cumin/widgets.strings
mgmt/trunk/wooly/python/wooly/pages.strings
mgmt/trunk/wooly/resources/wooly.js
Log:
Switch the custom ajax update code to use the generic widget update
approach instead.
Remove the old setIntervalUpdate and rename newSetIntervalUpdate.
Modified: mgmt/trunk/cumin/python/cumin/action.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/action.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/action.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -11,10 +11,18 @@
<tbody>{items}</tbody>
</table>
+[ActionInvocationStatus.javascript]
+(function() {
+ cumin.popupActions = function() {
+ window.open("actions.html", "actions",
+ "width=640,height=480,scrollbars=yes");
+ }
+}())
+
[ActionInvocationStatus.html]
<span id="{id}">
Actions:
- <a href="javascript:popupActions()">
+ <a href="javascript:cumin.popupActions()">
<span>{pending_count}</span> pending,
<span>{completed_count}</span> completed,
<span>{failed_count}</span> failed
Modified: mgmt/trunk/cumin/python/cumin/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/broker.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -197,15 +197,12 @@
class ConnectedAttribute(Attribute):
def get_default(self, session):
- # XXXX this should be done with heartbeats instead?
- return False
-
- reg = self.widget.frame.get_object(session)
connected = False
+ broker = self.widget.frame.get_object(session)
try:
- mbroker = self.app.model.data.mintBrokersByUrl[reg.url]
-
+ id = broker.qmfBrokerId
+ mbroker = self.app.model.data.mintBrokersById[id]
connected = mbroker.connected
except KeyError:
pass
@@ -233,11 +230,6 @@
tabs.add_tab(BrokerClustering(app, "cluster", self.vhost))
tabs.add_tab(self.BrokerDetailsTab(app, "details", self.vhost))
- def render_script(self, session, object):
- broker = self.vhost.get(session).broker
- data = "model.xml?class=broker;id=%i" % broker.id
- return "wooly.setIntervalUpdate('%s', updateBroker, 3000)" %
data
-
def render_group_links(self, session, object):
return "XXX"
Modified: mgmt/trunk/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/broker.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -62,48 +62,6 @@
from broker as b
{sql_where}
-[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();
-}
-
-
-[BrokerMissing.html]
-<div class="notice">
- 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 type="text/javascript">
-//<![CDATA[
-var secs = 10
-
-function updateTimer() {
- secs -= 1;
-
- count = wooly.doc().elembyid("timer_count").set("" + secs);
- ending = wooly.doc().elembyid("timer_word").set(secs == 1 ?
"second" : "seconds");
-
- if (secs < 1) {
- location.reload();
- }
-}
-
-window.setInterval(updateTimer, 1000);
-//]]>
-</script>
-
[BrokerQueueTab.html]
{items}
@@ -123,25 +81,12 @@
</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>
<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/brokerlink.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerlink.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/brokerlink.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -273,7 +273,6 @@
return "No, Cancel"
class PeerStatus(CuminStatus):
-
def render_color(self, session, link):
if link.statsCurr:
return link.statsCurr.lastError and "red" or "green"
@@ -306,10 +305,6 @@
def show_routes(self, session):
return self.__tabs.show_mode(session, self.__routes);
- def render_script(self, session, peer):
- data = "model.xml?class=peer;id=%i" % peer.id
- return "wooly.setIntervalUpdate('%s', updatePeer, 3000)" %
data
-
class PeerStats(TabbedModeSet):
def __init__(self, app, name):
super(PeerStats, self).__init__(app, name)
@@ -391,7 +386,6 @@
def render_title(self, session):
return "Choose an Exchange"
-
class BridgeAddForm(CuminFieldForm):
def __init__(self, app, name):
super(BridgeAddForm, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/brokerlink.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerlink.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/brokerlink.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -46,34 +46,6 @@
<div>{hidden_inputs}</div>
</form>
-[PeerView.javascript]
-function updatePeer(data) {
- var model = data.objectify();
- var peers = model.peer;
- var peer;
-
- for (var key in peers) {
- peer = peers[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(peer);
-
- //throw new Error();
-}
-[PeerView.html]
-<script type="text/javascript">
-{script}
-</script>
-
-{status}
-
-{summary}
-
-{tabs}
-
-
[PeerRouteSet.sql]
select
b.id,
Modified: mgmt/trunk/cumin/python/cumin/client.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/client.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/client.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -259,10 +259,6 @@
def show_sessions(self, session):
return self.__tabs.show_mode(session, self.__sessions)
- def render_script(self, session, conn):
- data = "model.xml?class=connection;id=%i" % conn.id
- return "wooly.setIntervalUpdate('%s', updateConnection, 3000)"
% data
-
class ConnectionStats(Widget):
def __init__(self, app, name):
super(ConnectionStats, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/client.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/client.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/client.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -57,22 +57,6 @@
<div>{hidden_inputs}</div>
</form>
-[ConnectionStatus.javascript]
-function updateConnectionStatus(id, conn) {
- updateStatus(id, conn);
-
- var s = conn.stat;
- var sdata = {
- "tr": [
- null,
- {"td": [s.framesFromClient.rate, s.bytesFromClient.rate]},
- {"td": [s.framesToClient.rate, s.bytesToClient.rate]}
- ]
- };
-
- wooly.doc().elembyid(id).descendant("table.tbody").update(sdata);
-}
-
[ConnectionStatus.html]
<div id="{id}" class="CuminStatus {color}">
<table>
@@ -93,25 +77,7 @@
</tr>
</table>
</div>
-<script type="text/javascript">
- cumin.objectListeners["{id}"] = updateConnectionStatus, 3000;
-</script>
-[ConnectionView.javascript]
-function updateConnection(data) {
- var model = data.objectify();
- var conns = model.connection;
- var conn;
-
- for (var key in conns) {
- conn = conns[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(conn);
-}
-
[ConnectionStats.html]
<table class="twocol">
<tbody>
Modified: mgmt/trunk/cumin/python/cumin/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/collector.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -121,10 +121,6 @@
details = CuminDetails(app, "details")
self.__tabs.add_tab(details)
- def render_script(self, session, coll):
- data = "model.xml?class=collector;id=%i" % coll.id
- return "wooly.setIntervalUpdate('%s', updateCollector, 3000)" %
data
-
class CollectorStatus(CuminStatus):
def render_title(self, session, object):
return "Collector Status"
Modified: mgmt/trunk/cumin/python/cumin/collector.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/collector.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -16,23 +16,6 @@
left outer join collector_stats as cs on cs.id = c.stats_curr_id
{sql_where}
-[CollectorView.javascript]
-function updateCollector(data) {
- var model = data.objectify();
- var colls = model.collector;
- var col;
-
- for (var key in colls) {
- col = colls[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(col);
-
- //throw new Error();
-}
-
[CollectorSet.html]
<form id="{id}" method="post" action="?">
<div class="sactions">
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -284,10 +284,6 @@
def show_bindings(self, session):
return self.__tabs.show_mode(session, self.__bindings);
- def render_script(self, session, exchange):
- data = "model.xml?class=exchange;id=%i" % exchange.id
- return "wooly.setIntervalUpdate('%s', updateExchange, 3000)" %
data
-
class ExchangeBindingSet(BindingSet, Form):
def __init__(self, app, name):
super(ExchangeBindingSet, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/exchange.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -79,23 +79,6 @@
[ExchangeSet.item_html]
<tr>{cells}</tr>
-[ExchangeStatus.javascript]
-function updateExchangeStatus(id, exchange) {
- updateStatus(id, exchange);
-
- var s = exchange.stat;
- var sdata = {
- "tr": [
- null,
- {"td": [s.msgReceives.rate, s.byteReceives.rate]},
- {"td": [s.msgRoutes.rate, s.byteRoutes.rate]},
- {"td": [s.msgDrops.value, s.byteDrops.value]}
- ]
- };
-
- wooly.doc().elembyid(id).descendant("table.tbody").update(sdata);
-}
-
[ExchangeStatus.html]
<div id="{id}" class="CuminStatus {color}">
<table>
@@ -121,49 +104,31 @@
</tr>
</table>
</div>
-<script type="text/javascript">
- cumin.objectListeners["{id}"] = updateExchangeStatus
-</script>
-[ExchangeView.javascript]
-function updateExchange(data) {
- var model = data.objectify();
- var exchanges = model.exchange;
- var exchange;
-
- for (var key in exchanges) {
- exchange = exchanges[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(exchange);
-}
-
[ExchangeBindingSet.html]
<form id="{id}" method="post" action="?">
- <div class="rfloat">{phase}</div>
- <ul class="radiotabs"><li> </li></ul>
+ <div class="rfloat">{phase}</div>
+ <ul class="radiotabs"><li> </li></ul>
- <div class="sactions">
- <h2>Act on Selected Bindings:</h2>
- {remove}
- </div>
+ <div class="sactions">
+ <h2>Act on Selected Bindings:</h2>
+ {remove}
+ </div>
- <table class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
+ <table class="mobjects">
+ <thead>
+ <tr>
+ <th class="setnav" colspan="{column_count}">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
+ </tr>
+ <tr>{headers}</tr>
+ </thead>
+ <tbody>{items}</tbody>
+ </table>
+ <div>{hidden_inputs}</div>
</form>
[ExchangeBindingSet.item_html]
Modified: mgmt/trunk/cumin/python/cumin/negotiator.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/negotiator.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -16,23 +16,6 @@
left outer join negotiator_stats as c on c.id = n.stats_curr_id
{sql_where}
-[NegotiatorView.javascript]
-function updateNegotiator(data) {
- var model = data.objectify();
- var colls = model.negotiator;
- var col;
-
- for (var key in colls) {
- col = colls[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(col);
-
- //throw new Error();
-}
-
[NegotiatorSet.html]
<form id="{id}" method="post" action="?">
Modified: mgmt/trunk/cumin/python/cumin/page.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/page.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -261,9 +261,6 @@
self.frame.change_password.show(branch)
return branch.marshal()
- def render_data_url(self, session):
- return "model.xml"
-
class Heading(CuminHeading):
def render_title(self, session):
return "MRG Management"
@@ -343,9 +340,6 @@
#self.add_tab(BrokerProfileSet(app, "profiles"))
#self.add_tab(BrokerClusterSet(app, "clusters"))
- def render_data_url(self, session):
- return "model.xml"
-
class Heading(CuminHeading):
def render_title(self, session):
return "Messaging"
@@ -362,9 +356,6 @@
self.add_tab(PoolSet(app, "pools"))
- def render_data_url(self, session):
- return "model.xml"
-
class Heading(CuminHeading):
def render_title(self, session):
return "Grid"
@@ -381,9 +372,6 @@
self.add_tab(SystemSet(app, "systems"))
- def render_data_url(self, session):
- return "model.xml"
-
class Heading(CuminHeading):
def render_title(self, session):
return "Systems"
Modified: mgmt/trunk/cumin/python/cumin/page.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/page.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -107,12 +107,6 @@
border-bottom: 1px solid #ddd;
}
-[MainFrame.javascript]
-function popupActions() {
- window.open("actions.html", "actions",
- "width=640,height=480,scrollbars=yes");
-}
-
[MainFrame.html]
<div id="trans0"/>
<div id="head">
@@ -223,11 +217,6 @@
</ul>
[MessagingView.html]
-<script type="text/javascript">
-//<![CDATA[
- wooly.setIntervalUpdate("{data_url}", updateMain, 3000);
-//]]>
-</script>
<div class="oblock">
{heading}
@@ -236,11 +225,6 @@
</div>
[GridView.html]
-<script type="text/javascript">
-//<![CDATA[
- wooly.setIntervalUpdate("{data_url}", updateMain, 3000);
-//]]>
-</script>
<div class="oblock">
{heading}
@@ -249,11 +233,6 @@
</div>
[SystemsView.html]
-<script type="text/javascript">
-//<![CDATA[
- wooly.setIntervalUpdate("{data_url}", updateMain, 3000);
-//]]>
-</script>
<div class="oblock">
{heading}
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -197,10 +197,6 @@
class LimitsTab(LimitsSet):
pass
- def render_script(self, session, pool):
- data = "model.xml?class=pool;id=%s" % pool.id
- return "wooly.setIntervalUpdate('%s', updatePool, 4000)" %
data
-
def set_collector_tab(self, session):
self.__tabs.set_selected_mode(session, self.colls)
Modified: mgmt/trunk/cumin/python/cumin/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/pool.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -18,12 +18,12 @@
[PoolJobStats.sql]
select
- sum( case when job_status=2 then 1 else 0 end) as running,
- sum( case when job_status=4 then 1 else 0 end) as completed,
- sum( case when job_status=5 then 1 else 0 end) as held,
- sum( case when job_status=1 and j.qmf_delete_time is null then 1 else 0 end) as idle,
- sum( case when job_status=3 or (job_status=1 and j.qmf_delete_time is not null) then 1
else 0 end) as removed,
- sum( 1 ) as total,
+ sum(case when job_status=2 then 1 else 0 end) as running,
+ sum(case when job_status=4 then 1 else 0 end) as completed,
+ sum(case when job_status=5 then 1 else 0 end) as held,
+ sum(case when job_status=1 and j.qmf_delete_time is null then 1 else 0 end) as idle,
+ sum(case when job_status=3 or (job_status=1 and j.qmf_delete_time is not null) then 1
else 0 end) as removed,
+ sum(1) as total,
s.pool
from job as j
left outer join scheduler as s on s.id = j.scheduler_id
@@ -33,53 +33,12 @@
[PoolJobStats.count_sql]
1
-[PoolView.javascript]
-function updatePool(data) {
- var model = data.objectify();
- var pools = model.pool;
- var pool;
-
- for (var key in pools) {
- pool = pools[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(pool);
-
- //throw new Error();
-}
-
-
-[PoolStatus.javascript]
-var pool_stats_last_all = "";
-
-function updatePoolStatus(id, pool) {
- var s = pool.stat;
- var sdata = {"div": {"span": [s.idl.value, s.all.value]}};
-
- wooly.doc().elembyid(id).update(sdata);
-
- if (pool_stats_last_all != "") {
- if (s.all.value != pool_stats_last_all) {
- window.location.reload(true);
- }
- }
-
- pool_stats_last_all = s.all.value;
-}
-
[PoolStatus.html]
<div id="{id}" class="CuminStatus {color}">
<h2>{title}</h2>
{status}
</div>
-<script type="text/javascript">
- //<![CDATA[
- cumin.objectListeners["{id}"] = updatePoolStatus;
-//]]>
-</script>
[PoolStatus.status_html]
<div>
@@ -94,6 +53,6 @@
</div>
</div>
<div style="float: left; margin-left: 4em;">
- {pool_slot_map}
+ {pool_slot_map}
</div>
<div style="clear:left;"><!-- --></div>
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -300,10 +300,6 @@
def show_bindings(self, session):
self.__tabs.show_mode(session, self.bindings);
- def render_script(self, session, queue):
- data = "model.xml?class=queue;id=%i" % queue.id
- return "wooly.setIntervalUpdate('%s', updateQueue, 3000)" %
data
-
class QueueBindingSet(BindingSet, Form):
def __init__(self, app, name):
super(QueueBindingSet, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/queue.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -79,23 +79,6 @@
[TopQueueSet.count_sql]
--
-[QueueStatus.javascript]
-function updateQueueStatus(id, queue) {
- updateStatus(id, queue);
-
- var s = queue.stat;
- var sdata = {
- "tr": [
- null,
- {"td": [s.msgTotalEnqueues.rate, s.byteTotalEnqueues.rate]},
- {"td": [s.msgTotalDequeues.rate, s.byteTotalDequeues.rate]},
- {"td": [s.msgDepth.value, s.byteDepth.value]}
- ]
- };
-
- wooly.doc().elembyid(id).descendant("table.tbody").update(sdata);
-}
-
[QueueStatus.html]
<div id="{id}" class="CuminStatus {color}">
<table>
@@ -121,29 +104,7 @@
</tr>
</table>
</div>
-<script type="text/javascript">
-//<![CDATA[
- cumin.objectListeners["{id}"] = updateQueueStatus
-//]]>
-</script>
-[QueueView.javascript]
-function updateQueue(data) {
- var model = data.objectify();
- var queues = model.queue;
- var queue;
-
- for (var key in queues) {
- queue = queues[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(queue);
-
- //throw new Error();
-}
-
[QueueBindingSet.html]
<form id="{id}" method="post" action="?">
<div class="rfloat">{phase}</div>
Modified: mgmt/trunk/cumin/python/cumin/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/scheduler.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -140,10 +140,6 @@
details = CuminDetails(app, "details")
self.__tabs.add_tab(details)
- def render_script(self, session, sched):
- data = "model.xml?class=scheduler;id=%i" % sched.id
- return "wooly.setIntervalUpdate('%s', updateScheduler, 3000)" %
data
-
class SchedulerStatus(StartStopStatus):
def get_url(self, session):
scheduler = self.get_args(session)[0]
Modified: mgmt/trunk/cumin/python/cumin/scheduler.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/scheduler.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -18,23 +18,6 @@
select count(1) from scheduler as s
{sql_where}
-[SchedulerView.javascript]
-function updateScheduler(data) {
- var model = data.objectify();
- var scheds = model.scheduler;
- var sched;
-
- for (var key in scheds) {
- sched = scheds[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(sched);
-
- //throw new Error();
-}
-
[SchedulerSet.html]
<form id="{id}" method="post" action="?">
<div class="sactions">
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -54,39 +54,31 @@
</tr>
[StatValueChart.javascript]
-function updateChart(id, object) {
- var chart = wooly.doc().elembyid(id);
+(function() {
+ function refreshTime(src) {
+ var sep = src.lastIndexOf(";");
+ var time = new Date().getTime();
- var img = chart.elem("img")
- var src = img.getattr("src");
- src = refreshTime(src);
+ if (isNaN(parseInt(src.substring(sep + 1)))) {
+ src = src + ";" + time;
+ } else {
+ src = src.substring(0, sep) + ";" + time;
+ }
- img.setattr("src", src);
-
-/*
- var ph = chart.elem("span", "class", "ph")
- var statname = ph.getattr("statname")
- var statmode = ph.getattr("statmode")
- if (statmode == "rate") {
- ph.text().set(object.stat[statname].rate)
- } else {
- ph.text().set(object.stat[statname].value)
+ return src;
}
-*/
-}
-function refreshTime(src) {
- var sep = src.lastIndexOf(";");
- var time = new Date().getTime();
- if (isNaN(parseInt(src.substring(sep + 1)))) {
- src = src + ";" + time;
- } else {
- src = src.substring(0, sep) + ";" + time;
- }
+ cumin.updateChart = function(id) {
+ var chart = wooly.doc().elembyid(id);
- return src;
-}
+ var img = chart.elem("img")
+ var src = img.getattr("src");
+ src = refreshTime(src);
+ img.setattr("src", src);
+ }
+}())
+
[StatValueChart.css]
div.StatValueChart {
font-size: 0.9em;
@@ -115,7 +107,13 @@
<img id="{id}" src="{href}" height="100"
width="360" alt="stats" />
</div>
<script type="text/javascript">
- cumin.objectListeners["{id}"] = updateChart
+(function() {
+ function update() {
+ cumin.updateChart("{id}");
+ }
+
+ wooly.addPageUpdateListener(update);
+}())
</script>
[StatValueChart.stat_html]
Modified: mgmt/trunk/cumin/python/cumin/submitter.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/submitter.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/submitter.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -67,10 +67,6 @@
details = CuminDetails(app, "details")
self.__tabs.add_tab(details)
- def render_script(self, session, sched):
- data = "model.xml?class=submitter;id=%i" % sched.id
- return "wooly.setIntervalUpdate('%s', updateSubmitter, 3000)" %
data
-
class SubmitterStatus(CuminStatus):
def render_title(self, session, submitter):
return "Submitter Status"
Modified: mgmt/trunk/cumin/python/cumin/submitter.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/submitter.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/submitter.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -13,23 +13,6 @@
inner join scheduler as d on s.scheduler_id = d.id
{sql_where}
-[SubmitterView.javascript]
-function updateSubmitter(data) {
- var model = data.objectify();
- var subs = model.submitter;
- var sub;
-
- for (var key in subs) {
- sub = subs[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(sub);
-
- //throw new Error();
-}
-
[SubmitterStats.html]
<table class="twocol">
<tbody>
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/system.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -177,10 +177,6 @@
self.__tabs.add_tab(SystemServices(app, "services"))
self.__tabs.add_tab(CuminDetails(app, "details"))
- def render_script(self, session, system):
- data = "model.xml?class=system;id=%i" % system.id
- return "wooly.setIntervalUpdate('%s', updateSystem, 3000)" %
data
-
from job import JobTab
class SystemJobSet(JobTab):
Modified: mgmt/trunk/cumin/python/cumin/system.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/system.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -46,21 +46,6 @@
[TopSystemSet.count_sql]
--
-[SystemStatus.javascript]
-function updateSystemStatus(id, system) {
- updateStatus(id, system);
-
- var s = system.stat;
- var sdata = {
- "tr": [
- {"td": [s.memFree.value]},
- {"td": [s.loadAverage1Min.value]}
- ]
- };
-
- wooly.doc().elembyid(id).descendant("table.tbody").update(sdata);
-}
-
[SystemStatus.html]
<div id="{id}" class="CuminStatus {color}">
<table>
@@ -74,67 +59,48 @@
</tr>
</table>
</div>
-<script type="text/javascript">
- cumin.objectListeners["{id}"] = updateSystemStatus
-</script>
[SystemStats.html]
<table class="twocol">
<tbody>
- <tr>
- <td>
- <h2>Memory/Load</h2>
+ <tr>
+ <td>
+ <h2>Memory/Load</h2>
{stats}
-
{system_slot_map}
- </td>
- <td>
- {freemem}
- {loadavg}
- </td>
- </tr>
+ </td>
+ <td>
+ {freemem}
+ {loadavg}
+ </td>
+ </tr>
</tbody>
</table>
<script type="text/javascript">
-var show_slot_job_url = "{slot_job_url}";
+ // <![CDATA[
+ var show_slot_job_url = "{slot_job_url}";
+ // ]]>
</script>
-[SystemView.javascript]
-function updateSystem(data) {
- var model = data.objectify();
- var systems = model.system;
- var system;
-
- for (var key in systems) {
- system = systems[key];
- break;
- }
-
- cumin.runModelListeners(model);
- cumin.runObjectListeners(system);
-}
-
-
[SystemJobSet.html]
- <div class="rfloat">{phase}</div>
-<form id="{id}" style="clear:right;" method="post"
action="?">
+<div class="rfloat">{phase}</div>
- <table class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
+<form id="{id}" style="clear:right;" method="post"
action="?">
+ <table class="mobjects">
+ <thead>
+ <tr>
+ <th class="setnav" colspan="{column_count}">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
+ </tr>
+ <tr>{headers}</tr>
+ </thead>
+ <tbody>{items}</tbody>
+ </table>
+ <div>{hidden_inputs}</div>
</form>
-
[SystemServices.html]
<h2>Services</h2>
<table class="PropertySet">
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2009-03-27 20:51:17 UTC (rev 3235)
@@ -292,6 +292,11 @@
return self.ids.get(session)
class CuminStatus(Widget):
+ def __init__(self, app, name):
+ super(CuminStatus, self).__init__(app, name)
+
+ self.update_enabled = True
+
def get_args(self, session):
return self.frame.get_args(session)
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -18,10 +18,6 @@
[CuminView.html]
-<script type="text/javascript">
-{script}
-</script>
-
{status}
{summary}
@@ -119,37 +115,6 @@
[CuminBulkActionForm.item_html]
<li>{item_content}</li>
-[CuminStatus.javascript]
-function updateStatus(id, object) {
- var status = wooly.doc().elembyid(id);
- /*
- var ecount = object.events.errors
- var errors = ecount + " " + (ecount == "1" &&
"error" || "errors");
-
- var wcount = object.events.warnings
- var warnings = wcount + " " + (wcount == "1" &&
"warning" || "warnings");
-
- if (ecount != "0") {
- status.setattr("class", "CuminStatus red");
- } else if (wcount != "0") {
- status.setattr("class", "CuminStatus yellow");
- } else {
- status.setattr("class", "CuminStatus green");
- }
- */
-
- /*
- var divs = status.elems("div", null, null, 0, 2)
-
- divs.next().set(errors + ", " + warnings);
-
- var acount = object.actions.pending;
- var actions = acount + " " + (acount == "1" &&
"action" || "actions") + " pending";
-
- divs.next().set(actions);
- */
-}
-
[CuminStatus.css]
div.CuminStatus {
float: right;
Modified: mgmt/trunk/wooly/python/wooly/pages.strings
===================================================================
--- mgmt/trunk/wooly/python/wooly/pages.strings 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/wooly/python/wooly/pages.strings 2009-03-27 20:51:17 UTC (rev 3235)
@@ -26,7 +26,7 @@
[UpdateScript.html]
<script type="text/javascript">
// <![CDATA[
- wooly.newSetIntervalUpdate('{url}', wooly.updatePage, 3000);
+ wooly.setIntervalUpdate('{url}', wooly.updatePage, 3000);
// ]]>
</script>
Modified: mgmt/trunk/wooly/resources/wooly.js
===================================================================
--- mgmt/trunk/wooly/resources/wooly.js 2009-03-27 17:10:46 UTC (rev 3234)
+++ mgmt/trunk/wooly/resources/wooly.js 2009-03-27 20:51:17 UTC (rev 3235)
@@ -198,31 +198,6 @@
}
}
- function updatePage(xml) {
- var child = xml.documentElement.firstChild;
-
- while (child) {
- if (child.nodeType == 1 && child.nodeName == "widget") {
- var id = child.getAttribute("id");
- var oldElem = document.getElementById(id);
-
- if (oldElem) {
- var newElem = child.firstChild;
-
- if (newElem.nodeType != 1) {
- newElem = newElem.nextSibling;
- }
-
- replaceNode(newElem, oldElem);
- } else {
- wooly.log("Element '" + id + "' not
found");
- }
- }
-
- child = child.nextSibling;
- }
- }
-
var damnyouie = /msie/i.test(navigator.userAgent) &&
!/opera/i.test(navigator.userAgent);
function replaceNode(newNode, oldNode) {
@@ -303,13 +278,52 @@
this.log = log;
this.dir = dir;
- this.getNewRequest = getNewRequest
- this.updatePage = updatePage
-
this.updaterIDs = [];
this.session = new Session();
-
- // pass the responseXML directly back to function
+
+ this.getNewRequest = getNewRequest
+
+ // Updates
+
+ this.pageUpdateListeners = new Array();
+
+ this.addPageUpdateListener = function(listener) {
+ this.pageUpdateListeners.push(listener);
+ }
+
+ this.updatePage = function(xml) {
+ var child = xml.documentElement.firstChild;
+
+ while (child) {
+ if (child.nodeType == 1 && child.nodeName == "widget")
{
+ var id = child.getAttribute("id");
+ var oldElem = document.getElementById(id);
+
+ if (oldElem) {
+ var newElem = child.firstChild;
+
+ if (newElem.nodeType != 1) {
+ newElem = newElem.nextSibling;
+ }
+
+ replaceNode(newElem, oldElem);
+ } else {
+ wooly.log("Element '" + id + "' not
found");
+ }
+ }
+
+ child = child.nextSibling;
+ }
+
+ var len = wooly.pageUpdateListeners.length;
+
+ for (var i = 0; i < len; i++) {
+ wooly.pageUpdateListeners[i]();
+ }
+ }
+
+ // pass the responseXML directly back to function
+
this.directUpdate = function(url, callback, interval, passback) {
var req = this.getNewRequest();
@@ -322,9 +336,9 @@
if (interval > 0) {
var id = window.setInterval(fetch, interval);
this.updater_ids.push(id);
- }
+ }
fetch(); // send request immediately
-
+
function update() {
try {
if (req.readyState == 4 && req.status == 200) {
@@ -358,44 +372,14 @@
}
}
- this.setIntervalUpdate = function(url, callback, interval) {
- var req = this.getNewRequest();
-
- function fetch() {
- req.open("get", url, true);
- req.onreadystatechange = update;
- req.send(null);
- }
-
- var id = window.setInterval(fetch, interval);
-
- this.updaterIDs.push(id);
-
- function update() {
- try {
- if (req.readyState == 4 && req.status == 200) {
- //dir(req);
-
- callback(wooly.doc(req.responseXML));
- }
- } catch (e) {
- log(e);
- // XXX might want to retry for a bit before we do
- // this
- window.clearInterval(id);
- throw e;
- }
- }
- }
-
this.intervalUpdateInfo = {
timerId: 0,
url: "",
callback: "",
interval: 0
};
- this.newSetIntervalUpdate = function(url, callback, interval) {
-
+
+ this.setIntervalUpdate = function(url, callback, interval) {
var req = this.getNewRequest();
// save the arguments in case we need to modify the url
@@ -449,7 +433,7 @@
this.cancelIntervalUpdate();
this.newSetIntervalUpdate(url, this.intervalUpdateInfo.callback,
this.intervalUpdateInfo.interval);
}
-
+
this.branchIntervalUpdate = function () {
return this.session.branch(this.intervalUpdateInfo.url);
}
@@ -690,7 +674,7 @@
return this;
}
}
-
+
function Session() {
this.branch = function (url) {
if (arguments.length == 0) url = window.location;
@@ -699,7 +683,7 @@
/* convert string query into cumin session object */
function Branch (s) {
-
+
/* convert this branch object to string */
this.marshal = function () {
var nvs = [];
@@ -741,15 +725,15 @@
// find the other nv pairs
var q = (query.length > 1) ? query[1] : s;
$extend(this, parseQuery(q));
-
+
// background updates have another session object under the key
"session"
if (this.session) {
var sess = decodeURIComponent(this.session);
this.session = wooly.session.branch(sess);
}
}
-
- /* convert ; separated string to and object.
+
+ /* convert ; separated string to and object.
supports names with no values and
puts duplicate names into an array */
function parseQuery(s) {
@@ -777,7 +761,5 @@
return obj;
}
}
-
-}())
-
+}())