rhmessaging commits: r3676 - mgmt/trunk/cumin/python/cumin/messaging.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-10-21 20:17:56 -0400 (Wed, 21 Oct 2009)
New Revision: 3676
Modified:
mgmt/trunk/cumin/python/cumin/messaging/broker.py
mgmt/trunk/cumin/python/cumin/messaging/broker.strings
mgmt/trunk/cumin/python/cumin/messaging/brokergroup.py
mgmt/trunk/cumin/python/cumin/messaging/brokergroup.strings
mgmt/trunk/cumin/python/cumin/messaging/model.py
Log:
Added list of group checkboxes to 'Add to groups' form
Modified: mgmt/trunk/cumin/python/cumin/messaging/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/broker.py 2009-10-21 14:22:23 UTC (rev 3675)
+++ mgmt/trunk/cumin/python/cumin/messaging/broker.py 2009-10-22 00:17:56 UTC (rev 3676)
@@ -14,6 +14,7 @@
from connection import *
from brokerlink import LinkSet
+from brokergroup import BrokerGroupInputSet
strings = StringCatalog(__file__)
@@ -330,7 +331,30 @@
self.object = ListParameter(app, "broker", item)
self.add_parameter(self.object)
-# def process_submit(self, session):
-# pass
+ self.__groups = BrokerGroupInputSet(app, "group")
+ self.add_child(self.__groups)
-from brokergroup import BrokerGroupCheckboxField
+ def render_content(self, session):
+ obj = self.object.get(session)
+ if len(obj) == 0:
+ return "Please select one or more brokers first"
+ else:
+ return "%s?%s" % (self.task.get_description(session, obj),
+ self.__groups.render(session))
+
+ def do_process(self, session):
+ super(BrokerSetEngroupForm, self).do_process(session)
+ # initialize which groups are already checked
+ # for this set of brokers
+ brokers = self.object.get(session)
+ broker_ids = [x.id for x in brokers]
+ mappings = BrokerGroupMapping.select()
+ groups = [BrokerGroup.get(x.brokerGroupID) for x in mappings if x.brokerID in broker_ids]
+ self.__groups.param.set(session, groups)
+
+ def process_submit(self, session):
+ brokers = self.object.get(session)
+ groups = self.__groups.get(session)
+ if len(brokers):
+ self.task.invoke(session, brokers, groups)
+ self.task.exit_with_redirect(session, brokers)
Modified: mgmt/trunk/cumin/python/cumin/messaging/broker.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/broker.strings 2009-10-21 14:22:23 UTC (rev 3675)
+++ mgmt/trunk/cumin/python/cumin/messaging/broker.strings 2009-10-22 00:17:56 UTC (rev 3676)
@@ -106,12 +106,6 @@
font-style: italic;
}
-[BrokerGroupInputSet.item_html]
-<div class="field">
- <input type="checkbox" id="{id}" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
- <label for="{id}">{item_content}</label>
-</div>
-
[BrokerAccessControlView.html]
<table class="twocol">
<tbody>
@@ -145,3 +139,13 @@
</tr>
</tbody>
</table>
+
+[BrokerSetEngroupForm.css]
+div.content ul {
+ list-style: none;
+}
+
+[BrokerSetEngroupForm.javascript]
+window.addEvent('domready',function () {
+ $$('button')[0].focus();
+});
Modified: mgmt/trunk/cumin/python/cumin/messaging/brokergroup.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/brokergroup.py 2009-10-21 14:22:23 UTC (rev 3675)
+++ mgmt/trunk/cumin/python/cumin/messaging/brokergroup.py 2009-10-22 00:17:56 UTC (rev 3676)
@@ -65,19 +65,6 @@
if group in self.param.get(session):
return "checked=\"checked\""
-class BrokerGroupCheckboxField(FormField):
- def __init__(self, app, name):
- super(BrokerGroupCheckboxField, self).__init__(app, name)
-
- self.__groups = BrokerGroupInputSet(app, "inputs")
- self.add_child(self.__groups)
-
- def get(self, session):
- return self.__groups.get(session)
-
- def render_title(self, session):
- return "Broker Groups"
-
class BrokerGroupFrame(CuminFrame):
def __init__(self, app, name):
super(BrokerGroupFrame, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/messaging/brokergroup.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/brokergroup.strings 2009-10-21 14:22:23 UTC (rev 3675)
+++ mgmt/trunk/cumin/python/cumin/messaging/brokergroup.strings 2009-10-22 00:17:56 UTC (rev 3676)
@@ -6,3 +6,10 @@
[BrokerGroupSet.count_sql]
select count(*) from broker_group
+
+[BrokerGroupInputSet.item_html]
+<div class="field">
+ <input type="checkbox" id="{id}.{item_value}" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
+ <label for="{id}.{item_value}">{item_content}</label>
+</div>
+
Modified: mgmt/trunk/cumin/python/cumin/messaging/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/model.py 2009-10-21 14:22:23 UTC (rev 3675)
+++ mgmt/trunk/cumin/python/cumin/messaging/model.py 2009-10-22 00:17:56 UTC (rev 3676)
@@ -456,8 +456,24 @@
def get_title(self, session):
return "Add to groups"
- def do_invoke(self, session, broker):
- print "XXX engroup", broker
+ def do_invoke(self, session, broker, selected_groups):
+ all_groups = BrokerGroup.select()
+ selected_ids = [x.id for x in selected_groups]
+ for group in all_groups:
+ sql_sel = "broker_id=%i and broker_group_id=%i" % \
+ (broker.id, group.id)
+ existing_mapping = BrokerGroupMapping.select(sql_sel)
+ if not group.id in selected_ids:
+ if existing_mapping.count() > 0:
+ # remove mapping if group is not checked and there
+ # is already a mapping
+ existing_mapping[0].destroySelf()
+ else:
+ if existing_mapping.count() == 0:
+ # add mapping if group is checked but there
+ # is not already a mapping
+ new_mapping = BrokerGroupMapping(brokerID=broker.id, brokerGroupID=group.id)
+ new_mapping.syncUpdate()
class BrokerSetEngroupTask(SetTask):
def __init__(self, app, cls):
@@ -473,9 +489,6 @@
def do_enter(self, session, brokers):
self.form.object.set(session, brokers)
- def do_invoke(self, session, brokers):
- pass
-
def get_vhost_name(vhost):
broker = vhost.broker
name = broker.system.nodeName
16 years, 6 months
rhmessaging commits: r3675 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-10-21 10:22:23 -0400 (Wed, 21 Oct 2009)
New Revision: 3675
Modified:
store/trunk/cpp/lib/StorePlugin.cpp
Log:
Fix for steve huston's recent checkin on qpid.
Modified: store/trunk/cpp/lib/StorePlugin.cpp
===================================================================
--- store/trunk/cpp/lib/StorePlugin.cpp 2009-10-19 20:23:30 UTC (rev 3674)
+++ store/trunk/cpp/lib/StorePlugin.cpp 2009-10-21 14:22:23 UTC (rev 3675)
@@ -53,7 +53,8 @@
options.storeDir = dataDir.getPath ();
}
- store->init(&options);
+ MessageStore* sp = store.get();
+ static_cast<mrg::msgstore::MessageStoreImpl*>(sp)->init(&options);
broker->setStore (store);
target.addFinalizer(boost::bind(&StorePlugin::finalize, this));
}
16 years, 6 months
rhmessaging commits: r3674 - in mgmt/trunk/sesame/cpp: src and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2009-10-19 16:23:30 -0400 (Mon, 19 Oct 2009)
New Revision: 3674
Modified:
mgmt/trunk/sesame/cpp/configure.ac
mgmt/trunk/sesame/cpp/src/SysAgent.cpp
Log:
Close standard FDs prior to entering the main execute loop.
Updated dependent library information.
Modified: mgmt/trunk/sesame/cpp/configure.ac
===================================================================
--- mgmt/trunk/sesame/cpp/configure.ac 2009-10-16 20:32:03 UTC (rev 3673)
+++ mgmt/trunk/sesame/cpp/configure.ac 2009-10-19 20:23:30 UTC (rev 3674)
@@ -87,8 +87,8 @@
QMF_GEN=$QPID_DIR/cpp/managementgen/qmf-gen
test -f $QPID_INCLUDE/qpid/agent/ManagementAgent.h || \
AC_MSG_ERROR([$QPID_DIR does not appear to be a valid qpid checkout.])
- QPID_LIBS="$QPID_SRC/libqmfagent.la"
- QPID_CXXFLAGS="-I$QPID_SRC -I${QPID_SRC}/gen"
+ QPID_LIBS="$QPID_SRC/libqmf.la"
+ QPID_CXXFLAGS="-I$QPID_SRC"
else
fail=0
AC_CHECK_PROG([QMF_GEN], [qmf-gen], [qmf-gen], [no])
Modified: mgmt/trunk/sesame/cpp/src/SysAgent.cpp
===================================================================
--- mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2009-10-16 20:32:03 UTC (rev 3673)
+++ mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2009-10-19 20:23:30 UTC (rev 3674)
@@ -372,6 +372,10 @@
agent->init(settings, interval, false, options["state-dir"].value + "/agentdata");
+ ::close(0);
+ ::close(1);
+ ::close(2);
+
// Allocate core object
SysAgent core(agent, options["state-dir"].value + "/uuid");
core.run();
16 years, 6 months
rhmessaging commits: r3673 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-10-16 16:32:03 -0400 (Fri, 16 Oct 2009)
New Revision: 3673
Modified:
mgmt/trunk/cumin/python/cumin/widgets.strings
Log:
Comment out background page when form is visible to prevent flash control from showing
Modified: mgmt/trunk/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.strings 2009-10-16 20:30:42 UTC (rev 3672)
+++ mgmt/trunk/cumin/python/cumin/widgets.strings 2009-10-16 20:32:03 UTC (rev 3673)
@@ -686,7 +686,7 @@
z-index: -2;
}
-div.BackgroundGlass {
+div#BackgroundGlass {
width: 100%;
height: 100%;
position: absolute;
@@ -696,8 +696,8 @@
}
[BackgroundInclude.html]
-<div class="BackgroundGlass"><!-- prevents clicks since disabled doesn't work on objects --></div>
-<object class="BackgroundInclude" data="{data}" type="{type}" />
+<div id="BackgroundGlass"><!-- prevents clicks since disabled doesn't work on objects --></div>
+<!-- <object class="BackgroundInclude" data="{data}" type="{type}" /> -->
[FormHelp.javascript]
function help_window(href) {
16 years, 6 months
rhmessaging commits: r3672 - mgmt/trunk/cumin/resources.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-10-16 16:30:42 -0400 (Fri, 16 Oct 2009)
New Revision: 3672
Modified:
mgmt/trunk/cumin/resources/slots.swf
Log:
Fix label position
Modified: mgmt/trunk/cumin/resources/slots.swf
===================================================================
(Binary files differ)
16 years, 6 months
rhmessaging commits: r3671 - in mgmt/trunk: cumin/python/cumin and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-10-16 12:56:17 -0400 (Fri, 16 Oct 2009)
New Revision: 3671
Removed:
mgmt/trunk/bin/quirk
mgmt/trunk/cumin/python/cumin/quirk.py
Log:
Remove some unused code
Deleted: mgmt/trunk/bin/quirk
===================================================================
--- mgmt/trunk/bin/quirk 2009-10-09 16:32:27 UTC (rev 3670)
+++ mgmt/trunk/bin/quirk 2009-10-16 16:56:17 UTC (rev 3671)
@@ -1,140 +0,0 @@
-#!/usr/bin/env python
-
-import sys, qpid
-from time import sleep
-from random import random, sample, randint
-
-from cumin.quirk import *
-
-class TestCommand(object):
- def __init__(self, name):
- self.name = name
-
- def run(self, client):
- session = Session(client)
- session.open()
-
- try:
- q = Queue("quirk.test")
-
- if not q.exists(session):
- q.declare(session)
-
- s = Subscription(q)
- s.init(session)
-
- for i in range(0, 10):
- print i,
- m = Message("message %i" % i)
- m.send(session, q)
- print "Sent", m
-
- for i in range(0, 10):
- print i,
- m = s.get(session)
- print "Received", m
- finally:
- session.close()
-
-class BenchCommand(object):
- def __init__(self, name):
- self.name = name
-
- def run(self, client):
- session = Session(client)
- session.open()
-
- try:
- q = Queue("quirk.bench")
-
- if not q.exists(session):
- q.declare(session)
-
- s = Subscription(q)
-
- i = 0
-
- while True:
- m = Message(str(i))
- m.send(session, q)
-
- if i % 1000 == 0:
- print ".",
-
- i += 1
- finally:
- session.close()
-
-class DemoCommand(object):
- def __init__(self, name):
- self.name = name
-
- def run(self, client):
- session = Session(client)
- session.open()
-
- qs = list()
- es = list()
-
- try:
- for i in range(0, 30):
- name = "demo%02i" % (i + 1)
-
- q = Queue(name)
- q.declare(session)
-
- qs.append(q)
-
- e = Exchange(name)
- e.declare(session)
-
- es.append(e)
-
- while True:
- sqs = sample(qs, 5)
-
- for q in sqs:
- m = Message("test")
- m.send(session, q)
-
- sleep(1)
-
- finally:
- session.close()
-
-def usage():
- print "Usage: quirk COMMAND [IP:PORT]"
- sys.exit(2)
-
-commands = dict()
-commands["test"] = TestCommand("test")
-commands["bench"] = BenchCommand("bench")
-commands["demo"] = DemoCommand("demo")
-
-if __name__ == "__main__":
- if len(sys.argv) < 2:
- usage();
-
- command = sys.argv[1]
-
- if command not in commands:
- print "Unknown command '%s'" % command
- usage()
-
- try:
- addr = sys.argv[2].split(":")
-
- if len(addr) > 1:
- host, port = addr[0], int(addr[1])
- else:
- host, port = addr[0], 5672
- except IndexError:
- host, port = "localhost", 5672
-
- client = Client(host, port)
- client.login("guest", "guest")
-
- try:
- commands[command].run(client)
- except KeyboardInterrupt:
- pass
Deleted: mgmt/trunk/cumin/python/cumin/quirk.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/quirk.py 2009-10-09 16:32:27 UTC (rev 3670)
+++ mgmt/trunk/cumin/python/cumin/quirk.py 2009-10-16 16:56:17 UTC (rev 3671)
@@ -1,116 +0,0 @@
-import sys, qpid
-from time import sleep
-from random import random, sample, randint
-
-class Exchange(object):
- def __init__(self, name, type="direct"):
- self.name = name
- self.type = type
-
- def declare(self, session):
- session.psession.exchange_declare(exchange=self.name, type=self.type)
-
- def exists(self, session):
- return False #XXX figure out how to do this
-
-class Queue(object):
- def __init__(self, name):
- self.name = name
-
- def declare(self, session):
- session.psession.queue_declare(queue=self.name)
-
- def exists(self, session):
- return False #XXX figure out how to do this
-
- def bind(self, session, exchange, key=None):
- if key is None:
- key = self.name
-
- session.psession.queue_bind(exchange=exchange.name,
- queue=self.name,
- routing_key=key)
-
-class Subscription(object):
- def __init__(self, queue):
- self.name = queue.name # XXX bad?
- self.queue = queue
- self.client_queue = None
-
- def init(self, session):
- session.psession.message_subscribe(queue=self.queue.name,
- destination=self.name)
-
- session.psession.message_flow(self.name, 0, 0xFFFFFFFF)
- session.psession.message_flow(self.name, 1, 0xFFFFFFFF)
-
- self.client_queue = session.client.pconn.queue(self.name)
-
- def get(self, session):
- if self.client_queue is None:
- raise Exception()
-
- m = Message()
- m.content = self.client_queue.get(timeout=10).content
-
- return m
-
-class Message(object):
- def __init__(self, payload=None):
- self.content = qpid.content.Content()
- self.content["content_type"] = "text/plain"
-
- if payload is not None:
- self.set_payload(payload)
-
- def set_payload(self, payload):
- self.content.body = payload
-
- def send(self, session, dest, key=None):
- if dest.__class__ is Queue:
- self.content["routing_key"] = dest.name
- session.psession.message_transfer(destination="",
- content=self.content)
- elif dest.__class__ is Exchange:
- if routing_key is None:
- raise Exception("Routing key not set")
-
- session.psession.message_transfer(destination=dest.name,
- content=self.content)
- else:
- raise Exception("Unknown destination object")
-
- def __str__(self):
- return self.content.body
-
-class Connection(object):
- def __init__(self, host, port, spec_path):
- self.host = host
- self.port = port
- self.spec = qpid.spec.load(spec_path)
-
- self.pconn = None
-
- def open(self):
- assert self.pconn is None
-
- sock = qpid.util.connect(self.host, self.port)
- self.pconn = qpid.connection.Connection(sock, self.spec)
- self.pconn.start()
-
- def close(self):
- assert self.pconn
-
- self.pconn.close()
-
-class Session(object):
- def __init__(self, conn, name):
- self.conn = conn
- self.name = name
- self.psession = conn.pconn.session(name)
-
- def open(self):
- pass
-
- def close(self):
- self.psession.close()
16 years, 6 months
rhmessaging commits: r3670 - mgmt/trunk/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-10-09 12:32:27 -0400 (Fri, 09 Oct 2009)
New Revision: 3670
Modified:
mgmt/trunk/cumin/python/cumin/grid/pool.py
mgmt/trunk/cumin/python/cumin/grid/pool.strings
Log:
Add "By accounting group" to flash slot vis groupby radiobuttons
Removed {wmode: "opaque"} from flash slot vis HTML to avoid flash v10 drawing problem. **Note: this causes a different problem: the slot flash control will overlay the Create Submission form. This will be fixed separately.**
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-10-07 14:55:57 UTC (rev 3669)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-10-09 16:32:27 UTC (rev 3670)
@@ -463,7 +463,7 @@
super(PoolSlotFlashVis.GroupBySwitch, self).__init__(app, name)
self.add_state("system", "By system")
- #self.add_state("state", "By slot state")
+ self.add_state("accounting_group", "By accounting group")
self.add_state("None", "No Grouping")
def get_click(self, session, state):
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.strings 2009-10-07 14:55:57 UTC (rev 3669)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.strings 2009-10-09 16:32:27 UTC (rev 3670)
@@ -120,8 +120,8 @@
if (fsm)
fsm.style.display = "block";
- swfobject.embedSWF("resource?name=slots.swf", "{id}_chart", "{slot_chart_width}", "{slot_chart_height}", "9.0.0", "", {vis:"slots"}, {wmode: "opaque"});
- swfobject.embedSWF("resource?name=slots.swf", "{id}ctrl_chart", "{slot_chart_width}", "{slot_ctrl_height}", "9.0.0", "", {vis:"ctrl"}, {wmode: "opaque"});
+ swfobject.embedSWF("resource?name=slots.swf", "{id}_chart", "{slot_chart_width}", "{slot_chart_height}", "9.0.0", "", {vis:"slots"});
+ swfobject.embedSWF("resource?name=slots.swf", "{id}ctrl_chart", "{slot_chart_width}", "{slot_ctrl_height}", "9.0.0", "", {vis:"ctrl"});
wooly.addPageUpdateListener(function () { updatePoolSlotVis('{id}', "reload"); });
wooly.addPageUpdateListener(function () { updatePoolSlotVis('{id}ctrl', "reload"); });
16 years, 6 months
rhmessaging commits: r3669 - in mgmt/trunk: wooly/python/wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-10-07 10:55:57 -0400 (Wed, 07 Oct 2009)
New Revision: 3669
Modified:
mgmt/trunk/cumin/python/cumin/main.py
mgmt/trunk/cumin/python/cumin/server.py
mgmt/trunk/cumin/python/cumin/test.py
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/wooly/python/wooly/server.py
Log:
Move auth checking into CuminPage
Modified: mgmt/trunk/cumin/python/cumin/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/main.py 2009-10-05 18:34:36 UTC (rev 3668)
+++ mgmt/trunk/cumin/python/cumin/main.py 2009-10-07 14:55:57 UTC (rev 3669)
@@ -70,15 +70,11 @@
self.add_page(StatFlashPage(self, "chart.json"))
self.add_page(FlashFullPage(self, "flashpage.html"))
- unprotected = set()
+ self.login_page.protected = False
+ self.login_page.css_page.protected = False
+ self.login_page.javascript_page.protected = False
+ self.resource_page.protected = False
- unprotected.add(self.resource_page)
- unprotected.add(self.login_page)
- unprotected.add(self.login_page.css_page)
- unprotected.add(self.login_page.javascript_page)
-
- self.unprotected_pages = unprotected
-
self.user_sessions_by_id = dict()
self.user_session_expire_thread = UserSessionExpireThread(self)
Modified: mgmt/trunk/cumin/python/cumin/server.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/server.py 2009-10-05 18:34:36 UTC (rev 3668)
+++ mgmt/trunk/cumin/python/cumin/server.py 2009-10-07 14:55:57 UTC (rev 3669)
@@ -11,43 +11,4 @@
class CuminServer(WebServer):
def authorized(self, session):
- auth = False
- page = session.page
-
- if page in self.app.unprotected_pages:
- return True
-
- id = session.get_cookie("session")
-
- if id is not None:
- usess = self.app.user_sessions_by_id.get(id)
-
- if usess is not None:
- timeout = timedelta(seconds=3600)
- now = datetime.now()
-
- if now > usess.created and now < usess.created + timeout:
- setattr(session, "user_session", usess)
-
- return True
-
- if self.app.config.user:
- user = Subject.getByName(self.app.config.user)
-
- assert user
-
- usess = UserSession(self.app, user)
- session.set_cookie("session", usess.id)
-
- page.redirect.set(session, session.marshal())
-
- return False
-
- lpage = self.app.login_page
-
- lsess = Session(lpage)
- lpage.origin.set(lsess, session.marshal())
-
- page.redirect.set(session, lsess.marshal())
-
- return False
+ return True
Modified: mgmt/trunk/cumin/python/cumin/test.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/test.py 2009-10-05 18:34:36 UTC (rev 3668)
+++ mgmt/trunk/cumin/python/cumin/test.py 2009-10-07 14:55:57 UTC (rev 3669)
@@ -1,6 +1,8 @@
+from mint import Subject
from parsley.test import *
from wooly import *
+from user import *
from util import *
log = logging.getLogger("cumin.test")
@@ -10,6 +12,7 @@
super(CuminTest, self).__init__("cumin", None)
self.app = app
+ self.user = None
def init(self):
for module in self.app.modules:
@@ -30,6 +33,12 @@
if not connected:
raise Exception("Failed to connect to broker")
+ self.user = Subject.getByName("tester")
+
+ if not self.user:
+ self.user = Subject(name="tester")
+ self.user.syncUpdate()
+
super(CuminTest, self).do_run(session)
class TaskFormTest(Test):
@@ -66,6 +75,9 @@
def __init__(self, harness):
super(MainPageSession, self).__init__(harness.test.app.main_page)
+ usess = UserSession(harness.test.app, harness.test.user)
+ self.user_session = usess
+
def retry(fn):
result = None
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2009-10-05 18:34:36 UTC (rev 3668)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2009-10-07 14:55:57 UTC (rev 3669)
@@ -12,6 +12,7 @@
from widgets import *
from charts import *
from formats import *
+from user import *
from util import *
import time
@@ -135,11 +136,6 @@
self.show_object(branch, object)
return branch.marshal()
- def do_process(self, session, *args):
- self.page.get_frames(session).append(self)
-
- super(CuminFrame, self).do_process(session, *args)
-
def render_href(self, session, *args):
branch = session.branch()
@@ -175,9 +171,12 @@
def render_frames(self, session):
writer = Writer()
- for frame in self.page.get_frames(session):
- self.__frame_tmpl.render(writer, session, frame)
+ for frame in reversed(self.frame.ancestors):
+ if isinstance(frame, CuminFrame):
+ self.__frame_tmpl.render(writer, session, frame)
+ self.__frame_tmpl.render(writer, session, self.frame)
+
return writer.to_string()
def render_frame(self, session, frame):
@@ -1297,33 +1296,59 @@
def __init__(self, app, name):
super(CuminPage, self).__init__(app, name)
- self.__frames = self.FramesAttribute(app, "frames")
- self.add_attribute(self.__frames)
+ self.protected = True
- self.__modal = Attribute(app, "modal")
- self.add_attribute(self.__modal)
-
self.user = UserAttribute(app, "user")
self.add_attribute(self.user)
- def save_session(self, session):
- if self.app.debug:
- self.app.debug.sessions.append(session)
+ def do_process(self, session):
+ if self.authorized(session):
+ super(CuminPage, self).do_process(session)
- def set_modal(self, session, modal):
- self.__modal.set(session, modal)
+ def authorized(self, session):
+ if not self.protected:
+ return True
- def get_frames(self, session):
- return self.__frames.get(session)
+ id = session.get_cookie("session")
- def render_class(self, session):
- return self.__modal.get(session) and "modal" or "_"
+ if id is not None:
+ usess = self.app.user_sessions_by_id.get(id)
- class FramesAttribute(Attribute):
- def get_default(self, session):
- return list()
+ if usess is not None:
+ timeout = timedelta(seconds=3600)
+ now = datetime.now()
-class CuminFormPage(HtmlPage):
+ if now > usess.created and now < usess.created + timeout:
+ setattr(session, "user_session", usess)
+
+ return True
+
+ if self.app.config.user:
+ user = Subject.getByName(self.app.config.user)
+
+ assert user
+
+ usess = UserSession(self.app, user)
+ session.set_cookie("session", usess.id)
+
+ self.redirect.set(session, session.marshal())
+
+ return True
+
+ lpage = self.app.login_page
+
+ lsess = Session(lpage)
+ lpage.origin.set(lsess, session.marshal())
+
+ self.redirect.set(session, lsess.marshal())
+
+ return False
+
+ def save_session(self, session):
+ if self.app.debug:
+ self.app.debug.sessions.append(session)
+
+class CuminFormPage(CuminPage):
def __init__(self, app, name):
super(CuminFormPage, self).__init__(app, name)
Modified: mgmt/trunk/wooly/python/wooly/server.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/server.py 2009-10-05 18:34:36 UTC (rev 3668)
+++ mgmt/trunk/wooly/python/wooly/server.py 2009-10-07 14:55:57 UTC (rev 3669)
@@ -50,7 +50,7 @@
self.adapt_request_environment(env, session)
if not self.authorized(session):
- url = page.get_redirect_url(session)
+ url = page.redirect.get(session)
if url:
return self.send_redirect(response, headers, session, url)
@@ -62,7 +62,7 @@
except:
return self.send_error(response, headers, session)
- url = page.get_redirect_url(session)
+ url = page.redirect.get(session)
if url:
return self.send_redirect(response, headers, session, url)
16 years, 6 months
rhmessaging commits: r3668 - in mgmt/trunk/cumin/python/cumin: usergrid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-10-05 14:34:36 -0400 (Mon, 05 Oct 2009)
New Revision: 3668
Modified:
mgmt/trunk/cumin/python/cumin/grid/pool.py
mgmt/trunk/cumin/python/cumin/grid/scheduler.py
mgmt/trunk/cumin/python/cumin/grid/submission.py
mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
Log:
* Move the href getters to the more specific variants of
SubmissionSet
* Introduce extra frames into usergrid ui so we can add
single-submission and single-slot frames
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-10-05 17:48:58 UTC (rev 3667)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-10-05 18:34:36 UTC (rev 3668)
@@ -13,7 +13,7 @@
from job import *
from scheduler import SchedulerSet, SchedulerFrame
-from submission import SubmissionSet
+from submission import *
from submitter import SubmitterSet, SubmitterFrame
from collector import CollectorSet, CollectorFrame
from negotiator import NegotiatorSet, NegotiatorFrame
@@ -85,6 +85,9 @@
self.view = PoolView(app, "view", self.object)
self.add_mode(self.view)
+ self.submission = SubmissionFrame(app, "submission")
+ self.add_mode(self.submission)
+
self.job = JobFrame(app, "job")
self.add_mode(self.job)
@@ -151,6 +154,19 @@
link = TaskLink(app, "add", task, self.pool)
self.links.add_child(link)
+ def get_submission_href(self, session, id):
+ submission = Identifiable(id)
+ return main.module.frame.pool.submission.get_href(session, submission)
+
+ def get_submitter_href(self, session, id):
+ submitter = Identifiable(id)
+ return main.module.frame.pool.scheduler.submitter.get_href \
+ (session, submitter)
+
+ def get_scheduler_href(self, session, id):
+ scheduler = Identifiable(id)
+ return main.module.frame.pool.scheduler.get_href(session, scheduler)
+
def render_sql_where(self, session):
return "where d.pool = %(pool)s"
@@ -467,4 +483,4 @@
def render_content(self, session):
return self.flash_chart.render(session)
-
\ No newline at end of file
+
Modified: mgmt/trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/scheduler.py 2009-10-05 17:48:58 UTC (rev 3667)
+++ mgmt/trunk/cumin/python/cumin/grid/scheduler.py 2009-10-05 18:34:36 UTC (rev 3668)
@@ -148,9 +148,6 @@
self.view = SchedulerView(app, "view", self.object)
self.add_mode(self.view)
- self.submission = SubmissionFrame(app, "submission")
- self.add_mode(self.submission)
-
self.submitter = SubmitterFrame(app, "sub", self.object)
self.add_mode(self.submitter)
Modified: mgmt/trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/submission.py 2009-10-05 17:48:58 UTC (rev 3667)
+++ mgmt/trunk/cumin/python/cumin/grid/submission.py 2009-10-05 18:34:36 UTC (rev 3668)
@@ -35,17 +35,13 @@
self.add_column(col)
def get_submission_href(self, session, id):
- submission = Identifiable(id)
- return main.module.frame.pool.scheduler.submission.get_href \
- (session, submission)
+ raise Exception("Not implemented")
def get_submitter_href(self, session, id):
- submitter = Identifiable(id)
- return main.module.frame.pool.scheduler.submitter.get_href \
- (session, submitter)
+ raise Exception("Not implemented")
def get_scheduler_href(self, session, id):
- pass
+ raise Exception("Not implemented")
def render_title(self, session):
return "Submissions %s" % fmt_count(self.get_item_count(session))
@@ -98,9 +94,6 @@
self.view = SubmissionView(app, "view", self.object)
self.add_child(self.view)
- def render_title(self, session):
- return "Submission"
-
class SubmissionView(CuminView):
def __init__(self, app, name, submission):
super(SubmissionView, self).__init__(app, name, submission)
Modified: mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/widgets.py 2009-10-05 17:48:58 UTC (rev 3667)
+++ mgmt/trunk/cumin/python/cumin/usergrid/widgets.py 2009-10-05 18:34:36 UTC (rev 3668)
@@ -15,7 +15,10 @@
from model import *
from widgets import *
+import main
+
strings = StringCatalog(__file__)
+log = logging.getLogger("cumin.usergrid.widgets")
class MainPage(CuminPage, ModeSet):
def __init__(self, app, name):
@@ -35,10 +38,10 @@
self.overview = OverviewFrame(app, "overview", user)
self.add_tab(self.overview)
- self.submissions = UserSubmissionSet(app, "submissions", user)
+ self.submissions = SubmissionsFrame(app, "submissions", user)
self.add_tab(self.submissions)
- self.slots = UserSlotSet(app, "slots", user)
+ self.slots = SlotsFrame(app, "slots", user)
self.add_tab(self.slots)
class OverviewFrame(CuminFrame):
@@ -61,6 +64,19 @@
self.stats = UserSlotStatSet(self.app, "slots", user)
self.add_child(self.stats)
+class SubmissionsFrame(CuminFrame):
+ def __init__(self, app, name, user):
+ super(SubmissionsFrame, self).__init__(app, name)
+
+ self.view = UserSubmissionSet(app, "view", user)
+ self.add_mode(self.view)
+
+ self.submission = SubmissionFrame(app, "submission")
+ self.add_mode(self.submission)
+
+ def render_title(self, session):
+ return "Submissions"
+
class UserSubmissionSet(SubmissionSet):
def __init__(self, app, name, user):
super(UserSubmissionSet, self).__init__(app, name)
@@ -74,6 +90,11 @@
link = TaskLink(app, "add", task, None)
self.links.add_child(link)
+ def get_submission_href(self, session, id):
+ submission = Identifiable(id)
+ return self.page.main.submissions.submission.get_href \
+ (session, submission)
+
def render_sql_where(self, session):
pass # XXX return "where m.name = %(name)s"
@@ -81,6 +102,19 @@
user = self.page.user.get(session)
return {"name": user.name}
+class SlotsFrame(CuminFrame):
+ def __init__(self, app, name, user):
+ super(SlotsFrame, self).__init__(app, name)
+
+ self.view = UserSlotSet(app, "view", user)
+ self.add_mode(self.view)
+
+ self.slot = SlotFrame(app, "slot")
+ self.add_mode(self.slot)
+
+ def render_title(self, session):
+ return "Slots"
+
class UserSlotSet(SlotSet):
def __init__(self, app, name, user):
super(UserSlotSet, self).__init__(app, name)
16 years, 6 months
rhmessaging commits: r3667 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-10-05 13:48:58 -0400 (Mon, 05 Oct 2009)
New Revision: 3667
Modified:
mgmt/trunk/cumin/python/cumin/stat.py
Log:
Added duration parameter to StatValueChart href so default duration will be recognized
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2009-10-05 15:58:23 UTC (rev 3666)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2009-10-05 17:48:58 UTC (rev 3667)
@@ -135,6 +135,7 @@
params.append("class=%s" % cls)
params.append("id=%i" % object.id)
params.append("chart_id=%s" % self.render_id(session, None))
+ params.append("duration=%s" % self.duration.get(session))
for stat in self.stats:
params.append("stat=%s" % stat)
16 years, 6 months