[rhmessaging-commits] rhmessaging commits: r1860 - in mgmt: mint/python/mint and 1 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Apr 8 11:36:41 EDT 2008


Author: justi9
Date: 2008-04-08 11:36:41 -0400 (Tue, 08 Apr 2008)
New Revision: 1860

Modified:
   mgmt/cumin/python/cumin/broker.py
   mgmt/cumin/python/cumin/broker.strings
   mgmt/cumin/python/cumin/client.py
   mgmt/cumin/python/cumin/exchange.py
   mgmt/cumin/python/cumin/model.py
   mgmt/cumin/python/cumin/page.py
   mgmt/cumin/python/cumin/page.strings
   mgmt/cumin/python/cumin/parameters.py
   mgmt/cumin/python/cumin/queue.py
   mgmt/cumin/python/cumin/widgets.py
   mgmt/cumin/python/cumin/widgets.strings
   mgmt/mint/python/mint/__init__.py
   mgmt/notes/justin-todo.txt
Log:
Revamps object summaries, using more ui metadata.  Fixes the double
registration problem.  Some changes to broker -> registration
navigation.



Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/broker.py	2008-04-08 15:36:41 UTC (rev 1860)
@@ -85,10 +85,11 @@
             return "Name"
 
         def render_content(self, session, data):
-            broker = Identifiable(data["id"])
+            reg = BrokerRegistration.get(data["id"])
             branch = session.branch()
-            self.app.model.broker.show(branch, broker).show_view(branch)
-            return fmt_olink(branch, broker, name=data["name"])
+            frame = self.app.model.broker_registration.show_object(branch, reg)
+            frame.show_view(branch)
+            return fmt_olink(branch, reg, name=data["name"])
 
     class GroupsColumn(SqlTableColumn):
         def render_title(self, session, data):
@@ -108,7 +109,8 @@
 
                 for group in broker.groups[:2]:
                     branch = session.branch()
-                    frame = self.app.model.broker_group.show(branch, group)
+                    frame = self.app.model.broker_group.show_object \
+                        (branch, group)
                     frame.show_view(branch)
                     links.append(fmt_olink(branch, group))
 
@@ -132,18 +134,17 @@
         self.add_column(col)
 
     def get_args(self, session):
-        return self.frame.get_args(session)
+        reg = self.frame.get_object(session)
+        return (reg.getDefaultVhost(),)
 
-    def render_title(self, session, broker):
-        count = self.get_item_count(session, broker)
+    def render_title(self, session, vhost):
+        count = self.get_item_count(session, vhost)
         return "Peers %s" % fmt_count(count)
 
-    def render_sql_where(self, session, reg):
-        vhost = reg.getDefaultVhost()
+    def render_sql_where(self, session, vhost):
         return "where v.id = %(vhost_id)r"
 
-    def get_sql_values(self, session, reg):
-        vhost = reg.getDefaultVhost()
+    def get_sql_values(self, session, vhost):
         return {"vhost_id": vhost.id}
 
     class AddressColumn(SqlTableColumn):
@@ -168,7 +169,7 @@
     def __init__(self, app, name):
         super(BrokerFrame, self).__init__(app, name)
 
-        self.object = BrokerParameter(app, "id")
+        self.object = BrokerRegistrationParameter(app, "id")
         self.add_parameter(self.object)
 
         view = BrokerView(app, "view")
@@ -246,8 +247,8 @@
         self.__body.add_mode(self.__tabs)
 
         self.__tabs.add_tab(self.BrokerQueueTab(app, "queues"))
-        self.__tabs.add_tab(self.BrokerExchangeTab(app, "exchanges"))
-        self.__tabs.add_tab(self.BrokerClientTab(app, "clients"))
+        self.__tabs.add_tab(ExchangeSet(app, "exchanges"))
+        self.__tabs.add_tab(ClientSet(app, "clients"))
         self.__tabs.add_tab(PeerSet(app, "links"))
 
         self.__missing = self.BrokerMissing(app, "missing")
@@ -267,9 +268,6 @@
 
         super(BrokerView, self).do_process(session, reg)
 
-    def render_title(self, session, reg):
-        return "Broker '%s'" % reg.name
-
     def render_script(self, session, reg):
         if reg.broker:
             data = "model.xml?class=broker;id=%i" % reg.broker.id
@@ -308,24 +306,6 @@
             self.frame.show_queue(branch, None).show_add(branch)
             return branch.marshal()
 
