[rhmessaging-commits] rhmessaging commits: r4356 - mgmt/newdata/cumin/python/cumin/grid.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Sep 28 10:57:47 EDT 2010


Author: eallen
Date: 2010-09-28 10:57:46 -0400 (Tue, 28 Sep 2010)
New Revision: 4356

Modified:
   mgmt/newdata/cumin/python/cumin/grid/negotiator.py
   mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
Log:
Treat missing quota configs as an error.
- Display "error" instead of 0
- Show the error on mouseover

Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.py	2010-09-28 14:34:49 UTC (rev 4355)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.py	2010-09-28 14:57:46 UTC (rev 4356)
@@ -26,7 +26,6 @@
 
         super(NegotiatorFrame, self).__init__(app, name, cls)
 
-        self.group_add = NegotiatorGroupAdd(app, self)
         #self.edit_dynamic_quota = NegotiatorEditDynamicQuota(app, self)
 
 class NegotiatorSelector(ObjectSelector):
@@ -245,14 +244,18 @@
         def render_content(self, session, group):
             value = self.parent.group_helper.get_config_value(session, group, "GROUP_QUOTA_DYNAMIC")
             self.task.form.group_leader.set(session, group)
+
             try:
-                if "loading" in value:
-                    return value
+                fval = float(value)
+            except ValueError:
+                return value
             except TypeError:
-                pass
+                if isinstance(value, Exception):
+                    content = "<span class='QuotaError'>error</span>"
+                    return fmt_link("#", content, "", "", value.message)
 
             href = self.task.get_href(session)
-            content = "%s%%" % str(round(float(value) * 100.0, 2))
+            content = "%s%%" % str(round(fval * 100.0, 2))
             return fmt_link(href, content, "", "", self.fmt_hover(""))
 
     class SpacerColumn(ItemTableColumn):
@@ -271,6 +274,9 @@
         self.info = Attribute(app, "info")
         self.add_attribute(self.info)
 
+        self.loading = Attribute(app, "loading")
+        self.add_attribute(self.loading)
+
     def get_config_info(self, session):
         negotiator = self.negotiator.get(session)
 
@@ -371,7 +377,10 @@
             try:
                 for config in raw_configs:
                     for group in raw_configs[config]:
-                        info[group][config] = raw_configs[config][group].data['Value']
+                        if raw_configs[config][group].error:
+                            info[group][config] = raw_configs[config][group].error
+                        else:
+                            info[group][config] = raw_configs[config][group].data['Value']
             except Exception, e:
                 log.exception(e)
 
@@ -387,6 +396,7 @@
                 info = self.get_config_for_groups(session, config, [group])
                 return info[group][config]
             except:
+                self.loading.set(session, "loading")
                 return "<em>loading</em>"
 
     def get_unclaimed_dyn_quota(self, session, groups):
@@ -629,7 +639,10 @@
 
     def render_quota_value(self, session, group):
         value = self.group_helper.get_config_value(session, group, "GROUP_QUOTA_DYNAMIC")
-        return round(float(value) * 100.0, 2)
+        try:
+            return round(float(value) * 100.0, 2)
+        except:
+            return 0.0
 
     def render_unclaimed_value(self, session, group):
         group_leader = self.group_leader.get(session)

Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.strings	2010-09-28 14:34:49 UTC (rev 4355)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.strings	2010-09-28 14:57:46 UTC (rev 4356)
@@ -6,7 +6,6 @@
     padding: 0.75em;
 }
 
-[NegotiatorOverview.css]
 th.ExpandColumn {
     width: 2em;
 }
@@ -33,6 +32,11 @@
     padding-right: 2em;
 }
 
+span.QuotaError {
+    font-style: italic;
+    color: red;
+}
+
 [NegotiatorOverview.html]
 <div id="{id}" class="CuminTable GroupTable">
   <table {class}>



More information about the rhmessaging-commits mailing list