Author: justi9
Date: 2007-11-13 00:13:56 -0500 (Tue, 13 Nov 2007)
New Revision: 1294
Modified:
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/widgets.py
Log:
In preparation for ajaxified list views, adapts model object xml and
their pages to produce xml not just for one object at a time but for
many.
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-11-13 04:13:39 UTC (rev 1293)
+++ mgmt/cumin/python/cumin/client.py 2007-11-13 05:13:56 UTC (rev 1294)
@@ -178,9 +178,13 @@
def __init__(self, app, name):
super(ClientXmlPage, self).__init__(app, name)
- self.client = ClientParameter(app, "id")
- self.add_parameter(self.client)
- self.set_object_parameter(self.client)
+ self.param = ClientParameter(app, "param")
+ self.add_parameter(self.param)
+
+ self.clients = ListParameter(app, "id", self.param)
+ self.add_parameter(self.clients)
+
+ self.set_list_parameter(self.clients)
class ClientChartPage(CuminChartPage):
def __init__(self, app, name):
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2007-11-13 04:13:39 UTC (rev 1293)
+++ mgmt/cumin/python/cumin/client.strings 2007-11-13 05:13:56 UTC (rev 1294)
@@ -78,8 +78,14 @@
[ClientView.javascript]
function updateClient(data) {
- var client = data.root().object();
+ var clients = data.root().object().client;
+ var client;
+ for (var key in clients) {
+ client = clients[key];
+ break;
+ }
+
for (var id in cumin.client.listeners) {
cumin.client.listeners[id](id, client);
}
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-13 04:13:39 UTC (rev 1293)
+++ mgmt/cumin/python/cumin/exchange.py 2007-11-13 05:13:56 UTC (rev 1294)
@@ -393,9 +393,13 @@
def __init__(self, app, name):
super(ExchangeXmlPage, self).__init__(app, name)
- self.exchange = ExchangeParameter(app, "id")
- self.add_parameter(self.exchange)
- self.set_object_parameter(self.exchange)
+ self.param = ExchangeParameter(app, "param")
+ self.add_parameter(self.param)
+
+ self.exchanges = ListParameter(app, "id", self.param)
+ self.add_parameter(self.exchanges)
+
+ self.set_list_parameter(self.exchanges)
class ExchangeChartPage(CuminChartPage):
def __init__(self, app, name):
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-11-13 04:13:39 UTC (rev 1293)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-11-13 05:13:56 UTC (rev 1294)
@@ -135,8 +135,13 @@
[ExchangeView.javascript]
function updateExchange(data) {
- var exchange = data.root().object();
+ var exchanges = data.root().object().exchange;
+ var exchange;
+ for (var key in exchanges) {
+ exchange = exchanges[key];
+ }
+
for (var id in cumin.exchange.listeners) {
cumin.exchange.listeners[id](id, exchange);
}
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-13 04:13:39 UTC (rev 1293)
+++ mgmt/cumin/python/cumin/model.py 2007-11-13 05:13:56 UTC (rev 1294)
@@ -594,17 +594,8 @@
def write_xml(self, writer):
writer.write("<queue id=\"queue-%i\">" % self.id)
writer.write("<name>%s</name>" % self.name)
- writer.write("<latency-priority>%s</latency-priority>" \
- % self.latency_priority)
self.write_error_xml(writer)
-
- for realm in self.realm_items():
- writer.write("<realm ref=\"realm-%i\"/>" %
realm.id)
-
- for binding in self.binding_items():
- binding.write_xml(writer)
-
self.write_measurement_xml(writer)
writer.write("</queue>")
@@ -706,13 +697,6 @@
writer.write("<name>%s</name>" % self.name)
self.write_error_xml(writer)
-
- for realm in self.realm_items():
- writer.write("<realm ref=\"realm-%i\"/>" %
realm.id)
-
- for binding in self.binding_items():
- binding.write_xml(writer)
-
self.write_measurement_xml(writer)
writer.write("</exchange>")
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-13 04:13:39 UTC (rev 1293)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-13 05:13:56 UTC (rev 1294)
@@ -474,10 +474,14 @@
def __init__(self, app, name):
super(QueueXmlPage, self).__init__(app, name)
- self.queue = QueueParameter(app, "id")
- self.add_parameter(self.queue)
- self.set_object_parameter(self.queue)
+ self.param = QueueParameter(app, "param")
+ self.add_parameter(self.param)
+ self.queues = ListParameter(app, "id", self.param)
+ self.add_parameter(self.queues)
+
+ self.set_list_parameter(self.queues)
+
class QueueChartPage(CuminChartPage):
def __init__(self, app, name):
super(QueueChartPage, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-13 04:13:39 UTC (rev 1293)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-13 05:13:56 UTC (rev 1294)
@@ -146,8 +146,14 @@
[QueueView.javascript]
function updateQueue(data) {
- var queue = data.root().object();
+ var queues = data.root().object().queue;
+ var queue;
+ for (var key in queues) {
+ queue = queues[key];
+ break;
+ }
+
for (var id in cumin.queue.listeners) {
cumin.queue.listeners[id](id, queue);
}
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-11-13 04:13:39 UTC (rev 1293)
+++ mgmt/cumin/python/cumin/widgets.py 2007-11-13 05:13:56 UTC (rev 1294)
@@ -178,21 +178,25 @@
self.__param = None
- def set_object_parameter(self, param):
+ def set_list_parameter(self, param):
self.__param = param
- def get_object(self, session, object):
+ def get_object(self, session, objects):
return self.__param.get(session)
def get_content_type(self, session):
return Page.xml_content_type
- def do_render(self, session, object):
+ def do_render(self, session, objects):
writer = Writer()
writer.write(Page.xml_1_0_declaration)
+ writer.write("<objects>");
- object.write_xml(writer)
+ for object in objects:
+ object.write_xml(writer)
+
+ writer.write("</objects>");
return writer.to_string()