-    class BrokerExchangeTab(ExchangeSet):
-        def get_args(self, session):
-            return self.frame.get_args(session)
-
-        def render_title(self, session, reg):
-            vhost = reg.getDefaultVhost()
-            return super(BrokerView.BrokerExchangeTab, self).render_title \
-                (session, vhost)
-
-    class BrokerClientTab(ClientSet):
-        def get_args(self, session):
-            return self.frame.get_args(session)
-
-        def render_title(self, session, reg):
-            vhost = reg.getDefaultVhost()
-            return super(BrokerView.BrokerClientTab, self).render_title \
-                (session, vhost)
-
     class BrokerStatsTab(Widget):
         def get_args(self, session):
             return self.frame.get_args(session)

Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/broker.strings	2008-04-08 15:36:41 UTC (rev 1860)
@@ -75,8 +75,6 @@
 
 {status}
 
-<h1><img src="resource?name={icon_resource}"/>{title}</h1>
-
 {summary}
 
 {body}

Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/client.py	2008-04-08 15:36:41 UTC (rev 1860)
@@ -43,7 +43,8 @@
         self.add_child(self.__close)
 
     def get_args(self, session):
-        return self.frame.get_args(session)
+        reg = self.frame.get_object(session)
+        return (reg.getDefaultVhost(),)
 
     def get_unit_plural(self, session):
         return self.unit.get(session) == "b" and "Bytes" or "Frames"

Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/exchange.py	2008-04-08 15:36:41 UTC (rev 1860)
@@ -66,7 +66,8 @@
         self.add_child(self.phase)
 
     def get_args(self, session):
-        return self.frame.get_args(session)
+        reg = self.frame.get_object(session)
+        return (reg.getDefaultVhost(),)
 
     def render_title(self, session, vhost):
         return "Exchanges %s" % fmt_count(vhost.exchanges.count())

Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/model.py	2008-04-08 15:36:41 UTC (rev 1860)
@@ -512,7 +512,8 @@
         prop.title = "Data Directory"
 
     def show_object(self, session, broker):
-        return self.cumin_model.show_main(session).show_broker(session, broker)
+        reg = broker.registrations[0]
+        return self.cumin_model.show_main(session).show_broker(session, reg)
 
 class CuminQueue(RemoteClass):
     def __init__(self, model):
@@ -709,7 +710,7 @@
     
     def show_object(self, session, queue):
         frame = self.cumin_model.show_main(session)
-        frame = frame.show_broker(session, queue.vhost.broker)
+        frame = frame.show_broker(session, queue.vhost.broker.registrations[0])
         return frame.show_queue(session, queue)
 
     class Purge(CuminAction):
@@ -779,7 +780,7 @@
 
     def show_object(self, session, exchange):
         frame = self.cumin_model.show_main(session)
-        frame = frame.show_broker(exchange.vhost.broker)
+        frame = frame.show_broker(exchange.vhost.broker.registrations[0])
         return frame.show_queue(session, exchange)
 
     def get_title(self, session):
@@ -840,7 +841,8 @@
 
     def show_object(self, session, client):
         frame = self.cumin_model.show_main(session)
-        frame = frame.show_broker(session, client.vhost.broker)
+        frame = frame.show_broker(session,
+                                  client.vhost.broker.registrations[0])
         return frame.show_client(session, client)
 
     def get_title(self, session):

Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/page.py	2008-04-08 15:36:41 UTC (rev 1860)
@@ -130,9 +130,10 @@
         ccount = self.app.model.count_invocations("OK")
         return len(self.app.model.invocations) - pcount - ccount
 
-    def show_broker(self, session, broker):
+    def show_broker(self, session, reg):
+        assert isinstance(reg, BrokerRegistration)
         frame = self.show_mode(session, self.__broker)
-        frame.set_object(session, broker)
+        frame.set_object(session, reg)
         return self.page.set_current_frame(session, frame)
 
     def show_brokers_add(self, session):

Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/page.strings	2008-04-08 15:36:41 UTC (rev 1860)
@@ -49,16 +49,6 @@
   margin: 0;
 }
 
