[rhmessaging-commits] rhmessaging commits: r3287 - mgmt/trunk/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Apr 14 11:50:32 EDT 2009


Author: eallen
Date: 2009-04-14 11:50:32 -0400 (Tue, 14 Apr 2009)
New Revision: 3287

Modified:
   mgmt/trunk/cumin/python/cumin/stat.py
   mgmt/trunk/cumin/python/cumin/stat.strings
Log:
Save and restore state of javascript duration switches.

Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py	2009-04-14 15:46:34 UTC (rev 3286)
+++ mgmt/trunk/cumin/python/cumin/stat.py	2009-04-14 15:50:32 UTC (rev 3287)
@@ -86,6 +86,9 @@
     def get_click(self, state):
         return "return changeDuration('%s', this, '%s')" % (state, self.parent.path)
 
+    def get_attributes(self, state):
+        return {'state': state}
+
 class StatValueChart(Widget):
     def __init__(self, app, name):
         super(StatValueChart, self).__init__(app, name)

Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings	2009-04-14 15:46:34 UTC (rev 3286)
+++ mgmt/trunk/cumin/python/cumin/stat.strings	2009-04-14 15:50:32 UTC (rev 3287)
@@ -95,11 +95,39 @@
         $(oImg).addEvent('load', function () {this.className = ""});
         oImg.className = "Loading";
         oImg.src = src;
+
+        var hash = wooly.session.hash();
+        hash[id] = state;
+        var href = window.location.href;
+        var hashIndex = href.indexOf("#");
+        if (hashIndex > 0) {
+            href = href.substring(0, hashIndex);
+        }
+        window.location.replace(href + "#" + hash.marshal());
     }
     return false;
-
 }
 
+window.addEvent('domready',function () {
+    var hash = wooly.session.hash();
+    for (var key in hash) {
+        if (!(hash[key] instanceof Function)) {
+            var oChart = $(key);
+            if (oChart) {
+                var links = oChart.getElements('a');
+                var state = hash[key];
+
+                $each(links, function (item) {
+                    if (item.get('state') == state) {
+                        changeDuration(state, item, key);
+                    }
+                });
+            }
+        }
+    }
+});
+
+
 [StatValueChart.html]
 <div class="StatValueChart" id="{id}">
   <h2>{title}</h2>




More information about the rhmessaging-commits mailing list