[rhmessaging-commits] rhmessaging commits: r1238 - in mgmt: notes and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Nov 5 17:23:04 EST 2007


Author: justi9
Date: 2007-11-05 17:23:04 -0500 (Mon, 05 Nov 2007)
New Revision: 1238

Modified:
   mgmt/cumin/python/cumin/broker.py
   mgmt/cumin/python/cumin/broker.strings
   mgmt/cumin/python/cumin/page.py
   mgmt/cumin/python/cumin/page.strings
   mgmt/cumin/python/cumin/queue.strings
   mgmt/notes/justin-todo.txt
Log:
Adds the form for registering sets of brokers.



Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py	2007-11-05 20:18:03 UTC (rev 1237)
+++ mgmt/cumin/python/cumin/broker.py	2007-11-05 22:23:04 UTC (rev 1238)
@@ -394,6 +394,11 @@
         def render_none(self, session, model):
             return fmt_none()
 
+    def render_add_broker_href(self, session, model):
+        branch = session.branch()
+        self.page().show_broker_add(session)
+        return branch.marshal()
+
     def render_clear_filters_href(self, session, model):
         branch = session.branch()
         self.group.set(branch, None)
@@ -442,3 +447,82 @@
         class_ = param.get(session) is object and "selected"
 
         return fmt_link(href, name, class_)
+
+class BrokerForm(CuminForm, Frame):
+    def __init__(self, app, name):
+        super(BrokerForm, self).__init__(app, name)
+
+        self.name_param = Parameter(app, "name_param");
+        self.add_parameter(self.name_param)
+        self.add_form_parameter(self.name_param)
+        
+        self.names = ListParameter(app, "name", self.name_param)
+        self.add_parameter(self.names)
+        self.add_form_parameter(self.names)
+
+        self.addr_param = Parameter(app, "addr_param")
+        self.add_parameter(self.addr_param)
+        self.add_form_parameter(self.addr_param)
+
+        self.addrs = ListParameter(app, "address", self.addr_param)
+        self.add_parameter(self.addrs)
+        self.add_form_parameter(self.addrs)
+
+        self.fields = IntegerParameter(app, "fields")
+        self.fields.set_default(3)
+        self.add_parameter(self.fields)
+
+        self.field_tmpl = Template(self, "field_html")
+
+        self.more = self.MoreEntries(app, "more", self)
+        self.add_child(self.more)
+
+    def process_display(self, session, object):
+        if self.more.get(session):
+            self.fields.set(session, self.fields.get(session) + 3)
+
+    def render_fields(self, session, object):
+        writer = Writer()
+
+        for i in range(self.fields.get(session)):
+            self.field_tmpl.render(session, i, writer)
+            
+        return writer.to_string()
+
+    def render_field_name_name(self, session, object):
+        return self.names.path()
+
+    def render_field_name_value(self, session, index):
+        names = self.names.get(session)
+        if len(names) > index:
+            return names[index]
+
+    def render_field_address_name(self, session, object):
+        return self.addrs.path()
+
+    def render_field_address_value(self, session, index):
+        addrs = self.addrs.get(session)
+        if len(addrs) > index:
+            return addrs[index]
+    
+    class MoreEntries(FormButton):
+        def render_content(self, session, model):
+            return "More Entries"
+
+class BrokerAdd(BrokerForm):
+    def process_cancel(self, session, model):
+        branch = session.branch()
+        self.page().show_view(branch)
+        session.set_redirect(branch.marshal())
+
+    def process_submit(self, session, model):
+        names = self.names.get(session)
+        addrs = self.addrs.get(session)
+        
+        for name, addr in zip(names, addrs):
+            print name, addr
+
+        self.process_cancel(session, model)
+
+    def render_title(self, session, object):
+        return "Register New Brokers"

Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings	2007-11-05 20:18:03 UTC (rev 1237)
+++ mgmt/cumin/python/cumin/broker.strings	2007-11-05 22:23:04 UTC (rev 1238)
@@ -180,7 +180,7 @@
     </td>
     <td class="view">
       <ul class="actions">
-        <li><a class="nav" href="{href}">Register New Brokers</a></li>
+        <li><a class="nav" href="{add_broker_href}">Register New Brokers</a></li>
       </ul>
 
       {brokers}
@@ -196,3 +196,49 @@
 
 [BrokerBrowser.cluster_html]
 <li>{cluster_link}</li>
+
+[BrokerForm.css]
+table.BrokerForm td, table.BrokerForm th {
+  padding: 0.25em;
+}
+
+[BrokerForm.html]
+<form id="{id}" class="mform" method="post" action="?">
+  <div class="head">
+    <h1>{title}</h1>
+  </div>
+  <div class="body">
+    <fieldset>
+      <table class="BrokerForm">
+        <tr>
+          <th>Name</th>
+          <th>Address</th>
+        </tr>
+
+        {fields}
+      </table>
+      
+      {more}
+    </fieldset>
+
+    {hidden_inputs}
+  </div>
+  <div class="foot">
+    <a class="help action" href="{href}" target="help">Help</a>
+    {cancel}
+    {submit}
+  </div>
+</form>
+<script defer="defer">
+(function() {
+    var elem = wooly.doc().elem("{id}").node.elements[1];
+    elem.focus();
+    elem.select();
+}())
+</script>
+
+[BrokerForm.field_html]
+<tr>
+  <td><input type="text" name="{field_name_name}" value="{field_name_value}" size="20"/></td>
+  <td><input type="text" name="{field_address_name}" value="{field_address_value}" size="40"/></td>
+</tr>

Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py	2007-11-05 20:18:03 UTC (rev 1237)
+++ mgmt/cumin/python/cumin/page.py	2007-11-05 22:23:04 UTC (rev 1238)
@@ -32,6 +32,9 @@
         self.broker = BrokerFrame(app, "broker")
         self.add_mode(self.broker)
 
+        self.broker_add = BrokerAdd(app, "brokeradd")
+        self.add_mode(self.broker_add)
+
         self.group = BrokerGroupFrame(app, "group")
         self.add_mode(self.group)
 
@@ -77,6 +80,10 @@
 
         return self.set_current_frame(session, frame)
 
+    def show_broker_add(self, session):
+        frame = self.show_mode(session, self.broker_add)
+        return self.set_current_frame(session, frame)
+
     def show_broker_group(self, session, group):
         frame = self.show_mode(session, self.group)
         frame.set_object(session, group)

Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings	2007-11-05 20:18:03 UTC (rev 1237)
+++ mgmt/cumin/python/cumin/page.strings	2007-11-05 22:23:04 UTC (rev 1238)
@@ -44,6 +44,7 @@
 
 tr {
   vertical-align: top;
+  text-align: left;
 }
 
 span.none {

Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings	2007-11-05 20:18:03 UTC (rev 1237)
+++ mgmt/cumin/python/cumin/queue.strings	2007-11-05 22:23:04 UTC (rev 1238)
@@ -45,7 +45,7 @@
 </tr>
 
 [QueueForm.html]
-<form id="{id}" class="QueueForm mform" method="post" action="?">
+<form id="{id}" class="mform" method="post" action="?">
   <div class="head">
     <h1>{title}</h1>
   </div>

Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt	2007-11-05 20:18:03 UTC (rev 1237)
+++ mgmt/notes/justin-todo.txt	2007-11-05 22:23:04 UTC (rev 1238)
@@ -1,9 +1,5 @@
 Current
 
- * Brokers tab
-
-   - Find/connect in bulk
-
  * exch, queue: make consumer, producer, and bindings columns links
 
  * Add ability to send a test message to a queue




More information about the rhmessaging-commits mailing list