-h1 {
-  font-size: 1.1em;
-  margin: 0 0 1em 0;
-}
-
-h1 img {
-  vertical-align: -50%;
-  margin: 0 0.5em 0 0;
-}
-
 h2 {
   font-size: 1em;
   margin: 0 0 0.5em 0;

Modified: mgmt/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/cumin/python/cumin/parameters.py	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/parameters.py	2008-04-08 15:36:41 UTC (rev 1860)
@@ -30,7 +30,7 @@
     def do_marshal(self, group):
         return str(group.id)
 
-class BrokerParameter(Parameter):
+class BrokerRegistrationParameter(Parameter):
     def do_unmarshal(self, string):
         return BrokerRegistration.get(int(string))
 

Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/queue.py	2008-04-08 15:36:41 UTC (rev 1860)
@@ -61,9 +61,10 @@
         self.add_child(self.__purge)
 
     def get_args(self, session):
-        return self.frame.get_args(session)
+        reg = self.frame.get_object(session)
+        return (reg.getDefaultVhost(),)
 
-    def render_title(self, session, *args):
+    def render_title(self, session, vhost):
         return "Queues %s" % fmt_count(Queue.select().count())
 
     def render_sql_where(self, session, vhost):

Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/widgets.py	2008-04-08 15:36:41 UTC (rev 1860)
@@ -277,6 +277,16 @@
         actions = self.SummaryActions(app, "actions")
         self.add_child(actions)
 
+    def get_args(self, session):
+        return self.frame.get_args(session)
+
+    def render_title(self, session, object):
+        cls = self.app.model.get_class_by_object(object)
+        return cls.get_object_title(session, object)
+
+    def render_icon_href(self, session, object):
+        return "resource?name=action-36.png"
+
     class SummaryProperties(CuminProperties):
         def do_get_items(self, session, object):
             cls = self.app.model.get_class_by_object(object)

Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/widgets.strings	2008-04-08 15:36:41 UTC (rev 1860)
@@ -5,8 +5,6 @@
 
 {status}
 
-<h1><img src="resource?name={icon_resource}"/>{title}</h1>
-
 {summary}
 
 {tabs}
@@ -155,71 +153,56 @@
 </table>
 
 [CuminSummary.css]
-table.CuminSummary {
-  width: 36em;
-  font-size: 0.9em;
+div.CuminSummary {
+  width: 32em;
   margin: 0 0 1em 0;
-  border-collapse: collapse;
+  min-height: 6em;
 }
 
-table.CuminSummary td.properties {
-  width: 50%;
-  padding: 0.5em;
-  border-top: 1px dotted #ccc;
-  border-right: 1px dotted #ccc;
+div.CuminSummary h1 {
+  font-size: 1.1em;
 }
 
-table.CuminSummary td.actions {
-  width: 50%;
-  padding: 0.5em;
-  border-top: 1px dotted #ccc;
+div.CuminSummary h1 img {
+  vertical-align: -60%;
+  margin: 0 0.25em 0 0;
 }
 
-table.CuminSummary table.PropertySet {
-  margin: 0.5em 0;
+div.CuminSummary hr {
+  margin: 0.75em 0;
+  border: 0;
+  border-top: 1px dotted #ccc;
+  padding: 0;
 }
 
-table.CuminSummary ul.ActionSet {
-  margin: 0.5em 0;
+div.CuminSummary div.actions {
+  font-size: 0.9em;
+  width: 16em;
+  float: right;
 }
 
-table.CuminSummary ul.ActionSet li {
-  list-style-type: square;
+div.CuminSummary div.properties {
+  font-size: 0.9em;
 }
 
 [CuminSummary.html]
-<table class="CuminSummary">
-  <tr>
-    <td class="properties">
-      {properties}
-    </td>
-    <td class="actions">
-      <div>Act on this object:</div>
-      {actions}
-    </td>
-  </tr>
-</table>
+<div class="CuminSummary">
+  <h1>
+    <img src="{icon_href}"/>
+    {title}
+  </h1>
 
-[SummaryProperties.css]
-dl.SummaryProperties {
-  margin: 0 0 0.5em 0;
-}
+  <hr/>
 
-dl.SummaryProperties dt {
-  font-size: 0.9em;
-  font-weight: bold;
-}
+  <div class="actions">
+    {actions}
+  </div>
 
-dl.SummaryProperties dt {
-  font-size: 0.9em;
-}
+  <div class="properties">
+    {properties}
+  </div>
+</div>
 
-[SummaryProperties.html]
-<dl class="SummaryProperties">{items}</dl>
-
-[SummaryProperties.property_html]
-<dt>{title}</dt><dd>{value}</dd>
-
 [StateSwitch.html]
 <ul class="radiotabs">
   {items}

Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/mint/python/mint/__init__.py	2008-04-08 15:36:41 UTC (rev 1860)
@@ -143,7 +143,9 @@
         #print "\n\n=============== %s %d found AFTER QUERY\n\n" % (objType.__name__, idOriginal)
         pass
 
-    if obj and obj.__class__ is Broker and obj.managedBroker:
+    if isinstance(obj, Broker):
+      assert obj.managedBroker
+
       host, port = obj.managedBroker.split(":")
       port = int(port)
       existing = list(obj.registrations)
@@ -154,6 +156,7 @@
           log.info("Attaching broker to reg %s" % reg)
 
           reg.broker = obj
+          reg.syncUpdate()
           obj.syncUpdate()
 
     return obj

Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt	2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/notes/justin-todo.txt	2008-04-08 15:36:41 UTC (rev 1860)
@@ -20,6 +20,12 @@
 
  * client.py:159 calls add_error, which no longer exists
 
+ * Avoid constructing literal sql at broker.py:378
+
+ * An invalid id for a QueueParameter produces an ugly error
+
+ * Enforce one reg per broker, to avoid confusion
+
 Deferred
 
  * Change the way CuminAction.invoke works




More information about the rhmessaging-commits mailing list