Author: justi9
Date: 2007-10-23 11:35:09 -0400 (Tue, 23 Oct 2007)
New Revision: 1144
Modified:
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/parameters.py
mgmt/cumin/python/cumin/virtualhost.py
mgmt/notes/Todo
Log:
Adds a distinct view for client.
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-10-23 15:01:37 UTC (rev 1143)
+++ mgmt/cumin/python/cumin/client.py 2007-10-23 15:35:09 UTC (rev 1144)
@@ -14,11 +14,14 @@
def get_items(self, session, vhost):
return sorted_by(vhost.client_items(), "address")
- def render_item_address(self, session, client):
- #branch = session.branch()
- #return mlink(branch.marshal(), "Client", client.address)
- return client.address
+ def render_item_link(self, session, client):
+ branch = session.branch()
+ self.page().show_client(branch, client).show_view(branch)
+ return mlink(branch.marshal(), "Client", client.address)
+ def render_item_sessions(self, session, client):
+ return "10 sessions"
+
def render_item_messages_produced(self, session, client):
return client.get_measurement("msgsProduced").get_value()
@@ -30,3 +33,42 @@
def render_item_bytes_consumed(self, session, client):
return client.get_measurement("bytesConsumed").get_value()
+
+class ClientFrame(CuminFrame):
+ def __init__(self, app, name):
+ super(ClientFrame, self).__init__(app, name)
+
+ self.param = ClientParameter(app, "id")
+ self.add_parameter(self.param)
+ self.set_object_parameter(self.param)
+
+ self.view = ClientView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
+
+ def render_title(self, session, client):
+ return "Client %s" % client.address
+
+class ClientView(Widget):
+ def __init__(self, app, name):
+ super(ClientView, self).__init__(app, name)
+
+ self.tabs = TabSet(app, "tabs")
+ self.add_child(self.tabs)
+
+ self.tabs.add_tab(ClientSessionSet(app, "bindings"))
+ self.tabs.add_tab(ClientStatistics(app, "stats"))
+
+ def render_title(self, session, client):
+ return "Client '%s'" % client.address
+
+ def render_client_address(self, session, client):
+ return client.address
+
+class ClientSessionSet(Widget):
+ def render_title(self, session, client):
+ return "Sessions"
+
+class ClientStatistics(Widget):
+ def render_title(self, session, client):
+ return "Statistics"
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2007-10-23 15:01:37 UTC (rev 1143)
+++ mgmt/cumin/python/cumin/client.strings 2007-10-23 15:35:09 UTC (rev 1144)
@@ -26,10 +26,33 @@
[ClientSet.item_html]
<tr>
<td><input type="checkbox"/></td>
- <td>{item_address}</td>
- <td>Active</td>
+ <td>{item_link}</td>
+ <td>{item_sessions}</td>
<td style="text-align: right;">{item_messages_produced}</td>
<td style="text-align: right;">{item_messages_consumed}</td>
<td style="text-align: right;">{item_bytes_produced}</td>
<td style="text-align: right;">{item_bytes_consumed}</td>
</tr>
+
+[ClientView.html]
+<div class="oblock">
+ <div class="mstatus green" id="{id}">
+ <h2>Client Status</h2>
+
+ <div>0 errors, 0 warnings</div>
+ </div>
+
+ <h1>{title}</h1>
+
+ <dl class="properties">
+ <dt>Address</dt><dd>{client_address}</dd>
+ <dt>Authentication ID</dt><dd>e50e7dcaa8d6a039a</dd>
+ </dl>
+
+ <ul class="actions">
+ <li><a href="">Close This Client</a></li>
+ <li><a href="">Detach This Client</a></li>
+ </ul>
+
+ {tabs}
+</div>
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-23 15:01:37 UTC (rev 1143)
+++ mgmt/cumin/python/cumin/page.py 2007-10-23 15:35:09 UTC (rev 1144)
@@ -121,6 +121,11 @@
frame = frame.show_exchange(session, exchange)
return self.set_current_frame(session, frame)
+ def show_client(self, session, client):
+ frame = self.show_virtual_host(session, client.virtual_host)
+ frame = frame.show_client(session, client)
+ return self.set_current_frame(session, frame)
+
def server_group_href(self, session, group):
branch = session.branch()
self.show_server_group(branch, group).show_view(branch)
Modified: mgmt/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/cumin/python/cumin/parameters.py 2007-10-23 15:01:37 UTC (rev 1143)
+++ mgmt/cumin/python/cumin/parameters.py 2007-10-23 15:35:09 UTC (rev 1144)
@@ -1,5 +1,12 @@
from wooly import *
+class ClientParameter(Parameter):
+ def do_unmarshal(self, string):
+ return self.app.model.get_client(int(string))
+
+ def do_marshal(self, client):
+ return str(client.id)
+
class ClusterParameter(Parameter):
def do_unmarshal(self, string):
return self.app.model.get_cluster(int(string))
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2007-10-23 15:01:37 UTC (rev 1143)
+++ mgmt/cumin/python/cumin/virtualhost.py 2007-10-23 15:35:09 UTC (rev 1144)
@@ -37,6 +37,9 @@
self.exchange = ExchangeFrame(app, "exchange")
self.add_mode(self.exchange)
+ self.client = ClientFrame(app, "client")
+ self.add_mode(self.client)
+
self.view = VirtualHostView(app, "view")
self.add_mode(self.view)
@@ -51,6 +54,10 @@
self.exchange.set_object(session, exchange)
return self.show_mode(session, self.exchange)
+ def show_client(self, session, client):
+ self.client.set_object(session, client)
+ return self.show_mode(session, self.client)
+
def render_title(self, session, vhost):
return "Functional Host '%s'" % vhost.name
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-23 15:01:37 UTC (rev 1143)
+++ mgmt/notes/Todo 2007-10-23 15:35:09 UTC (rev 1144)
@@ -110,3 +110,5 @@
registered sets of widgets and parameters
* Rename routing_key to binding_key
+
+ * Remove legacy show_view methods now that we have set_view_mode