Author: eallen
Date: 2008-11-06 09:12:00 -0500 (Thu, 06 Nov 2008)
New Revision: 2753
Modified:
mgmt/trunk/cumin/python/cumin/brokerlink.py
mgmt/trunk/cumin/python/cumin/brokerlink.strings
Log:
Fixups to work with API change.
Use new MoreFieldSet for Show/Hide advanced options on BridgeAdd form.
Modified: mgmt/trunk/cumin/python/cumin/brokerlink.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerlink.py 2008-11-06 14:10:07 UTC (rev 2752)
+++ mgmt/trunk/cumin/python/cumin/brokerlink.py 2008-11-06 14:12:00 UTC (rev 2753)
@@ -72,10 +72,9 @@
def render_content(self, session, data):
peer = Identifiable(data["id"])
- branch = session.branch()
- self.frame.link.view.show(branch)
+ href = self.frame.link.get_href(session, peer)
name = "%s:%i" % (data["host"], data["port"])
- return fmt_olink(branch, peer, name=name)
+ return fmt_link(href, fmt_shorten(name))
def get_orderby_sql(self, session):
dir = self.parent.is_reversed(session) and "desc" or
"asc"
@@ -384,7 +383,7 @@
not (self.state.is_active(session) and not is_active(exchange)):
if not exchange.name in ["qpid.management", ""]:
if not self.get(session):
- self.exchange.set(session, str(exchange.id))
+ self.set(session, str(exchange.id))
self.exchange_tmpl.render(writer, session, exchange)
return writer.to_string()
@@ -406,40 +405,25 @@
self.key.set_title("Routing Key")
self.add_field(self.key)
+ self.more = MoreFieldSet(app, "more")
+ self.add_field(self.more)
+
+ self.help = self.BridgeAddHelpField(app, "help")
+ self.more.add_field(self.help)
+
self.tag = TextField(app, "tag")
self.tag.set_required(False)
self.tag.set_title("Tag")
- self.add_field(self.tag)
+ self.more.add_field(self.tag)
self.excludes = TextField(app, "excludes")
self.excludes.set_required(False)
self.excludes.set_title("Excludes")
- self.add_field(self.excludes)
+ self.more.add_field(self.excludes)
- self.tag_excludes = list()
- self.tag_excludes.append(self.tag)
- self.tag_excludes.append(self.excludes)
-
def get_args(self, session):
return self.frame.get_args(session)
- def render_fields(self, session, *args):
- writer = Writer()
-
- for field in self.fields:
- if not field in self.tag_excludes:
- writer.write(field.render(session))
-
- return writer.to_string()
-
- def render_hidden_fields(self, session, *args):
- writer = Writer()
-
- for field in self.tag_excludes:
- writer.write(field.render(session))
-
- return writer.to_string()
-
def render_title(self, session, link):
return "Add Route to '%s:%d'" % (link.host, link.port)
@@ -484,6 +468,9 @@
self.process_cancel(session, link)
+ class BridgeAddHelpField(FormField):
+ pass
+
class BrokerLinkAdd(CuminFieldForm):
def __init__(self, app, name):
super(BrokerLinkAdd, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/brokerlink.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerlink.strings 2008-11-06 14:10:07 UTC (rev 2752)
+++ mgmt/trunk/cumin/python/cumin/brokerlink.strings 2008-11-06 14:12:00 UTC (rev 2753)
@@ -228,92 +228,31 @@
[PeerRouteSetClose.item_html]
<tr>{item_content}</tr>
-[BridgeAdd.css]
-div#BridgeAdd div#more_button {
- border:1px solid #333333;
- background-color: #EEEEEE;
- color: #333333;
- cursor: pointer;
- float:left; /* shrink to fit */
- margin: 0 0 1em 2em;
- padding: 4px 8px;
-}
-
-div#BridgeAdd div#hidden_fields {
- margin-left: 2em;
- display: none;
-}
-
-div#BridgeAdd div.clear_left {
- clear:left;
- font-size:0;
- line-height:0;
-}
-
-div#BridgeAdd div.hidden_help {
- color:#333333;
- margin-right:1em;
-}
-div#BridgeAdd span.tag1 {
+[BridgeAddHelpField.css]
+div#bridge_add_help span.tag1 {
color:red;
}
-div#BridgeAdd span.tag2 {
+div#bridge_add_help span.tag2 {
color:green;
}
+div#bridge_add_help p.example {
+ font-size: 0.9em;
+ color: #444444;
+}
-[BridgeAdd.html]
-<div id="BridgeAdd">
-<form id="{id}" class="mform" method="post"
action="?">
- <div class="head">{title}</div>
- <div class="body">{fields}</div>
- <div id="more_button">Show More Options...</div>
- <div class="clear_left"><!-- --></div>
- <div id="hidden_fields">
- <div class="hidden_help">
- <p>The <strong>Tag</strong> and
<strong>Excludes</strong> are used to prevent a message from routing back
- to the source broker and causing an infinite loop.</p>
- <p>Enter a short <strong>tag</strong> that will be associated with
the source exchange.
- Then <strong>exclude</strong> any tags that were used for the destination
exchanges.</p>
- <p class="example">
- <em>broker1</em> <==> <em>broker2</em> tag:
<span class="tag2">tag2</span> excludes: <span
class="tag1">tag1</span><br/>
- <em>broker2</em> <==> <em>broker1</em> tag:
<span class="tag1">tag1</span> excludes: <span
class="tag2">tag2</span>
- </p>
- </div>
- {hidden_fields}
- </div>
- {form_error}
- <div class="foot">
- {help}
- {submit}
- {cancel}
- </div>
- <div>{hidden_inputs}</div>
-</form>
+[BridgeAddHelpField.html]
+<div id="bridge_add_help">
+ <p>The <strong>Tag</strong> and <strong>Excludes</strong>
are used to prevent a message from routing back
+ to the source broker and causing an infinite loop.</p>
+ <p>Enter a short <strong>tag</strong> that will be associated with the
source exchange.
+ Then <strong>exclude</strong> any tags that were used for the destination
exchanges.</p>
+ <p class="example">
+ <em>broker1</em> <==> <em>broker2</em> tag:
<span class="tag2">tag2</span> excludes: <span
class="tag1">tag1</span><br/>
+ <em>broker2</em> <==> <em>broker1</em> tag:
<span class="tag1">tag1</span> excludes: <span
class="tag2">tag2</span>
+ </p>
</div>
-<script type="text/javascript">
-<![CDATA[
- wooly.doc().elembyid("{id}").node.elements[0].focus();
- document.getElementById("more_button").onclick = click_more;
- function click_more() {
- var hfields = document.getElementById("hidden_fields");
- if (hfields) {
- if (hfields.style.display == "block") {
- hfields.style.display = "none";
- this.innerHTML = "Show More Options...";
- document.getElementById("{more_path}").value = "f";
- }
- else {
- hfields.style.display = "block";
- this.innerHTML = "Hide Options";
- document.getElementById("{more_path}").value = "t";
- }
- }
- }
-]]>
-</script>
-
[PeerStatus.html]
<div id="{id}" class="CuminStatus {color}">
<table>