rhmessaging commits: r2327 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-20 14:00:21 -0400 (Wed, 20 Aug 2008)
New Revision: 2327
Modified:
mgmt/trunk/cumin/python/cumin/page.strings
Log:
Fix intermittent radiobutton spacing problem
Modified: mgmt/trunk/cumin/python/cumin/page.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.strings 2008-08-19 19:39:13 UTC (rev 2326)
+++ mgmt/trunk/cumin/python/cumin/page.strings 2008-08-20 18:00:21 UTC (rev 2327)
@@ -278,7 +278,7 @@
ul.radiotabs li {
display: inline;
- margin: 0 0.75em 0 0;
+ padding: 0 0.75em 0 0;
}
ul.radiotabs li:last-child {
17 years, 7 months
rhmessaging commits: r2326 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-08-19 15:39:13 -0400 (Tue, 19 Aug 2008)
New Revision: 2326
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
Log:
Minor tidy-up of misbehaving log entry for xids, added missing doxygen entry for extra param
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-08-19 19:38:53 UTC (rev 2325)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-08-19 19:39:13 UTC (rev 2326)
@@ -1042,7 +1042,16 @@
assert(!ofs.fail());
// log write action
std::ostringstream oss;
- oss << "Recover phase write: Aborted unprepared transaction xid=" << xid << " at offs=0x" << std::hex << file_pos << std::dec;
+ oss << std::hex << std::setfill('0') << "Recover phase write: Aborted unprepared transaction xid=\"";
+ for (std::size_t i=0; i<xid.size(); i++)
+ {
+ int c = xid.at(i);
+ if (std::isprint(c))
+ oss << (char)c;
+ else
+ oss << "\\x" << std::setw(2) << c;
+ }
+ oss << "\" at offs=0x" << file_pos;
this->log(LOG_NOTICE, oss.str());
file_pos = ofs.tellp();
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-08-19 19:38:53 UTC (rev 2325)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-08-19 19:39:13 UTC (rev 2326)
@@ -411,6 +411,11 @@
* NOTE: If there is an xid, then xidpp must be freed.
* \param dtokp Pointer to data_tok instance for this data, used to track state of data
* through journal.
+ * \param ignore_pending_txns When false (default), if the next record to be read is locked
+ * by a pending transaction, the read fails with RHM_IORES_TXPENDING. However, if set
+ * to true, then locks are ignored. This is required for reading of the Transaction
+ * Prepared List (TPL) which may have its entries locked, but may be read from
+ * time-to-time, and needs all its records (locked and unlocked) to be available.
*
* \exception TODO
*/
17 years, 7 months
rhmessaging commits: r2325 - store/branches/mrg-1.0/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-08-19 15:38:53 -0400 (Tue, 19 Aug 2008)
New Revision: 2325
Modified:
store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.cpp
store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.hpp
Log:
Minor tidy-up of misbehaving log entry for xids, added missing doxygen entry for extra param
Modified: store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.cpp 2008-08-19 18:57:33 UTC (rev 2324)
+++ store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.cpp 2008-08-19 19:38:53 UTC (rev 2325)
@@ -1048,7 +1048,16 @@
assert(!ofs.fail());
// log write action
std::ostringstream oss;
- oss << "Recover phase write: Aborted unprepared transaction xid=" << xid << " at offs=0x" << std::hex << file_pos << std::dec;
+ oss << std::hex << std::setfill('0') << "Recover phase write: Aborted unprepared transaction xid=\"";
+ for (std::size_t i=0; i<xid.size(); i++)
+ {
+ int c = xid.at(i);
+ if (std::isprint(c))
+ oss << (char)c;
+ else
+ oss << "\\x" << std::setw(2) << c;
+ }
+ oss << "\" at offs=0x" << file_pos;
this->log(LOG_NOTICE, oss.str());
file_pos = ofs.tellp();
Modified: store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.hpp 2008-08-19 18:57:33 UTC (rev 2324)
+++ store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.hpp 2008-08-19 19:38:53 UTC (rev 2325)
@@ -411,6 +411,11 @@
* NOTE: If there is an xid, then xidpp must be freed.
* \param dtokp Pointer to data_tok instance for this data, used to track state of data
* through journal.
+ * \param ignore_pending_txns When false (default), if the next record to be read is locked
+ * by a pending transaction, the read fails with RHM_IORES_TXPENDING. However, if set
+ * to true, then locks are ignored. This is required for reading of the Transaction
+ * Prepared List (TPL) which may have its entries locked, but may be read from
+ * time-to-time, and needs all its records (locked and unlocked) to be available.
*
* \exception TODO
*/
17 years, 7 months
rhmessaging commits: r2324 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-19 14:57:33 -0400 (Tue, 19 Aug 2008)
New Revision: 2324
Modified:
mgmt/trunk/cumin/python/cumin/util.py
Log:
Adding import of timedelta
Modified: mgmt/trunk/cumin/python/cumin/util.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/util.py 2008-08-19 18:47:05 UTC (rev 2323)
+++ mgmt/trunk/cumin/python/cumin/util.py 2008-08-19 18:57:33 UTC (rev 2324)
@@ -1,5 +1,5 @@
from ConfigParser import SafeConfigParser
-from datetime import datetime
+from datetime import datetime, timedelta
from logging import getLogger
from time import mktime
from random import randint
17 years, 7 months
rhmessaging commits: r2323 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-19 14:47:05 -0400 (Tue, 19 Aug 2008)
New Revision: 2323
Modified:
mgmt/trunk/cumin/python/cumin/queue.py
Log:
Removing process_cancel methods that just return to the original page, since that is the default behavior now.
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-08-19 17:48:00 UTC (rev 2322)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-08-19 18:47:05 UTC (rev 2323)
@@ -349,11 +349,6 @@
return (errors or super_error, form_binding_info)
class QueueAdd(QueueForm):
- 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_name = self.namef.get(session)
durable = self.durable.get(session)
@@ -395,11 +390,6 @@
def render_title(self, session, queue):
return "Remove Queue '%s'" % queue.name
- def process_cancel(self, session, queue):
- branch = session.branch()
- self.frame.show_view(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
def process_submit(self, session, queue):
action = self.app.model.queue.remove
action.invoke(queue)
@@ -425,11 +415,6 @@
def render_title(self, session, queue):
return "Purge Messages from Queue '%s'" % queue.name
- def process_cancel(self, session, queue):
- branch = session.branch()
- self.frame.show_view(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
def process_submit(self, session, queue):
request_amt = self.purge_request.get(session)
args = dict()
@@ -547,11 +532,6 @@
def post_process(self, session):
self.bindings.post_process(session)
- 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)
@@ -590,11 +570,6 @@
def get_args(self, session):
return self.frame.get_args(session)
- def process_cancel(self, session, binding):
- branch = session.branch()
- self.page.show_queue(branch, binding.get_queue()).show_view(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
def process_submit(self, session, binding):
log.info("Removing binding %s" % binding)
17 years, 7 months
rhmessaging commits: r2322 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-19 13:48:00 -0400 (Tue, 19 Aug 2008)
New Revision: 2322
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Default form cancel to return to original page.
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-19 16:40:10 UTC (rev 2321)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-19 17:48:00 UTC (rev 2322)
@@ -162,7 +162,7 @@
self.post_process(session, *args)
def process_cancel(self, session, *args):
- pass
+ self.page.set_redirect_url(session, self.get_origin(session))
def process_submit(self, session, *args):
pass
17 years, 7 months
rhmessaging commits: r2321 - mgmt/trunk/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-19 12:40:10 -0400 (Tue, 19 Aug 2008)
New Revision: 2321
Modified:
mgmt/trunk/cumin/python/wooly/__init__.py
mgmt/trunk/cumin/python/wooly/forms.py
mgmt/trunk/cumin/python/wooly/server.py
Log:
Save the http_referer (origin) so forms can easily return to it
Modified: mgmt/trunk/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/__init__.py 2008-08-19 14:50:32 UTC (rev 2320)
+++ mgmt/trunk/cumin/python/wooly/__init__.py 2008-08-19 16:40:10 UTC (rev 2321)
@@ -467,6 +467,7 @@
self.page = None
self.values = dict()
self.credentials = dict()
+ self.origin = None
if self.app.debug:
self.debug = self.Debug(self)
@@ -612,6 +613,12 @@
except ValueError:
pass
+ def set_origin(self, origin):
+ self.origin = origin
+
+ def get_origin(self):
+ return self.origin
+
def __repr__(self):
return "%s(trunk=%s,app=%s)" % \
(self.__class__.__name__, self.trunk, self.app)
Modified: mgmt/trunk/cumin/python/wooly/forms.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.py 2008-08-19 14:50:32 UTC (rev 2320)
+++ mgmt/trunk/cumin/python/wooly/forms.py 2008-08-19 16:40:10 UTC (rev 2321)
@@ -11,12 +11,34 @@
self.form_params = set()
+ self.origin = Parameter(app, "origin")
+ self.add_parameter(self.origin)
+
+ def get_origin(self, session):
+ origin = self.origin.get(session)
+
+ # this will happen if we load the page
+ # directly from a saved url and not through
+ # a link on another page
+ if not origin:
+ try:
+ branch = session.branch()
+ self.frame.show_view(branch)
+ origin = branch.marshal()
+ except: # we don't have a show_view
+ pass
+
+ return origin
+
def add_form_parameter(self, param):
self.form_params.add(param)
def render_hidden_inputs(self, session, *args):
writer = Writer()
+ # remember our roots
+ if not self.origin.get(session):
+ self.origin.set(session, session.get_origin())
params = set(session.get_page().get_saved_parameters(session))
params.difference_update(self.form_params)
Modified: mgmt/trunk/cumin/python/wooly/server.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/server.py 2008-08-19 14:50:32 UTC (rev 2320)
+++ mgmt/trunk/cumin/python/wooly/server.py 2008-08-19 16:40:10 UTC (rev 2321)
@@ -35,6 +35,8 @@
session = Session(self.app)
session.unmarshal_page(env["PATH_INFO"])
session.unmarshal_url_vars(env["QUERY_STRING"])
+ if "HTTP_REFERER" in env:
+ session.set_origin(env["HTTP_REFERER"])
if "HTTP_AUTHORIZATION" in env:
auth = env["HTTP_AUTHORIZATION"].split(" ")[1]
17 years, 7 months
rhmessaging commits: r2320 - in mgmt/trunk: mint/python/mint and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-08-19 10:50:32 -0400 (Tue, 19 Aug 2008)
New Revision: 2320
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/cumin/python/cumin/widgets.strings
mgmt/trunk/mint/python/mint/schema.py
mgmt/trunk/mint/sql/schema.sql
Log:
whenry's patch to allow purging n messages from the top of a queue
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-08-18 18:19:16 UTC (rev 2319)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-08-19 14:50:32 UTC (rev 2320)
@@ -848,7 +848,7 @@
return "Purge"
def do_invoke(self, queue, args, completion):
- queue.purge(self.cumin_model.data, completion)
+ queue.purge(self.cumin_model.data, completion, args["request"])
class Remove(CuminAction):
def show(self, session, queue):
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-08-18 18:19:16 UTC (rev 2319)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-08-19 14:50:32 UTC (rev 2320)
@@ -412,12 +412,18 @@
def render_cancel_content(self, session, queue):
return "No, Cancel"
-class QueuePurge(CuminConfirmForm):
+class QueuePurge(CuminFieldForm):
+ def __init__(self, app, name):
+ super(QueuePurge, self).__init__(app, name)
+
+ self.purge_request = MultiplicityField(app, "purge_request", self)
+ self.add_field(self.purge_request)
+
def get_args(self, session):
return self.frame.get_args(session)
def render_title(self, session, queue):
- return "Purge Queue '%s'" % queue.name
+ return "Purge Messages from Queue '%s'" % queue.name
def process_cancel(self, session, queue):
branch = session.branch()
@@ -425,13 +431,25 @@
self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, queue):
+ request_amt = self.purge_request.get(session)
+ args = dict()
+
+ if request_amt == "all":
+ args["request"] = 0
+ elif request_amt == "top":
+ args["request"] = 1
+ elif request_amt == "N":
+ args["request"] = self.purge_request.top_n.get_n_value(session)
+ else:
+ raise Exception("Wrong Value")
+
action = self.app.model.queue.purge
- action.invoke(queue)
+ action.invoke(queue, args)
self.process_cancel(session, queue)
def render_submit_content(self, session, queue):
- return "Yes, Purge Queue '%s'" % queue.name
+ return "Yes, Purge Messages from Queue '%s'" % queue.name
def render_cancel_content(self, session, queue):
return "No, Cancel"
@@ -445,8 +463,12 @@
def process_item(self, session, id):
queue = Queue.get(id)
+
+ args = dict()
+ args["request"] = 0
+
action = self.app.model.queue.purge
- action.invoke(queue)
+ action.invoke(queue, args)
def render_title(self, session):
return "Purge Queues"
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-18 18:19:16 UTC (rev 2319)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-19 14:50:32 UTC (rev 2320)
@@ -765,6 +765,60 @@
def render_title(self, session):
return "Non-exclusive"
+class MultiplicityField(RadioField):
+ def __init__(self, app, name, form):
+ super(MultiplicityField, self).__init__(app, name, form)
+
+ param = Parameter(app, "param")
+ param.default = "all"
+ self.add_parameter(param)
+ self.set_parameter(param)
+
+ self.add_option(self.All(app, "all", form))
+ self.add_option(self.Top(app, "top", form))
+ self.top_n = self.TopN(app, "topn", form)
+ self.add_option(self.top_n)
+
+ def render_title(self, session):
+ return "Select all, the top message or the top n messages"
+
+ class All(RadioFieldOption):
+ def render_value(self, session):
+ return "all"
+
+ def render_title(self, session):
+ return "All"
+
+ class Top(RadioFieldOption):
+ def render_value(self, session):
+ return "top"
+
+ def render_title(self, session):
+ return "Top message"
+
+ class TopN(RadioFieldOption):
+ def __init__(self, app, name, form):
+ super(MultiplicityField.TopN, self).__init__(app, name, form)
+
+ self.__n_value = IntegerParameter(app, "arg")
+ form.add_form_parameter(self.__n_value)
+ self.add_parameter(self.__n_value)
+
+ def render_value(self, session):
+ return "N"
+
+ def render_arg_name(self, session):
+ return self.__n_value.path
+
+ def render_arg_value(self, session):
+ return 0
+
+ def get_n_value(self, session):
+ return self.__n_value.get(session)
+
+ def render_title(self, session):
+ return
+
class AutoDeleteField(RadioField):
def __init__(self, app, name, form):
super(AutoDeleteField, self).__init__(app, name, form)
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2008-08-18 18:19:16 UTC (rev 2319)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2008-08-19 14:50:32 UTC (rev 2320)
@@ -343,6 +343,13 @@
<th><input id="{id}" type="checkbox"
onclick="checkAll('{id}', '{form_id}', '{elem_name}')"/></th>
+[TopN.html]
+<div>
+ <input type="radio" name="{name}" id="{id}" value="{value}" tabindex="{tab_index}" {checked_attr} {disabled_attr}/>
+ Top
+ <input type="text" name="{arg_name}" value="{arg_value}" /> messages
+</div>
+
[FormHelp.javascript]
function help_window(href) {
var left = screen.availWidth / 2;
@@ -361,4 +368,3 @@
[FormHelp.html]
<a class="help action" id="help_link" href="{help_href}">Help</a>
-
\ No newline at end of file
Modified: mgmt/trunk/mint/python/mint/schema.py
===================================================================
--- mgmt/trunk/mint/python/mint/schema.py 2008-08-18 18:19:16 UTC (rev 2319)
+++ mgmt/trunk/mint/python/mint/schema.py 2008-08-19 14:50:32 UTC (rev 2320)
@@ -75,7 +75,7 @@
callback, args=actualArgs)
def echo(self, model, callback, sequence, body):
- """Request a response to test the path to the management agent"""
+ """Request a response to test the path to the management broker"""
actualArgs = dict()
actualArgs["sequence"] = sequence
actualArgs["body"] = body
@@ -122,10 +122,11 @@
managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('AgentStats', cascade='null', default=None)
statsPrev = ForeignKey('AgentStats', cascade='null', default=None)
- sessionName = StringCol(length=1000, default=None)
+ clientConnection = ForeignKey('ClientConnection', cascade='null', default=None)
label = StringCol(length=1000, default=None)
registeredTo = BigIntCol(default=None)
systemId = BLOBCol(default=None)
+ objectIdBank = IntCol(default=None)
classInfos = dict() # brokerId => classInfo
@@ -189,9 +190,10 @@
classInfos = dict() # brokerId => classInfo
- def purge(self, model, callback):
- """Discard all messages on queue"""
+ def purge(self, model, callback, request):
+ """Discard all or some messages on a queue"""
actualArgs = dict()
+ actualArgs["request"] = request
conn = model.connections[self.managedBroker]
classInfo = self.classInfos[self.managedBroker]
conn.callMethod(self.idOriginal, classInfo, "purge",
@@ -639,6 +641,9 @@
classToSchemaNameMap['Agent'] = 'Agent'
schemaNameToClassMap['Agent'] = Agent
+ClientConnection.sqlmeta.addJoin(SQLMultipleJoin('Agent', joinMethodName='agents'))
+
+
Agent.sqlmeta.addJoin(SQLMultipleJoin('AgentStats', joinMethodName='stats'))
classToSchemaNameMap['Vhost'] = 'Vhost'
Modified: mgmt/trunk/mint/sql/schema.sql
===================================================================
--- mgmt/trunk/mint/sql/schema.sql 2008-08-18 18:19:16 UTC (rev 2319)
+++ mgmt/trunk/mint/sql/schema.sql 2008-08-19 14:50:32 UTC (rev 2320)
@@ -65,10 +65,11 @@
managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
- session_name VARCHAR(1000),
+ client_connection_id INT,
label VARCHAR(1000),
registered_to BIGINT,
- system_id BYTEA
+ system_id BYTEA,
+ object_id_bank INT
);
CREATE TABLE agent_stats (
@@ -464,6 +465,8 @@
ALTER TABLE agent ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES agent_stats (id) ON DELETE SET NULL;
+ALTER TABLE agent ADD CONSTRAINT client_connection_id_exists FOREIGN KEY (client_connection_id) REFERENCES client_connection (id) ON DELETE SET NULL;
+
ALTER TABLE agent_stats ADD CONSTRAINT agent_id_exists FOREIGN KEY (agent_id) REFERENCES agent (id) ON DELETE SET NULL;
ALTER TABLE binding ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
17 years, 7 months
rhmessaging commits: r2319 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-18 14:19:16 -0400 (Mon, 18 Aug 2008)
New Revision: 2319
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Remove extraneous attribute from column constructor
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-18 17:54:53 UTC (rev 2318)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-18 18:19:16 UTC (rev 2319)
@@ -493,11 +493,11 @@
self.ids = CheckboxIdColumn(app, "id", self)
self.add_column(self.ids)
- col = self.QNameColumn(app, "q_id", hidden=True)
- self.add_column(col)
+ col = self.QNameColumn(app, "q_id")
+ self.add_hidden_column(col)
- col = self.ENameColumn(app, "e_id", hidden=True)
- self.add_column(col)
+ col = self.ENameColumn(app, "e_id")
+ self.add_hidden_column(col)
col = self.KeyColumn(app, "key")
self.add_column(col)
17 years, 7 months
rhmessaging commits: r2318 - mgmt/trunk/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-08-18 13:54:53 -0400 (Mon, 18 Aug 2008)
New Revision: 2318
Modified:
mgmt/trunk/cumin/python/wooly/tables.py
Log:
Support for hidden columns
Modified: mgmt/trunk/cumin/python/wooly/tables.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/tables.py 2008-08-18 17:54:17 UTC (rev 2317)
+++ mgmt/trunk/cumin/python/wooly/tables.py 2008-08-18 17:54:53 UTC (rev 2318)
@@ -10,10 +10,13 @@
self.columns = list()
self.headers_by_column = dict()
+ self.hidden_column_names = list()
+ # which column are we sorting on
self.scolumn = Parameter(app, "col")
self.add_parameter(self.scolumn)
+ # is sort asc
self.reversed = BooleanParameter(app, "rev")
self.reversed.default = False
self.add_parameter(self.reversed)
@@ -29,6 +32,17 @@
if self.scolumn.default is None:
self.scolumn.default = column.name
+ def add_hidden_column(self, column):
+ self.add_column(column)
+ self.hide_column(column.name)
+
+ def hide_column(self, column_name):
+ self.hidden_column_names.append(column_name)
+
+ def show_column(self, column_name):
+ if column_name in self.hidden_column_names:
+ self.hidden_column_names.remove(column_name)
+
def set_header(self, column, header):
self.headers_by_column[column] = header
@@ -57,20 +71,22 @@
writer = Writer()
for column in self.columns:
- header = self.headers_by_column[column]
- writer.write(header.render(session))
+ if not column.name in self.hidden_column_names:
+ header = self.headers_by_column[column]
+ writer.write(header.render(session))
return writer.to_string()
def render_column_count(self, session, *args):
- return len(self.columns)
+ return len(self.columns) - len(self.hidden_column_names)
def render_cells(self, session, item):
writer = Writer()
for col in self.columns:
col.set_item(session, item)
- writer.write(col.render(session))
+ if not col.name in self.hidden_column_names:
+ writer.write(col.render(session))
return writer.to_string()
@@ -234,15 +250,6 @@
return writer.to_string()
- def render_cells(self, session, data):
- writer = Writer()
-
- for col in self.columns:
- col.set_item(session, data)
- writer.write(col.render(session))
-
- return writer.to_string()
-
class SqlTableColumn(ItemTableColumn):
def get_orderby_sql(self, session):
key = self.get_column_key(session)
17 years, 7 months