[rhmessaging-commits] rhmessaging commits: r3214 - mgmt/trunk/notes.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Wed Mar 25 18:08:00 EDT 2009
Author: eallen
Date: 2009-03-25 18:08:00 -0400 (Wed, 25 Mar 2009)
New Revision: 3214
Added:
mgmt/trunk/notes/javascript session.txt
Log:
Notes on how to use the session/branch javascript in app.js
Added: mgmt/trunk/notes/javascript session.txt
===================================================================
--- mgmt/trunk/notes/javascript session.txt (rev 0)
+++ mgmt/trunk/notes/javascript session.txt 2009-03-25 22:08:00 UTC (rev 3214)
@@ -0,0 +1,90 @@
+To modify a cumin url, use the session javascript object included in app.js.
+
+Usage follows this patern:
+
+ var branch = session.branch(oldUrl);
+ branch.parameter1 = value;
+ var newUrl = branch.marshal();
+
+Example:
+
+ var oldUrl = "index?frame=main.broker.queue;main.m=broker;main.broker.m=queue;main.broker.id=1;main.broker.queue.id=3119";
+
+ // create a branch object from a url string
+ var branch = session.branch(oldUrl);
+
+ /* branch is a javascript object with the following properties:
+ {
+ __page: 'index',
+ frame: 'main.broker.queue',
+ main.m: 'broker',
+ main.broker.m: 'queue',
+ main.broker.id: '1',
+ main.broker.queue.id: '3119'
+ }
+ */
+
+ // You can change any of the existing properties directly:
+ branch.frame = 'main.broker.exchange';
+ branch.main.broker.m = 'exchange';
+
+ // You can remove properties
+ delete branch.main.broker.queue.id;
+
+ // You can add new properties
+ branch['main.broker.exchange.id'] = 1;
+ // or
+ branch.set('main.broker.exchange.id', 1);
+
+ branch.set('main.tabs.sel', 'mtab');
+ branch.set('main.broker.view.body.tabs.m', 'exchanges');
+
+ // generate a new url with the modified values
+ var newUrl = branch.marshal();
+ // index?frame=main.broker.exchange;main.m=broker;main.tabs.sel=mtab;main.view.m=msg;main.broker.m=exchange;main.broker.id=1;main.broker.view.body.tabs.m=exchanges;main.broker.exchange.id=1
+
+Background update urls:
+
+ In cumin, background update urls contain an encoded session value and one or more widget paths.
+
+ For example:
+ index.update?session=index%3Fframe%3Dmain.broker.queue%3Bmain.m%3Dbroker%3Bmain.broker.m%3Dqueue%3Bmain.broker.id%3D1%3Bmain.broker.queue.id%3D3119;widget=main.broker.queue.view.tabs.stats.gen.general;widget=main.broker.queue.view.tabs.stats.gen.io
+
+ Creating a branch object from this background update url will generate:
+ {
+ __page: 'index.update',
+ session: {
+ __page: 'index',
+ frame: 'main.broker.queue',
+ main.m: 'broker',
+ main.broker.m: 'queue',
+ main.broker.id: '1',
+ main.broker.queue.id: '3119',
+ },
+ widget: [
+ main.broker.queue.view.tabs.stats.gen.general,
+ main.broker.queue.view.tabs.stats.gen.io
+ ]
+ }
+
+ You can manipulate this object and then call branch.marshal() to generate a new url string.
+
+ For example, to add the page parameter that tells the widgets to render themselves in "fullpage" mode:
+
+ var backgroundUrl = wooly.updateInfo.url;
+ var branch = session.branch(backgroundUrl);
+
+ // add the fullpage parameter to the session
+ branch.session.fullpage = 1;
+
+ // rengen the url
+ backgroundUrl = branch.marshal();
+
+ // restart the setInterval timer with the new url
+ wooly.cancelUpdate(wooly.updateInfo.timerHandle);
+ wooly.newSetIntervalUpdate(backgroundUrl, wooly.updateInfo.callback, wooly.updateInfo.interval);
+
+
+
+
+
More information about the rhmessaging-commits
mailing list