rhmessaging commits: r2769 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-08 12:50:53 -0500 (Sat, 08 Nov 2008)
New Revision: 2769
Modified:
mgmt/trunk/cumin/python/cumin/formats.py
Log:
Added optional onclick hander to fmt_link.
Modified: mgmt/trunk/cumin/python/cumin/formats.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/formats.py 2008-11-08 17:50:07 UTC (rev 2768)
+++ mgmt/trunk/cumin/python/cumin/formats.py 2008-11-08 17:50:53 UTC (rev 2769)
@@ -119,11 +119,17 @@
return string
-def fmt_link(href, content, class_="", id="", link_title="", bm=""):
- return "<a %s href=\"%s%s\"%s%s>%s</a>" % \
- (id and "id=\"%s\"" % id or "", href, bm and "#%s" % bm or "", class_ and " class=\"%s\" " % class_ or " ",
- link_title and "title=\"%s\"" % link_title or "", content)
+def fmt_link(href, content, class_="", id="", link_title="", bm="", click=""):
+ full_id = id and " id=\"%s\"" % id or ""
+ full_bm = bm and "#%s" % bm or ""
+ full_class = class_ and " class=\"%s\"" % class_ or ""
+ full_title = link_title and " title=\"%s\"" % link_title or ""
+ full_click = click and " onclick=\"%s\"" % click or ""
+ return "<a%s href=\"%s%s\"%s%s%s>%s</a>" % \
+ (full_id, href, full_bm, full_class,
+ full_title, full_click, content)
+
def fmt_olink(session, object, selected=False, name=None, pre=16, post=0):
if name is None:
name = getattr(object, "name", fmt_none())
16 years, 2 months
rhmessaging commits: r2768 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-08 12:50:07 -0500 (Sat, 08 Nov 2008)
New Revision: 2768
Modified:
mgmt/trunk/cumin/python/cumin/exchange.py
Log:
For consistency, moved durability option in advanced options for exchange add.
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-11-08 17:48:36 UTC (rev 2767)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-11-08 17:50:07 UTC (rev 2768)
@@ -346,12 +346,12 @@
self.exchange_type = self.ExchangeTypeField(app, "exchange_type")
self.add_field(self.exchange_type)
- self.durable = self.ExchangeDurabilityField(app, "durable")
- self.add_field(self.durable)
-
self.more = MoreFieldSet(app, "more")
self.add_field(self.more)
+ self.durable = self.ExchangeDurabilityField(app, "durable")
+ self.more.add_field(self.durable)
+
self.sequence = self.SequenceField(app, "sequence")
self.more.add_field(self.sequence)
16 years, 2 months
rhmessaging commits: r2767 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-08 12:48:36 -0500 (Sat, 08 Nov 2008)
New Revision: 2767
Modified:
mgmt/trunk/cumin/python/cumin/brokerlink.py
mgmt/trunk/cumin/python/cumin/brokerlink.strings
Log:
Added missing bridge and route options to the respective add forms.
Modified: mgmt/trunk/cumin/python/cumin/brokerlink.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerlink.py 2008-11-08 17:46:25 UTC (rev 2766)
+++ mgmt/trunk/cumin/python/cumin/brokerlink.py 2008-11-08 17:48:36 UTC (rev 2767)
@@ -115,7 +115,7 @@
self.parent.ids.clear(session)
href = self.frame.links_close.get_href(session, ids)
- self.page.set_redirect_url(session, branch.marshal())
+ self.page.set_redirect_url(session, href)
class PeerRouteSet(CuminTable, Form):
def __init__(self, app, name):
@@ -335,68 +335,63 @@
def render_title(self, session, exchange):
return "Messages Received, Routed, and Dropped"
-class ExchangeRadioField(RadioField):
- def __init__(self, app, name):
- super(ExchangeRadioField, self).__init__(app, name, None)
+class ExchangeInputSet(RadioInputSet):
+ def __init__(self, app, name, state):
+ super(ExchangeInputSet, self).__init__(app, name, None)
- self.param = Parameter(app, "exchange_param")
- self.param.default = ""
+ self.param = IntegerParameter(app, "param")
self.add_parameter(self.param)
- self.exchange_tmpl = Template(self, "exchange_html")
-
- self.state = ExchangeState(app, "phase")
- self.add_child(self.state)
-
- self.phase = Parameter(app, "phase")
- self.add_parameter(self.phase)
-
- def render_title(self, session):
- return "Choose an Exchange"
-
- def render_exchange_name_path(self, session, exchange):
- return self.param.path
+ self.state = state
- def render_exchange_name(self, session, exchange):
- return exchange.name or "Default"
-
- def render_exchange_value(self, session, exchange):
- return str(exchange.id)
-
- def render_exchange_id(self, session, exchange):
- return ".".join((self.path, str(exchange.id)))
-
- def render_checked(self, session, exchange):
- return self.param.get(session) == str(exchange.id) and "checked=\"checked\"" or ""
-
- def render_phase_path(self, session, *args):
- return self.phase.path
-
- def render_exchanges(self, session, *args):
+ def do_get_items(self, session, *args):
+ exchanges = list()
+
reg = self.frame.get_ancestor("broker").get_object(session)
vhost = reg.getDefaultVhost()
sortedExchanges = sorted_by(vhost.exchanges)
- writer = Writer()
for exchange in sortedExchanges:
if ExchangeInfo.is_builtin(exchange) or \
- not (self.state.is_active(session) and not is_active(exchange)):
+ (not exchange._get_deletionTime() and \
+ not (self.state.is_active(session) and not is_active(exchange))):
if not exchange.name in ["qpid.management", ""]:
- if not self.get(session):
- self.set(session, str(exchange.id))
- self.exchange_tmpl.render(writer, session, exchange)
+ if not self.param.get(session):
+ self.param.set(session, exchange.id)
+ exchanges.append(exchange)
- return writer.to_string()
+ return exchanges
- def render(self, session, *args):
- phase = self.phase.get(session)
- if phase:
- self.state.set(session, phase)
- return super(ExchangeRadioField, self).render(session, *args)
+ def render_item_value(self, session, exchange):
+ return exchange.id
+
+ def render_item_content(self, session, exchange):
+ return exchange.name
+
+ def render_item_checked_attr(self, session, exchange):
+ if self.param.get(session) == exchange.id:
+ return "checked=\"checked\""
+
+class ExchangeRadioField(FormField):
+ def __init__(self, app, name):
+ super(ExchangeRadioField, self).__init__(app, name)
+
+ self.state = ExchangeState(app, "phase")
+ self.add_child(self.state)
-class BridgeAdd(CuminFieldForm):
+ self.__exchanges = ExchangeInputSet(app, "inputs", self.state)
+ self.add_child(self.__exchanges)
+
+ def get(self, session):
+ return self.__exchanges.get(session)
+
+ def render_title(self, session):
+ return "Choose an Exchange"
+
+
+class BridgeAddForm(CuminFieldForm):
def __init__(self, app, name):
- super(BridgeAdd, self).__init__(app, name)
+ super(BridgeAddForm, self).__init__(app, name)
self.exchange = ExchangeRadioField(app, "exchange")
self.add_field(self.exchange)
@@ -421,6 +416,9 @@
self.excludes.set_title("Excludes")
self.more.add_field(self.excludes)
+ self.dynamic = self.DynamicField(app, "dynamic")
+ self.more.add_field(self.dynamic)
+
def get_args(self, session):
return self.frame.get_args(session)
@@ -434,12 +432,25 @@
if not self.excludes.get(session):
self.excludes.set(session, "%s:%s" % (args[0].host, args[0].port))
+ class DynamicField(TwoOptionRadioField):
+ def __init__(self, app, name, option1="yes", option2="no"):
+ super(BridgeAddForm.DynamicField, self).__init__(app, name, option1, option2)
+
+ self.option1_title = "Dynamic"
+ self.option2_title = "Not dynamic"
+ self.param.default = option2
+
+ def render_title(self, session):
+ return "Dynamic Route?"
+
+ def render_field_help(self, session):
+ return "(Should the added route be dynamic)"
+
+ class BridgeAddHelpField(FormField):
+ pass
+
+class BridgeAdd(BridgeAddForm):
def process_cancel(self, session, *args):
- self.key.set(session, "")
- self.tag.set(session, "")
- self.excludes.set(session, "")
- self.exchange.set(session, "")
-
branch = session.branch()
self.frame.show_view(branch)
self.page.set_redirect_url(session, branch.marshal())
@@ -455,12 +466,14 @@
exchange_id = self.exchange.get(session)
exchange = Exchange.get(int(exchange_id))
durable = link.durable
+ dynamic = self.dynamic.get(session) == "yes"
args = {"durable": durable,
"exchange": exchange.name,
"key": key,
"tag": tag,
- "excludes": excludes
+ "excludes": excludes,
+ "dynamic": dynamic
}
action = self.app.model.link.bridge
@@ -468,125 +481,156 @@
self.process_cancel(session, link)
- class BridgeAddHelpField(FormField):
- pass
-
-class BrokerLinkAdd(CuminFieldForm):
+class BrokerLinkAddForm(CuminFieldForm):
def __init__(self, app, name):
- super(BrokerLinkAdd, self).__init__(app, name)
+ super(BrokerLinkAddForm, self).__init__(app, name)
- self.host = DictParameter(app, "host")
- self.add_parameter(self.host)
+ self.host = self.Host(app, "host")
+ self.add_field(self.host)
- self.durable = self.SavedField(app, "saved")
- self.add_field(self.durable)
+ self.more = self.ShowButton(app, "more")
+ self.add_field(self.more)
- self.errors = self.Errors(self, "errors")
- self.add_attribute(self.errors)
+ self.port = self.PortField(app, "port")
+ self.more.add_field(self.port)
+ self.username = self.UsernameField(app, "username")
+ self.more.add_field(self.username)
+
+ self.password = self.PassField(app, "password")
+ self.more.add_field(self.password)
+
+ self.durable = self.DurableField(app, "durable")
+ self.more.add_field(self.durable)
+
+ self.transport = self.TransportField(app, "transport")
+ self.more.add_field(self.transport)
+
def render_title(self, session, *args):
reg = self.frame.get_object(session)
return "Add Broker Link to '%s'" % reg.name
- def render_broker_name_path(self, session, *args):
- return DictParameter.sep().join((self.host.path, "name"))
+ class ShowButton(MoreFieldSet):
+ def render_more_text(self, session, *args):
+ return "Show Optional Inputs..."
- def render_broker_port_path(self, session, *args):
- return DictParameter.sep().join((self.host.path, "port"))
+ def render_less_text(self, session, *args):
+ return "Hide Optional Inputs..."
+
+ class Host(NameField):
+ def render_title(self, session):
+ return "Address"
+
+ class PortField(StringField):
+ def __init__(self, app, name):
+ super(BrokerLinkAddForm.PortField, self).__init__(app, name)
+
+ self.input.size = 5
+ self.css_class = "compact first"
+
+ def render_title(self, session):
+ return "Port"
- def render_broker_name_value(self, session, *args):
- host = self.host.get(session)
- if "name" in host:
- return host["name"]
+ def do_validate(self, session, errors):
+ try:
+ port = self.get(session)
+ if port:
+ int(port)
+ except:
+ errors.append(FormError("Port must be a number"))
+
+ class UsernameField(StringField):
+ def render_title(self, session):
+ return "Username"
- def render_broker_port_value(self, session, *args):
- host = self.host.get(session)
- if "port" in host:
- return host["port"]
+ def render_form_field_class(self, session):
+ return "compact"
- def render_broker_username_path(self, session, *args):
- return DictParameter.sep().join((self.host.path, "username"))
+ class PassField(PasswordField):
+ def render_title(self, session):
+ return "Password"
- def render_broker_password_path(self, session, *args):
- return DictParameter.sep().join((self.host.path, "password"))
+ def render_form_field_class(self, session):
+ return "compact last"
- def render_broker_username_value(self, session, *args):
- host = self.host.get(session)
- if "username" in host:
- return host["username"]
+ class TransportField(RadioField):
+ def __init__(self, app, name):
+ super(BrokerLinkAddForm.TransportField, self).__init__(app, name, None)
+
+ self.param = Parameter(app, "param")
+ self.param.default = "tcp"
+ self.add_parameter(self.param)
+
+ option = self.TCP(app, "tcp", self.param)
+ self.add_option(option)
+
+ option = self.SSL(app, "ssl", self.param)
+ self.add_option(option)
+
+ option = self.RDMA(app, "rdma", self.param)
+ self.add_option(option)
+
+ def render_title(self, session):
+ return "Transport-type"
+
+ def render_field_help(self, session):
+ return "(Transport to use)"
+
+ class TCP(RadioFieldOption):
+ def render_title(self, session):
+ return "tcp"
+
+ class SSL(RadioFieldOption):
+ def render_title(self, session):
+ return "ssl"
+
+ class RDMA(RadioFieldOption):
+ def render_title(self, session):
+ return "rdma"
+
+ class DurableField(TwoOptionRadioField):
+ def __init__(self, app, name, option1="yes", option2="no"):
+ super(BrokerLinkAddForm.DurableField, self).__init__(app, name, option1, option2)
- def render_broker_password_value(self, session, *args):
- host = self.host.get(session)
- if "password" in host:
- return host["password"]
+ self.option1_title = "Yes, restore if broker restarts"
+ self.option2_title = "No, do not restore if broker restarts"
+ self.param.default = option2
+
+ def render_title(self, session):
+ return "Restore if broker restarts?"
- def render_broker_name_error(self, session, *args):
- errors = self.errors.get(session)
- if "name" in errors:
- return "<ul class=\"errors\" style=\"float:left;\"><li>%s</li></ul>" % \
- errors["name"]
-
- def render_broker_port_error(self, session, *args):
- errors = self.errors.get(session)
- if "port" in errors:
- return "<ul class=\"errors\" style=\"float:left;\"><li>%s</li></ul>" % \
- errors["port"]
-
- def render_optional_prompt(self, session, *args):
- return "Optional"
-
+ def render_field_help(self, session):
+ return "(Should the added configuration be durable)"
+
+class BrokerLinkAdd(BrokerLinkAddForm):
def process_cancel(self, session):
- self.host.clear()
branch = session.branch()
self.frame.show_view(branch)
self.page.set_redirect_url(session, branch.marshal())
- def validate(self, session):
- errors = self.errors.get(session)
-
- host = self.host.get(session)
- if not "name" in host:
- errors["name"] = "Host name is required"
- if "port" in host:
- port = host["port"]
- try:
- # ensure a number and remove surrounding spaces
- port = str(int(port))
- except:
- errors["port"] = "Port must be a number"
-
- return not len(errors)
-
def process_submit(self, session):
-
- super_error = super(BrokerLinkAdd, self).validate(session)
-
- if self.validate(session) and not super_error:
+ if self.validate(session):
+ pass
+ else:
host = self.host.get(session)
- username = "anonymous"
- password = ""
- port = 5672
- addr = host["name"]
-
- if "port" in host:
- port = int(host["port"])
-
+ port = self.port.get(session) or 5672
+ if port:
+ port = int(port)
+ username = self.username.get(session) or "anonymous"
+ password = self.password.get(session)
durable = self.durable.get(session)
- if "username" in host:
- username = host["username"]
- if "password" in host:
- password = host["password"]
-
+ transport = self.transport.get(session)
+
link = Link()
- link.host = addr
+ link.host = host
link.port = port
- link.useSsl = False
- link.durable = (durable == "durable")
+ link.durable = (durable == "yes")
reg = self.frame.get_object(session)
args = {"reg": reg,
"username": username,
- "password": password}
+ "password": password,
+ "transport": transport}
action = self.app.model.broker.add_link
action.invoke(link, args)
@@ -594,23 +638,6 @@
# navigate back to main queue frame
self.process_cancel(session)
- class Errors(Attribute):
- def get_default(self, session):
- return dict()
-
- class SavedField(TwoOptionRadioField):
- def __init__(self, app, name, option1="notsaved", option2="saved"):
- super(BrokerLinkAdd.SavedField, self).__init__(app, name, option1, option2)
-
- self.option1_title = "No, do not restore if broker restarts"
- self.option2_title = "Yes, restore if broker restarts"
-
- def render_title(self, session):
- return "Restore if broker restarts?"
-
- def render_field_help(self, session):
- return "(Should the added configuration be durable)"
-
class BrokerSetClose(CuminBulkActionForm):
def process_return(self, session):
branch = session.branch()
Modified: mgmt/trunk/cumin/python/cumin/brokerlink.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerlink.strings 2008-11-08 17:46:25 UTC (rev 2766)
+++ mgmt/trunk/cumin/python/cumin/brokerlink.strings 2008-11-08 17:48:36 UTC (rev 2767)
@@ -99,101 +99,13 @@
<div>{hidden_inputs}</div>
</form>
-[BrokerLinkAdd.css]
-div.field div.input_prompt {
- width: 5em;
- padding-right: 1em;
- float:left;
-}
-
-div.multiple div.inputs {
- margin-bottom: 0.25em;
-}
-
-div.multiple {
- margin-bottom: 1em;
-}
-
-div.multiple div.input_prompt:after {
- content: ":";
-}
-
-div.multiple div.inputs input {
- float:left;
-}
-div.multiple div.inputs:after {
- content: ".";
- display: block;
- height: 0;
- clear: left;
- visibility: hidden;
-}
-div.multiple div.optional {
- background-color: #fcfcfc;
- border: 1px solid #999999;
- margin: 1.25em 1em 1em;
-}
-
-div.optional_prompt {
- background-color: #fcfcfc;
- border: 1px solid #cccccc;
- color: #999999;
- float:left;
- margin-left: 0.5em;
- padding: 0.25em 0.5em;
- position: relative;
- top: -1em;
-}
-
-div.optional_inputs {
- clear: left;
- position: relative;
- top: -0.5em;
-}
-
-[BrokerLinkAdd.html]
-<form id="{id}" class="mform" method="post" action="?">
- <div class="head">{title}</div>
- <div class="body">
- <div class="field multiple">
- <div class="title">Source Broker</div>
- <div class="inputs"><div class="input_prompt">Address</div><input type="text" name="{broker_name_path}" value="{broker_name_value}" tabindex="100" size="32"/>{broker_name_error}</div>
- <div class="optional">
- <div class="optional_prompt">{optional_prompt}</div>
- <div class="optional_inputs">
- <div class="inputs"><div class="input_prompt">Port</div><input type="text" name="{broker_port_path}" value="{broker_port_value}" tabindex="100" size="5"/>{broker_port_error}</div>
- <div class="inputs"><div class="input_prompt">Username</div><input type="text" name="{broker_username_path}" value="{broker_username_value}" tabindex="100" size="32"/></div>
- <div class="inputs"><div class="input_prompt">Password</div><input type="text" name="{broker_password_path}" value="{broker_password_value}" tabindex="100" size="32"/></div>
- </div>
- </div>
- </div>
- {fields}
- </div>
- <div class="foot">
- {help}
- {submit}
- {cancel}
- </div>
- <div>{hidden_inputs}</div>
-</form>
-<script type="text/javascript">
-<![CDATA[
- wooly.doc().elembyid("{id}").node.elements[0].focus();
-]]>
-</script>
-
-[ExchangeRadioField.exchange_html]
- <div class="field">
- <input id="{exchange_id}" type="radio" name="{exchange_name_path}" {checked} value="{exchange_value}"/>
- <label for="{exchange_id}">{exchange_name}</label>
- </div>
-
[ExchangeRadioField.html]
- <div class="rfloat">{phase}</div> <input id="phase_state" type="hidden" name="{phase_path}" value="" />
- <span class="legend">Choose an Exchange</span>
- <fieldset>
- {exchanges}
- </fieldset>
+<div class="{form_field_class}">
+ <div class="rfloat">{phase}</div>
+ <div class="title">{title}</div> <div class="field_help">{field_help}</div><div class="clear_left"></div>
+ {errors}
+ <div class="inputs">{inputs}</div><div style="clear:left;"><!-- --></div>
+</div>
[PeerRouteSetClose.html]
<form id="{id}" class="mform" method="post" action="?">
16 years, 2 months
rhmessaging commits: r2766 - mgmt/trunk/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-08 12:46:25 -0500 (Sat, 08 Nov 2008)
New Revision: 2766
Modified:
mgmt/trunk/cumin/python/wooly/forms.py
mgmt/trunk/cumin/python/wooly/forms.strings
Log:
Added compact version of FormField. This will display the field title to the left of the input and on the same line.
Modified: mgmt/trunk/cumin/python/wooly/forms.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.py 2008-11-06 22:32:22 UTC (rev 2765)
+++ mgmt/trunk/cumin/python/wooly/forms.py 2008-11-08 17:46:25 UTC (rev 2766)
@@ -280,6 +280,8 @@
self.__errors = FormErrorSet(app, "errors")
self.add_child(self.__errors)
+ self.css_class = "field"
+
def validate(self, session):
errors = self.__errors.get(session)
@@ -293,6 +295,9 @@
def render_field_help(self, session, *args):
pass
+ def render_form_field_class(self, session, *args):
+ return self.css_class
+
class ScalarField(FormField):
def __init__(self, app, name, input):
super(ScalarField, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.strings 2008-11-06 22:32:22 UTC (rev 2765)
+++ mgmt/trunk/cumin/python/wooly/forms.strings 2008-11-08 17:46:25 UTC (rev 2766)
@@ -72,10 +72,37 @@
div.field div.inputs {
margin: 0 0 1em 1em;
}
+div.field div.clear_left {
+ clear: left;
+}
+/* optional styles for displaying a FormField */
+div.compact {
+ padding: 0;
+ margin: 0;
+}
+div.compact div.title {
+ float: left;
+ margin: 0;
+ width: 6em;
+}
+div.compact div.field_help {
+ font-size: 0.9em;
+ color: #222;
+}
+div.compact div.inputs {
+ margin-left: 1em;
+}
+div.compact.first {
+ margin-top: 1em;
+}
+div.compact.last {
+ margin-bottom: 1em;
+}
+
[FormField.html]
-<div class="field">
- <div class="title">{title}</div> <div class="field_help">{field_help}</div><div style="clear:left;"><!-- --></div>
+<div class="{form_field_class}">
+ <div class="title">{title}</div> <div class="field_help">{field_help}</div><div class="clear_left"></div>
{errors}
<div class="inputs">{inputs}</div><div style="clear:left;"><!-- --></div>
</div>
16 years, 2 months
rhmessaging commits: r2765 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-06 17:32:22 -0500 (Thu, 06 Nov 2008)
New Revision: 2765
Modified:
mgmt/trunk/cumin/python/cumin/queue.py
Log:
Add process_cancel so QueueBindingAdd form returns properly after switching between Active and All
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-11-06 22:27:43 UTC (rev 2764)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-11-06 22:32:22 UTC (rev 2765)
@@ -710,6 +710,11 @@
return "<ul class=\"errors\" style=\"margin:0; float:left;\"><li>%s</li></ul>" % \
"</li><li>".join(errors["no_exchanges"])
+ def process_cancel(self, session):
+ branch = session.branch()
+ self.frame.show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
+
def process_submit(self, session):
queue = self.frame.get_object(session)
(errors, form_binding_info) = self.bindings.get_binding_errors(session, queue.name)
16 years, 2 months
rhmessaging commits: r2764 - mgmt/trunk/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-06 17:27:43 -0500 (Thu, 06 Nov 2008)
New Revision: 2764
Modified:
mgmt/trunk/cumin/python/wooly/forms.py
Log:
Prevent exception because of mismatch in number of arguments to render_field_help
Modified: mgmt/trunk/cumin/python/wooly/forms.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.py 2008-11-06 22:11:23 UTC (rev 2763)
+++ mgmt/trunk/cumin/python/wooly/forms.py 2008-11-06 22:27:43 UTC (rev 2764)
@@ -290,7 +290,7 @@
def do_validate(self, session, errors):
pass
- def render_field_help(self, session):
+ def render_field_help(self, session, *args):
pass
class ScalarField(FormField):
16 years, 2 months
rhmessaging commits: r2763 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-06 17:11:23 -0500 (Thu, 06 Nov 2008)
New Revision: 2763
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/widgets.strings
Log:
Changed daemon status message to use fmt_duration to show age of last Update.
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-11-06 21:38:32 UTC (rev 2762)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-11-06 22:11:23 UTC (rev 2763)
@@ -2377,23 +2377,13 @@
class GetStartedAction(CuminAction):
def get_xml_response(self, session, object, *args):
- confidence = self.started_confidence(object)
recTime = object.statsCurr and object.statsCurr.recTime or object.recTime
- conf = "<confidence>%d</confidence>" % confidence
- rect = "<rectime>%s</rectime>" % fmt_datetime(recTime)
+ delta = secs(recTime) - secs(datetime.now())
+ conf = "<age>%i</age>" % -delta
+ rect = "<rectime>%s</rectime>" % fmt_duration(delta)
return "%s%s" % (conf, rect)
- def started_confidence(self, object):
- value = object.statsCurr and object.statsCurr.recTime or object.recTime
- age = datetime.now() - value
- # 100% at now
- # 0% at 10 min
- confidence = float(600 - age.seconds) / 6.0
- if confidence < 0:
- confidence = 0
- return confidence
-
class CuminScheduler(RemoteClass):
def __init__(self, model):
super(CuminScheduler, self).__init__(model, "scheduler",
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2008-11-06 21:38:32 UTC (rev 2762)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2008-11-06 22:11:23 UTC (rev 2763)
@@ -1052,14 +1052,13 @@
var elem = document.getElementById(id);
if (elem) {
var recTime = obj.rectime;
- var confidence = obj.confidence;
+ var age = obj.age;
var color = "clear";
var oRecTime = document.getElementById("recTime");
if (oRecTime) {
oRecTime.innerHTML = recTime;
- fConfidence = parseFloat(confidence);
- if (fConfidence < 75) { /* hasn't changed in approx 2.5 minutes */
+ if (age > 150) { /* hasn't changed in 2.5 minutes */
color = "yellow";
} else {
color = "green";
16 years, 2 months
rhmessaging commits: r2762 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-06 16:38:32 -0500 (Thu, 06 Nov 2008)
New Revision: 2762
Modified:
mgmt/trunk/cumin/python/cumin/exchange.py
mgmt/trunk/cumin/python/cumin/exchange.strings
mgmt/trunk/cumin/python/cumin/model.py
Log:
Added new options on Add Exchange form
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-11-06 19:33:49 UTC (rev 2761)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-11-06 21:38:32 UTC (rev 2762)
@@ -343,40 +343,127 @@
self.exchange_name = ExchangeNameField(app, "exchange_name")
self.add_field(self.exchange_name)
- self.type = Parameter(app, "type")
- self.type.default = "direct"
- self.add_parameter(self.type)
+ self.exchange_type = self.ExchangeTypeField(app, "exchange_type")
+ self.add_field(self.exchange_type)
+
+ self.durable = self.ExchangeDurabilityField(app, "durable")
+ self.add_field(self.durable)
+
+ self.more = MoreFieldSet(app, "more")
+ self.add_field(self.more)
+
+ self.sequence = self.SequenceField(app, "sequence")
+ self.more.add_field(self.sequence)
+
+ self.ive = self.IVEField(app, "ive")
+ self.more.add_field(self.ive)
+
+ class SequenceField(TwoOptionRadioField):
+ def __init__(self, app, name, option1="yes", option2="no"):
+ super(ExchangeForm.SequenceField, self).__init__(app, name, option1, option2)
- self.direct = RadioInput(app, "direct", self.type)
- self.add_child(self.direct)
+ self.option1_title = "Insert Sequence"
+ self.option2_title = "No Sequence"
+ self.param.default = "no"
- self.topic = RadioInput(app, "topic", self.type)
- self.add_child(self.topic)
+ def render_title(self, session):
+ return "Insert Sequence?"
+
+ def render_field_help(self, session):
+ return "(Exchange will insert a 'qpid.msg_sequence' field in the message header)"
- self.fanout = RadioInput(app, "fanout", self.type)
- self.add_child(self.fanout)
+ class IVEField(TwoOptionRadioField):
+ def __init__(self, app, name, option1="yes", option2="no"):
+ super(ExchangeForm.IVEField, self).__init__(app, name, option1, option2)
+
+ self.option1_title = "Initial-Value-Exchange"
+ self.option2_title = "No IVE"
+ self.param.default = "no"
+
+ def render_title(self, session):
+ return "Initial Value Exchange?"
- self.headers = RadioInput(app, "headers", self.type)
- self.add_child(self.headers)
+ def render_field_help(self, session):
+ return "(Exchange will behave as an 'initial-value-exchange', keeping a reference to the last message forwarded and enqueuing that message to newly bound queues)"
+
+ class ExchangeDurabilityField(TwoOptionRadioField):
+ def __init__(self, app, name, option1="yes", option2="no"):
+ super(ExchangeForm.ExchangeDurabilityField, self).__init__(app, name, option1, option2)
+
+ self.option1_title = "Durable"
+ self.option2_title = "Transient"
+ self.param.default = "no"
+
+ def render_title(self, session):
+ return "Durable?"
- self.xml = RadioInput(app, "xml", self.type)
- self.add_child(self.xml)
-
- def render_direct_id(self, session, *args):
- return self.direct.path
+ def render_field_help(self, session):
+ return "(Queue is durable)"
+
+ class ExchangeTypeField(RadioField):
+ def __init__(self, app, name):
+ super(ExchangeForm.ExchangeTypeField, self).__init__(app, name, None)
- def render_topic_id(self, session, *args):
- return self.topic.path
+ self.param = Parameter(app, "param")
+ self.param.default = "direct"
+ self.add_parameter(self.param)
- def render_fanout_id(self, session, *args):
- return self.fanout.path
+ option = self.Direct(app, "direct", self.param)
+ self.add_option(option)
- def render_headers_id(self, session, *args):
- return self.headers.path
+ option = self.Topic(app, "topic", self.param)
+ self.add_option(option)
- def render_xml_id(self, session, *args):
- return self.xml.path
-
+ option = self.Fanout(app, "fanout", self.param)
+ self.add_option(option)
+
+ option = self.Headers(app, "headers", self.param)
+ self.add_option(option)
+
+ option = self.XML(app, "xml", self.param)
+ self.add_option(option)
+
+ def render_title(self, session):
+ return "Exchange Type"
+
+ def render_field_help(self, session):
+ return "(Type of exchange to add)"
+
+ class Direct(RadioFieldOption):
+ def render_value(self, session):
+ return "direct"
+
+ def render_title(self, session):
+ return "<em>Direct:</em> Route messages to queues by queue name"
+
+ class Topic(RadioFieldOption):
+ def render_value(self, session):
+ return "topic"
+
+ def render_title(self, session):
+ return "<em>Topic:</em> Route messages to queues by topic keyword match"
+
+ class Fanout(RadioFieldOption):
+ def render_value(self, session):
+ return "fanout"
+
+ def render_title(self, session):
+ return "<em>Fan Out:</em> Route message to all queues attached to this exchange"
+
+ class Headers(RadioFieldOption):
+ def render_value(self, session):
+ return "headers"
+
+ def render_title(self, session):
+ return "<em>Headers:</em> Route message to queues based on content of the message header"
+
+ class XML(RadioFieldOption):
+ def render_value(self, session):
+ return "xml"
+
+ def render_title(self, session):
+ return "<em>XML:</em> Route message to queues based on XML content of the message"
+
class ExchangeAdd(ExchangeForm):
def get_args(self, session):
return self.frame.frame.get_args(session)
@@ -395,10 +482,15 @@
reg = self.frame.get_object(session)
exchange = Exchange()
exchange.name = self.exchange_name.get(session)
- exchange.type = self.type.get(session)
+ exchange.type = self.exchange_type.get(session)
+ exchange.durable = self.durable.get(session) == "yes"
+ args = {}
+ args["reg"] = reg
+ args["sequence"] = self.sequence.get(session) == "yes"
+ args["ive"] = self.ive.get(session) == "yes"
action = self.app.model.broker.add_exchange
- action.invoke(exchange, reg)
+ action.invoke(exchange, args)
self.process_cancel(session)
Modified: mgmt/trunk/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.strings 2008-11-06 19:33:49 UTC (rev 2761)
+++ mgmt/trunk/cumin/python/cumin/exchange.strings 2008-11-06 21:38:32 UTC (rev 2762)
@@ -79,59 +79,6 @@
[ExchangeSet.item_html]
<tr>{cells}</tr>
-[ExchangeForm.html]
-<form id="{id}" class="ExchangeForm mform" method="post" action="?">
- <div class="head">
- <h1>{title}</h1>
- </div>
- <div class="body">
- <div class="field">{exchange_name}</div>
-
- <div style="clear:right;">
- <span class="legend">Type</span>
- <fieldset>
- <div class="field">
- {direct}
- <label for="{direct_id}"><em>Direct:</em> Route messages to queues by queue name</label>
- </div>
- <div class="field">
- {topic}
- <label for="{topic_id}"><em>Topic:</em> Route messages to queues by topic keyword match</label>
- </div>
- <div class="field">
- {fanout}
- <label for="{fanout_id}"><em>Fan Out:</em> Route message to all queues attached to this exchange</label>
- </div>
- <div class="field">
- {headers}
- <label for="{headers_id}"><em>Headers:</em> Route message to queues based on content of the message header</label>
- </div>
- <div class="field">
- {xml}
- <label for="{xml_id}"><em>XML:</em> Route message to queues based on XML content of the message</label>
- </div>
- </fieldset>
- </div>
-
- {hidden_inputs}
- </div>
- <div class="foot">
- {help}
- {submit}
- {cancel}
- </div>
-</form>
-<script type="text/javascript" defer="defer">
-<![CDATA[
-(function() {
- // elements[0] is a fieldset, at least in firefox
- var elem = wooly.doc().elembyid("{id}").node.elements[0];
- elem.focus();
- elem.select();
-}())
-]]>
-</script>
-
[ExchangeStatus.javascript]
function updateExchangeStatus(id, exchange) {
updateStatus(id, exchange);
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-11-06 19:33:49 UTC (rev 2761)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-11-06 21:38:32 UTC (rev 2762)
@@ -723,7 +723,7 @@
prop = CuminProperty(self, "dataDir")
prop.title = "Data Directory"
-
+
action = self.AddExchange(self, "add_exchange")
action.summary = True
@@ -747,6 +747,9 @@
return broker.id
class AddExchange(CuminAction):
+ MSG_SEQUENCE = "qpid.msg_sequence"
+ IVE = "qpid.ive"
+
def get_title(self, session):
return "Add Exchange"
@@ -757,10 +760,20 @@
frame = self.cumin_class.show_object(session, reg)
return frame.exchange_add.show(session)
- def do_invoke(self, exchange, reg, completion):
+ def do_invoke(self, exchange, args, completion):
+
+ reg = args["reg"]
+ declArgs = {}
+ if args["sequence"]:
+ declArgs[self.MSG_SEQUENCE] = 1
+ if args["ive"]:
+ declArgs[self.IVE] = 1
+
session = self.getSessionFromRegistration(reg)
session.exchange_declare(exchange=exchange.name,
- type=exchange.type)
+ type=exchange.type,
+ durable=exchange.durable,
+ arguments=declArgs)
# if the above call fails, an exception is
# raised and we won't get here
completion("OK")
@@ -1119,6 +1132,15 @@
prop.title = "Type"
prop.summary = True
+ prop = CuminProperty(self, "durable")
+ prop.title = "Durable?"
+ prop.summary = True
+
+ prop = CuminProperty(self, "arguments")
+ prop.title = "Arguments"
+ prop.prefix = "qpid."
+ prop.escape = False
+
stat = CuminStat(self, "producerCount")
stat.title = "Producers"
stat.unit = "producer"
16 years, 2 months
rhmessaging commits: r2761 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-06 14:33:49 -0500 (Thu, 06 Nov 2008)
New Revision: 2761
Modified:
mgmt/trunk/cumin/python/cumin/collector.py
mgmt/trunk/cumin/python/cumin/collector.strings
mgmt/trunk/cumin/python/cumin/limits.py
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/negotiator.py
mgmt/trunk/cumin/python/cumin/negotiator.strings
mgmt/trunk/cumin/python/cumin/scheduler.py
mgmt/trunk/cumin/python/cumin/scheduler.strings
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/cumin/python/cumin/widgets.strings
Log:
Changed the way daemon status is reported. No longer attempting to determine started or stopped. Just displaying the last time the daemon sent an update.
Modified: mgmt/trunk/cumin/python/cumin/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/collector.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -112,7 +112,7 @@
def __init__(self, app, name):
super(CollectorView, self).__init__(app, name)
- status = CollectorStatus(app, "status")
+ status = self.CollectorStatus(app, "status")
self.add_child(status)
self.__tabs = TabbedModeSet(app, "tabs")
@@ -125,24 +125,10 @@
data = "model.xml?class=collector;id=%i" % coll.id
return "wooly.setIntervalUpdate('%s', updateCollector, 3000)" % data
-class CollectorStatus(CuminStatus, AjaxField):
- def render_collector_status(self, session, collector):
- return ""
- #return "<span id=\"%s\"></span>%s" % \
- # (self.name, self.render_script(session))
-
- def render_color(self, session, collector):
- #return "transparent"
- return "green"
-
- def get_url(self, session):
- collector = self.get_args(session)[0]
- if collector:
- return "call.xml?class=collector;id=%i;method=GetStarted" % collector.id
-
- def got_fn(self, session):
- return "startstop_status"
-
+ class CollectorStatus(CuminStatus):
+ def render_title(self, session, object):
+ return "Collector Status"
+
class CollectorStart(CuminBulkActionForm):
def render_title(self, session, *args):
return "Start Collector"
Modified: mgmt/trunk/cumin/python/cumin/collector.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.strings 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/collector.strings 2008-11-06 19:33:49 UTC (rev 2761)
@@ -56,10 +56,3 @@
<div>{hidden_inputs}</div>
</form>
-
-[CollectorStatus.html]
-<div id="{id}" class="CuminStatus {color}">
- <h2>Collector Status</h2>
- {collector_status}
- <div id="recTime"></div>
-</div>
Modified: mgmt/trunk/cumin/python/cumin/limits.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/limits.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -239,7 +239,8 @@
self.__tabs.add_tab(details)
class LimitsStatus(CuminStatus):
- pass
+ def render_title(self, session, *args):
+ return "Limits Status"
class LimitsJobSet(JobTab):
def get_visible_columns(self, session):
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -2586,6 +2586,9 @@
action = self.GetLimitCount(self, "GetLimitCount")
action.navigable = False
+ action = GetStartedAction(self, "GetStarted")
+ action.navigable = False
+
def init(self):
self.frame = self.model.frame.pool.negotiator
Modified: mgmt/trunk/cumin/python/cumin/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/negotiator.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -27,9 +27,6 @@
self.add_column(col)
self.set_default_column(col)
- col = self.StartedColumn(app, "started")
- self.add_column(col)
-
col = self.SystemColumn(app, "system")
self.add_column(col)
@@ -64,29 +61,6 @@
return fmt_olink(branch, neg, name=data["name"])
- class StartedColumn(SqlTableColumn, AjaxField):
- def render_title(self, session, data):
- return "Status"
-
- def get_url(self, session):
- data = self.get_args(session)[0]
- negotiator = Negotiator.get(data["id"])
- if negotiator:
- return "call.xml?class=negotiator;id=%i;method=GetLimitCount" % negotiator.id
-
- def render_content(self, session, data):
- id = self.elem_id(session)
- return "<span id=\"%s\">Pending...%s</span>" % \
- (id, self.render_script(session))
-
- def elem_id(self, session):
- data = self.get_args(session)[0]
- id = data["id"]
- return "%s_%i" % (self.name, id)
-
- def get_fn(self, session):
- return self.elem_id(session)
-
class SystemColumn(SqlTableColumn):
def render_title(self, session, data):
return "System"
@@ -140,7 +114,7 @@
def __init__(self, app, name):
super(NegotiatorView, self).__init__(app, name)
- status = NegotiatorStatus(app, "status")
+ status = self.NegotiatorStatus(app, "status")
self.add_child(status)
self.__tabs = TabbedModeSet(app, "tabs")
@@ -149,37 +123,15 @@
details = CuminDetails(app, "details")
self.__tabs.add_tab(details)
-class NegotiatorStatus(CuminStatus, AjaxField):
- def render_negotiator_status(self, session, negotiator):
- if self.expired(session, negotiator):
- started = "Stopped"
- else:
- started = "Started"
- return "<span id=\"%s\">%s</span>%s" % \
- (self.name, started, self.render_script(session))
-
- def render_color(self, session, negotiator):
- if self.expired(session, negotiator):
- return "red"
- else:
- return "green"
-
- def expired(self, session, negotiator):
- value = negotiator.statsCurr.recTime
- expiry_time = datetime.now() - timedelta(minutes=2)
- if value and value > expiry_time:
- return False
- else:
- return True
-
- def get_url(self, session):
- negotiator = self.get_args(session)[0]
- if negotiator:
- return "call.xml?class=negotiator;id=%i;method=GetLimitCount" % negotiator.id
-
- def got_fn(self, session):
- return "negotiator_status"
-
+ class NegotiatorStatus(StartStopStatus):
+ def get_url(self, session):
+ negotiator = self.get_args(session)[0]
+ if negotiator:
+ return "call.xml?class=negotiator;id=%i;method=GetStarted" % negotiator.id
+
+ def render_title(self, session, *args):
+ return "Negotiator Status"
+
class NegStart(CuminBulkActionForm):
def render_title(self, session, *args):
return "Start Negotiator"
Modified: mgmt/trunk/cumin/python/cumin/negotiator.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-11-06 19:33:49 UTC (rev 2761)
@@ -55,40 +55,3 @@
</table>
<div>{hidden_inputs}</div>
</form>
-
-[NegotiatorStatus.html]
-<div id="{id}" class="CuminStatus {color}">
- <h2>Negotiator Status</h2>
- {negotiator_status}
-</div>
-
-[StartedColumn.javascript]
-function got_started(obj, id) {
- var elem = document.getElementById(id);
- if (elem) {
- var err = obj.error.value;
- var started = "Started";
- if (err == "True") {
- started = "Stopped"
- }
- elem.innerHTML = started;
- }
-}
-
-[NegotiatorStatus.javascript]
-function got_negotiator_status(obj, id) {
- var elem = document.getElementById(id);
- if (elem) {
- var err = obj.error.value;
- var started = "Started";
- var color = "green";
- if (err == "True") {
- started = "Stopped"
- color = "red"
- }
- elem.innerHTML = started;
- elem.parentNode.className = "CuminStatus " + color;
- setTimeout("get_status()", 1000)
- }
-}
-
Modified: mgmt/trunk/cumin/python/cumin/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/scheduler.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -125,7 +125,7 @@
def __init__(self, app, name):
super(SchedulerView, self).__init__(app, name)
- status = SchedulerStatus(app, "status")
+ status = self.SchedulerStatus(app, "status")
self.add_child(status)
self.__tabs = TabbedModeSet(app, "tabs")
@@ -144,22 +144,15 @@
data = "model.xml?class=scheduler;id=%i" % sched.id
return "wooly.setIntervalUpdate('%s', updateScheduler, 3000)" % data
-class SchedulerStatus(CuminStatus, AjaxField):
- def render_scheduler_status(self, session, scheduler):
- return "<span id=\"%s\"></span>%s" % \
- (self.name, self.render_script(session))
-
- def render_color(self, session, scheduler):
- return "transparent"
+ class SchedulerStatus(StartStopStatus):
+ def get_url(self, session):
+ scheduler = self.get_args(session)[0]
+ if scheduler:
+ return "call.xml?class=scheduler;id=%i;method=GetStarted" % scheduler.id
+
+ def render_title(self, session, *args):
+ return "Scheduler Status"
- def get_url(self, session):
- scheduler = self.get_args(session)[0]
- if scheduler:
- return "call.xml?class=scheduler;id=%i;method=GetStarted" % scheduler.id
-
- def got_fn(self, session):
- return "startstop_status"
-
class SchedulerStats(Widget):
def __init__(self, app, name):
super(SchedulerStats, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/scheduler.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-11-06 19:33:49 UTC (rev 2761)
@@ -99,54 +99,3 @@
<div>{hidden_inputs}</div>
</form>
-[SchedulerStatus.css]
-#recTime {
- display:none;
-}
-[SchedulerStatus.javascript]
-function got_startstop_status(obj, id) {
- var elem = document.getElementById(id);
- if (elem) {
- var recTime = obj.rectime;
- var confidence = obj.confidence;
- var color = "clear";
- var started = "Pending...";
- var timeout;
-
- var oRecTime = document.getElementById("recTime");
- if (oRecTime) {
- origRecTime = oRecTime.innerHTML;
- oRecTime.innerHTML = recTime;
- if (origRecTime == "") {
- timeout = 1000;
- } else if (recTime == origRecTime) {
- fConfidence = parseFloat(confidence);
- if (fConfidence < 75) { /* hasn't changed in approx 2.5 minutes */
- color = "red";
- started = "Stopped";
- timeout = 10000;
- }
- else {
- timeout = 1000;
- }
- } else {
- color = "green";
- started = "Started";
- timeout = 0;
- }
- elem.innerHTML = started;
- elem.parentNode.className = "CuminStatus " + color;
- if (timeout > 0) {
- setTimeout("get_status()", 5000);
- }
- }
- }
-}
-
-[SchedulerStatus.html]
-<div id="{id}" class="CuminStatus {color}">
- <h2>Scheduler Status</h2>
- {scheduler_status}
- <div id="recTime"></div>
-</div>
-
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-11-06 19:33:49 UTC (rev 2761)
@@ -307,7 +307,6 @@
else:
return "green"
-
class CuminEditableProperties(PropertySet):
def __init__(self, app, name):
self.item_renderer=EditablePropertyRenderer(self, "property_html")
@@ -1099,6 +1098,19 @@
def elem_id(self, session):
return self.name
+class StartStopStatus(CuminStatus, AjaxField):
+ def render_start_stop_script(self, session, scheduler):
+ return self.render_script(session)
+
+ def render_color(self, session, scheduler):
+ return "clear"
+
+ def got_fn(self, session):
+ return "startstop_status"
+
+ def elem_id(self, session):
+ return self.render_id(session)
+
class MoreFieldSet(FieldForm, FormField):
def __init__(self, app, name):
super(MoreFieldSet, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2008-11-06 18:26:07 UTC (rev 2760)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2008-11-06 19:33:49 UTC (rev 2761)
@@ -1041,4 +1041,40 @@
}
</script>
-
+[StartStopStatus.css]
+div.status_time {
+ font-size: 0.80em;
+ color: #444444;
+}
+
+[StartStopStatus.javascript]
+function got_startstop_status(obj, id) {
+ var elem = document.getElementById(id);
+ if (elem) {
+ var recTime = obj.rectime;
+ var confidence = obj.confidence;
+ var color = "clear";
+
+ var oRecTime = document.getElementById("recTime");
+ if (oRecTime) {
+ oRecTime.innerHTML = recTime;
+ fConfidence = parseFloat(confidence);
+ if (fConfidence < 75) { /* hasn't changed in approx 2.5 minutes */
+ color = "yellow";
+ } else {
+ color = "green";
+ }
+ elem.className = "CuminStatus " + color;
+ }
+ setTimeout("get_status()", 5000);
+ }
+}
+
+[StartStopStatus.html]
+<div id="{id}" class="CuminStatus {color}">
+ <h2>{title}</h2>
+ <div class="status_time">
+ Last update was <span id="recTime"></span>
+ </div>
+</div>{start_stop_script}
+
16 years, 2 months
rhmessaging commits: r2760 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-11-06 13:26:07 -0500 (Thu, 06 Nov 2008)
New Revision: 2760
Modified:
mgmt/trunk/cumin/python/cumin/collector.py
mgmt/trunk/cumin/python/cumin/collector.strings
mgmt/trunk/cumin/python/cumin/negotiator.py
mgmt/trunk/cumin/python/cumin/negotiator.strings
mgmt/trunk/cumin/python/cumin/scheduler.py
mgmt/trunk/cumin/python/cumin/scheduler.strings
Log:
Don't assume the presence of corresponding system data for grid daemons
Modified: mgmt/trunk/cumin/python/cumin/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.py 2008-11-06 17:30:20 UTC (rev 2759)
+++ mgmt/trunk/cumin/python/cumin/collector.py 2008-11-06 18:26:07 UTC (rev 2760)
@@ -64,10 +64,13 @@
return "System"
def render_content(self, session, data):
- sys = Identifiable(data["system_id"])
- href = self.page.main.system.get_href(session, sys)
- return fmt_link(href, data["system_name"])
+ id = data["system_id"]
+ if id:
+ sys = Identifiable(id)
+ href = self.page.main.system.get_href(session, sys)
+ return fmt_link(href, data["system_name"])
+
class StartButton(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
Modified: mgmt/trunk/cumin/python/cumin/collector.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.strings 2008-11-06 17:30:20 UTC (rev 2759)
+++ mgmt/trunk/cumin/python/cumin/collector.strings 2008-11-06 18:26:07 UTC (rev 2760)
@@ -5,7 +5,7 @@
y.id as system_id,
y.node_name as system_name
from collector as c
-inner join system as y on c.system = y.node_name
+left outer join system as y on c.system = y.node_name
left outer join collector_stats as cs on cs.id = c.stats_curr_id
{sql_where}
{sql_orderby}
Modified: mgmt/trunk/cumin/python/cumin/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.py 2008-11-06 17:30:20 UTC (rev 2759)
+++ mgmt/trunk/cumin/python/cumin/negotiator.py 2008-11-06 18:26:07 UTC (rev 2760)
@@ -92,10 +92,13 @@
return "System"
def render_content(self, session, data):
- sys = Identifiable(data["system_id"])
- href = self.page.main.system.get_href(session, sys)
- return fmt_link(href, data["system_name"])
+ id = data["system_id"]
+ if id:
+ sys = Identifiable(id)
+ href = self.page.main.system.get_href(session, sys)
+ return fmt_link(href, data["system_name"])
+
class StartButton(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
Modified: mgmt/trunk/cumin/python/cumin/negotiator.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-11-06 17:30:20 UTC (rev 2759)
+++ mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-11-06 18:26:07 UTC (rev 2760)
@@ -6,7 +6,7 @@
y.node_name as system_name
from negotiator as n
left outer join negotiator_stats as c on c.id = n.stats_curr_id
-inner join system as y on n.system = y.node_name
+left outer join system as y on n.system = y.node_name
{sql_where}
{sql_orderby}
{sql_limit}
Modified: mgmt/trunk/cumin/python/cumin/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.py 2008-11-06 17:30:20 UTC (rev 2759)
+++ mgmt/trunk/cumin/python/cumin/scheduler.py 2008-11-06 18:26:07 UTC (rev 2760)
@@ -77,10 +77,13 @@
return "System"
def render_content(self, session, data):
- sys = Identifiable(data["system_id"])
- href = self.page.main.system.get_href(session, sys)
- return fmt_link(href, data["system_name"])
+ id = data["system_id"]
+ if id:
+ sys = Identifiable(id)
+ href = self.page.main.system.get_href(session, sys)
+ return fmt_link(href, data["system_name"])
+
class StartButton(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
Modified: mgmt/trunk/cumin/python/cumin/scheduler.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-11-06 17:30:20 UTC (rev 2759)
+++ mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-11-06 18:26:07 UTC (rev 2760)
@@ -9,7 +9,7 @@
c.total_held_jobs as held
from scheduler as s
left outer join scheduler_stats as c on c.id = s.stats_curr_id
-inner join system as y on s.system = y.node_name
+left outer join system as y on s.system = y.node_name
{sql_where}
{sql_orderby}
{sql_limit}
16 years, 2 months