Author: justi9
Date: 2009-03-25 17:40:28 -0400 (Wed, 25 Mar 2009)
New Revision: 3211
Modified:
mgmt/trunk/cumin/python/cumin/action.py
mgmt/trunk/cumin/python/cumin/action.strings
mgmt/trunk/cumin/python/cumin/page.py
mgmt/trunk/cumin/python/cumin/page.strings
mgmt/trunk/wooly/python/wooly/pages.py
Log:
Use the new update facility to make action status do updates
Modified: mgmt/trunk/cumin/python/cumin/action.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/action.py 2009-03-25 18:55:22 UTC (rev 3210)
+++ mgmt/trunk/cumin/python/cumin/action.py 2009-03-25 21:40:28 UTC (rev 3211)
@@ -8,6 +8,16 @@
strings = StringCatalog(__file__)
+class ActionPage(HtmlPage):
+ def __init__(self, app, name):
+ super(ActionPage, self).__init__(app, name)
+
+ self.__actions = ActionInvocationSet(app, "actions")
+ self.add_child(self.__actions)
+
+ def render_title(self, session, *args):
+ return "Actions"
+
class ActionInvocationSet(ItemTable):
def __init__(self, app, name):
super(ActionInvocationSet, self).__init__(app, name)
@@ -60,12 +70,19 @@
def do_get_items(self, session, *args):
return reversed(sorted_by(self.app.model.invocations, "when"))
-class ActionPage(HtmlPage):
+class ActionInvocationStatus(Widget):
def __init__(self, app, name):
- super(ActionPage, self).__init__(app, name)
+ super(ActionInvocationStatus, self).__init__(app, name)
- self.__actions = ActionInvocationSet(app, "actions")
- self.add_child(self.__actions)
+ self.update_enabled = True
- def render_title(self, session, *args):
- return "Actions"
+ def render_pending_count(self, session):
+ return self.app.model.count_invocations("pending")
+
+ def render_completed_count(self, session):
+ return self.app.model.count_invocations("OK")
+
+ def render_failed_count(self, session):
+ pcount = self.app.model.count_invocations("pending")
+ ccount = self.app.model.count_invocations("OK")
+ return len(self.app.model.invocations) - pcount - ccount
Modified: mgmt/trunk/cumin/python/cumin/action.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/action.strings 2009-03-25 18:55:22 UTC (rev 3210)
+++ mgmt/trunk/cumin/python/cumin/action.strings 2009-03-25 21:40:28 UTC (rev 3211)
@@ -1,3 +1,8 @@
+[ActionPage.css]
+body {
+ margin: 1em;
+}
+
[ActionInvocationSet.html]
<table class="mobjects">
<thead>
@@ -6,7 +11,12 @@
<tbody>{items}</tbody>
</table>
-[ActionPage.css]
-body {
- margin: 1em;
-}
+[ActionInvocationStatus.html]
+<span id="{id}">
+ Actions:
+ <a href="javascript:popupActions()">
+ <span>{pending_count}</span> pending,
+ <span>{completed_count}</span> completed,
+ <span>{failed_count}</span> failed
+ </a>
+</span>
Modified: mgmt/trunk/cumin/python/cumin/page.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.py 2009-03-25 18:55:22 UTC (rev 3210)
+++ mgmt/trunk/cumin/python/cumin/page.py 2009-03-25 21:40:28 UTC (rev 3211)
@@ -43,6 +43,9 @@
self.__tabs = MainFrameTabs(app, "tabs")
self.add_child(self.__tabs)
+ self.actions = ActionInvocationStatus(app, "actions")
+ self.add_child(self.actions)
+
self.view = MainView(app, "view")
self.add_mode(self.view)
self.set_view_mode(self.view)
@@ -89,6 +92,11 @@
(app, "groupsremove", action, item)
self.add_mode(self.broker_groups_remove)
+ def do_process(self, session):
+ self.actions.process(session)
+
+ super(MainFrame, self).do_process(session)
+
def render_title(self, session):
return "Main"
@@ -122,17 +130,6 @@
args = frame.get_args(session)
return frame.render_title(session, *args)
- def render_pending_count(self, session):
- return self.app.model.count_invocations("pending")
-
- def render_completed_count(self, session):
- return self.app.model.count_invocations("OK")
-
- def render_failed_count(self, session):
- pcount = self.app.model.count_invocations("pending")
- ccount = self.app.model.count_invocations("OK")
- return len(self.app.model.invocations) - pcount - ccount
-
def show_grid_tab(self, session):
self.__tabs.set_grid_tab(session)
self.view.set_grid_mode(session)
Modified: mgmt/trunk/cumin/python/cumin/page.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.strings 2009-03-25 18:55:22 UTC (rev 3210)
+++ mgmt/trunk/cumin/python/cumin/page.strings 2009-03-25 21:40:28 UTC (rev 3211)
@@ -152,17 +152,7 @@
</div>
<div>
- <div id="actions">
- Actions:
- <a href="javascript:popupActions()">
- <span>{pending_count}</span> pending,
- <span>{completed_count}</span> completed,
- <span>{failed_count}</span> failed
- </a>
- </div>
- <script type="text/javascript">
- cumin.modelListeners["actions"] = updateActions
- </script>
+ <div id="actions">{actions}</div>
<ul id="context">{frames}</ul>
</div>
Modified: mgmt/trunk/wooly/python/wooly/pages.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/pages.py 2009-03-25 18:55:22 UTC (rev 3210)
+++ mgmt/trunk/wooly/python/wooly/pages.py 2009-03-25 21:40:28 UTC (rev 3211)
@@ -102,6 +102,8 @@
return content_type
def enable_update(self, session, widget):
+ #print "Enabling update on widget %s" % widget
+
self.updates.get(session).append(widget)
def get_update_url(self, session, widgets):