[rhmessaging-commits] rhmessaging commits: r1826 - mgmt/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Apr 1 14:40:50 EDT 2008


Author: justi9
Date: 2008-04-01 14:40:50 -0400 (Tue, 01 Apr 2008)
New Revision: 1826

Modified:
   mgmt/cumin/python/cumin/system.py
   mgmt/cumin/python/cumin/system.strings
   mgmt/cumin/python/cumin/widgets.py
   mgmt/cumin/python/cumin/widgets.strings
Log:
Introduce a class, CuminDetails, for pulling out all the metadata for
properties and actions and displaying them in a generic fashion.

As a start, add this tab to the system view.



Modified: mgmt/cumin/python/cumin/system.py
===================================================================
--- mgmt/cumin/python/cumin/system.py	2008-04-01 18:39:54 UTC (rev 1825)
+++ mgmt/cumin/python/cumin/system.py	2008-04-01 18:40:50 UTC (rev 1826)
@@ -67,7 +67,7 @@
         self.tabs = TabbedModeSet(app, "tabs")
         self.add_child(self.tabs)
 
-        self.tabs.add_tab(self.SystemStatsTab(app, "stats"))
+        self.tabs.add_tab(CuminDetails(app, "details"))
 
     def render_title(self, session, system):
         return "System '%s'" % system.sysId
@@ -96,7 +96,3 @@
 
     def render_data_url(self, session, system):
         return "model.xml"
-
-    class SystemStatsTab(Widget):
-        def render_title(self, session, *args):
-            return "Statistics"

Modified: mgmt/cumin/python/cumin/system.strings
===================================================================
--- mgmt/cumin/python/cumin/system.strings	2008-04-01 18:39:54 UTC (rev 1825)
+++ mgmt/cumin/python/cumin/system.strings	2008-04-01 18:40:50 UTC (rev 1826)
@@ -35,3 +35,5 @@
   <tr><th>Created &ndash; Deleted</th><td>{created_deleted}</td></tr>
   <tr><th>Updated</th><td>{updated}</td></tr>
 </table>
+
+{tabs}

Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py	2008-04-01 18:39:54 UTC (rev 1825)
+++ mgmt/cumin/python/cumin/widgets.py	2008-04-01 18:40:50 UTC (rev 1826)
@@ -240,6 +240,27 @@
         cls = self.app.model.get_class_by_object(object)
         return [(x.get_title(session), x.value(object))
                 for x in cls.properties]
+
+class CuminActions(ActionSet):
+    def get_args(self, session):
+        return self.frame.get_args(session)
+
+    def do_get_items(self, session, object):
+        cls = self.app.model.get_class_by_object(object)
+        return [("", x.get_title(session)) for x in cls.actions]
+
+class CuminDetails(Widget):
+    def __init__(self, app, name):
+        super(CuminDetails, self).__init__(app, name)
+
+        props = CuminProperties(app, "properties")
+        self.add_child(props)
+
+        actions = CuminActions(app, "actions")
+        self.add_child(actions)
+
+    def render_title(self, session):
+        return "Details"
     
 class StateSwitch(ItemSet):
     def __init__(self, app, name):

Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings	2008-04-01 18:39:54 UTC (rev 1825)
+++ mgmt/cumin/python/cumin/widgets.strings	2008-04-01 18:40:50 UTC (rev 1826)
@@ -118,6 +118,28 @@
   <!-- <div>{status_info}</div> -->
 </div>
 
+[CuminDetails.css]
+table.CuminDetails {
+  width: 100%;
+}
+
+table.CuminDetails td {
+  width: 50%;
+  padding: 0.5em;
+}
+
+[CuminDetails.html]
+<table class="CuminDetails">
+  <tr>
+    <th>Properties</th>
+    <th>Actions</th>
+  </tr>
+  <tr>
+    <td>{properties}</td>
+    <td>{actions}</td>
+  </tr>
+</table>
+
 [StateSwitch.html]
 <ul class="radiotabs">
   {items}




More information about the rhmessaging-commits mailing list