[rhmessaging-commits] rhmessaging commits: r1422 - in mgmt/cumin/python: wooly and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Dec 4 11:53:04 EST 2007


Author: justi9
Date: 2007-12-04 11:53:03 -0500 (Tue, 04 Dec 2007)
New Revision: 1422

Modified:
   mgmt/cumin/python/cumin/broker.py
   mgmt/cumin/python/cumin/broker.strings
   mgmt/cumin/python/cumin/brokergroup.py
   mgmt/cumin/python/cumin/page.strings
   mgmt/cumin/python/cumin/widgets.py
   mgmt/cumin/python/cumin/widgets.strings
   mgmt/cumin/python/wooly/forms.py
   mgmt/cumin/python/wooly/forms.strings
Log:
Fixes javascript auto submit of broker list actions.

Separates bulk group add out to a separate drop down list.



Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py	2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/broker.py	2007-12-04 16:53:03 UTC (rev 1422)
@@ -30,10 +30,14 @@
         self.action = Parameter(app, "action")
         self.add_parameter(self.action)
         self.add_form_parameter(self.action)
+
+        self.groups = BrokerGroupInput(app, "groups", self)
+        self.add_child(self.groups)
+
+        self.submit = BooleanParameter(app, "submit")
+        self.add_parameter(self.submit)
+        self.add_form_parameter(self.submit)
         
-        self.submit = self.Submit(app, "submit", self)
-        self.add_child(self.submit)
-
         self.paginator = self.BrokerPaginator(app, "page")
         self.add_child(self.paginator)
 
@@ -63,6 +67,9 @@
     def render_action_param_name(self, session, broker):
         return self.action.path()
 
+    def render_submit_param_name(self, session, broker):
+        return self.submit.path()
+
     def render_item_checkbox_name(self, session, broker):
         return self.brokers.path()
 
@@ -113,10 +120,6 @@
     def render_item_load(self, session, broker):
         return "%.2f" % random()
 
-    class Submit(FormButton):
-        def render_content(self, session, model):
-            return "Submit"
-
     class BrokerPaginator(Paginator):
         def get_object(self, session, model):
             return list(BrokerRegistration.select()) #XXX ugh
@@ -596,7 +599,7 @@
                     reg.host = elems[0]
 
                 reg.name = names[i]
-                
+
         self.process_cancel(session, model)
 
 class BrokerRemove(CuminConfirmForm):

Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings	2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/broker.strings	2007-12-04 16:53:03 UTC (rev 1422)
@@ -4,12 +4,16 @@
 
   <div class="sactions">
     <h2>Act on Selected Brokers:</h2>
-    <select name="{action_param_name}">
+
+    <select name="{action_param_name}" onchange="submit()">
       <option value="">Choose Action...</option>
       <option value="shutdown">Shutdown</option>
       <option value="loadbalance">Load Balance</option>
     </select>
-    {submit}
+
+    <h2>Add to Group:</h2>
+
+    {groups}
   </div>
 
   <table class="mobjects">
@@ -24,6 +28,7 @@
 
     {items}
   </table>
+  <input type="hidden" name="{submit_param_name}" value="t"/>
   {hidden_inputs}
 </form>
 

Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py	2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/brokergroup.py	2007-12-04 16:53:03 UTC (rev 1422)
@@ -135,16 +135,6 @@
     def process_display(self, session, group):
         self.group_name.set(session, group.name)
 
-class BrokerGroupInput(OptionInputSet):
-    def do_get_items(self, session, model):
-        return model.get_broker_groups()
-
-    def render_item_value(self, session, group):
-        return group.id
-
-    def render_item_selected_attr(self, session, group):
-        return None
-
 class BrokerGroupRemove(CuminConfirmForm):
     def get_title(self, session, group):
         return "Remove Broker Group '%s'" % group.name

Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings	2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/page.strings	2007-12-04 16:53:03 UTC (rev 1422)
@@ -157,6 +157,10 @@
   margin: 0 0.5em 0 0;
 }
 
+div.sactions select {
+  margin: 0 0.5em 0 0;
+}
+
 div.mobject div.mactions h2 {
   display: inline;
   font-size: 0.9em;

Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py	2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/widgets.py	2007-12-04 16:53:03 UTC (rev 1422)
@@ -4,6 +4,7 @@
 from wooly.widgets import *
 from wooly.forms import *
 
+from parameters import *
 from charts import *
 from formats import *
 from util import *
@@ -308,3 +309,19 @@
         else:
             return super(SQLObjectItemSet, self).get_item_count \
                 (session, object)
+
+class BrokerGroupInput(OptionInputSet):
+    def __init__(self, app, name, form):
+        super(BrokerGroupInput, self).__init__(app, name, form)
+
+        self.set_parameter(BrokerGroupParameter(app, "param"))
+        self.add_parameter(self.get_parameter())
+
+    def do_get_items(self, session, model):
+        return list(BrokerGroup.select())
+
+    def render_item_value(self, session, group):
+        return group.id
+
+    def render_item_content(self, session, group):
+        return group.name

Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings	2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/widgets.strings	2007-12-04 16:53:03 UTC (rev 1422)
@@ -46,3 +46,10 @@
 
 [Paginator.item_html]
 <li><a {item_class_attr} href="{item_href}">{item_content}</a></li>
+
+[BrokerGroupInput.html]
+{errors}
+<select name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="submit()">
+  <option value="">Choose Group...</option>
+  {items}
+</select>

Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py	2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/wooly/forms.py	2007-12-04 16:53:03 UTC (rev 1422)
@@ -183,7 +183,7 @@
 
 class FormButton(FormInput):
     def __init__(self, app, name, form):
-        FormInput.__init__(self, app, name, form)
+        super(FormButton, self).__init__(app, name, form)
 
         self.set_parameter(BooleanParameter(app, "param"))
         self.add_parameter(self.get_parameter())

Modified: mgmt/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/cumin/python/wooly/forms.strings	2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/wooly/forms.strings	2007-12-04 16:53:03 UTC (rev 1422)
@@ -36,4 +36,4 @@
 <select name="{name}" tabindex="{tab_index}" {disabled_attr}>{items}</select>
 
 [OptionInputSet.item_html]
-<option value="{item_value}" tabindex="{tab_index}" {item_selected_attr} {disabled_attr}>{item_content}</option>
+<option value="{item_value}" {item_selected_attr}>{item_content}</option>




More information about the rhmessaging-commits mailing list