summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2007-01-08 04:58:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:37:13 -0500
commit3e608a173e65403686628387a09f66096978783f (patch)
treead42c5201331db350a303b381f81e82d9215f45f
parent9639836022adcb62c72520f799a89d0f727f224d (diff)
downloadsamba-3e608a173e65403686628387a09f66096978783f.tar.gz
samba-3e608a173e65403686628387a09f66096978783f.tar.bz2
samba-3e608a173e65403686628387a09f66096978783f.zip
r20601: Web Application Framework
More testing revealed that this isn't yet bug-free... Sigh. One of these days I'll start writing bug-free software... - Status and Statistics timer wasn't always stopped properly when switching away from that module's display. It seems silly to continue to update status and statistics when the page isn't being viewed. - Single instance of the Login window was not accessible if one switched between modules. - Upon return from a Session Timeout, we can retry the original RPC request, but it may fail due to information that was stored in the old session. This was the case in the LDB Browser module, where the open database handle became gone with the session. We now detect a Resource Not Found and re-open the database. (This used to be commit 09a82920336d1502c204725a4b518a1fa4a0d68d)
-rw-r--r--webapps/swat/source/class/swat/main/AbstractModuleFsm.js8
-rw-r--r--webapps/swat/source/class/swat/main/Authenticate.js43
-rw-r--r--webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js23
-rw-r--r--webapps/swat/source/class/swat/module/statistics/Fsm.js11
4 files changed, 58 insertions, 27 deletions
diff --git a/webapps/swat/source/class/swat/main/AbstractModuleFsm.js b/webapps/swat/source/class/swat/main/AbstractModuleFsm.js
index fed11eb0d3..8c11c7fadf 100644
--- a/webapps/swat/source/class/swat/main/AbstractModuleFsm.js
+++ b/webapps/swat/source/class/swat/main/AbstractModuleFsm.js
@@ -119,7 +119,6 @@ qx.Proto.addAwaitRpcResultState = function(module)
{
bAuthCompleted = true;
}
-_this.debug("bAuthCompleted=" + bAuthCompleted);
// If we didn't just complete an authentication and we're coming
// from some other state...
@@ -127,7 +126,6 @@ _this.debug("bAuthCompleted=" + bAuthCompleted);
fsm.getPreviousState() != "State_AwaitRpcResult")
{
// ... then push the previous state onto the state stack
-_this.warn("PUSHING STATE");
fsm.pushState(false);
}
},
@@ -203,8 +201,10 @@ _this.warn("PUSHING STATE");
}
// Retrieve the modal authentication window.
+ var loginWin = swat.main.Authenticate.getInstance();
- var loginWin = swat.main.Authenticate.getInstance(module);
+ // Ensure that it's saved in the current finite state machine
+ loginWin.addToFsm(fsm);
// Set the caption
loginWin.setCaption(caption);
@@ -310,7 +310,7 @@ _this.warn("PUSHING STATE");
function(fsm, event)
{
// Retrieve the login window object
- var win = module.fsm.getObject("login_window");
+ var win = fsm.getObject("login_window");
// Clear the password field
win.password.setValue("");
diff --git a/webapps/swat/source/class/swat/main/Authenticate.js b/webapps/swat/source/class/swat/main/Authenticate.js
index 449a17d9ad..d586ea1f4a 100644
--- a/webapps/swat/source/class/swat/main/Authenticate.js
+++ b/webapps/swat/source/class/swat/main/Authenticate.js
@@ -11,10 +11,9 @@
* Swat authentication window class
*/
qx.OO.defineClass("swat.main.Authenticate", qx.ui.window.Window,
-function(module)
+function()
{
var o;
- var fsm = module.fsm;
qx.ui.window.Window.call(this);
@@ -101,25 +100,35 @@ function(module)
return new qx.ui.form.Button("Login");
});
- // Save this login button since we receive events on it
- fsm.addObject("login_button", this.login);
-
- // We want to receive "execute" events on this button
- this.login.addEventListener("execute", fsm.eventListener, fsm);
-
// Add the grid to the window
this.add(grid);
// Add this window to the document
this.addToDocument();
+});
+
+
+qx.Proto.addToFsm = function(fsm)
+{
+ // Have we already been here for this fsm?
+ if (fsm.getObject("login_window"))
+ {
+ // Yup. Everything's already done. See ya!
+ return;
+ }
+
+ // Save the login button since we receive events on it
+ fsm.addObject("login_button", this.login);
+
+ // We want to receive "execute" events on this button
+ this.login.addEventListener("execute", fsm.eventListener, fsm);
- // Save this window object
+ // Save the window object
fsm.addObject("login_window", this);
- // We want to receive "complete" events on this button (which we generate)
+ // We want to receive "complete" events on this window (which we generate)
this.addEventListener("complete", fsm.eventListener, fsm);
-});
-
+};
qx.Proto.setInfo = function(info)
@@ -141,12 +150,4 @@ qx.Proto.setInfo = function(info)
/**
* Singleton Instance Getter
*/
-qx.Class.getInstance = function(module)
-{
- if (! this._instance)
- {
- this._instance = new this(module);
- }
-
- return this._instance;
-};
+qx.Class.getInstance = qx.util.Return.returnInstance;
diff --git a/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js b/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js
index 4ddc018595..d24f156e4f 100644
--- a/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js
+++ b/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js
@@ -47,7 +47,28 @@ qx.Proto.buildFsm = function(module)
// Display the result
var gui = swat.module.ldbbrowse.Gui.getInstance();
- gui.displayData(module, rpcRequest);
+
+ // Did we get a Resource Not Found error? We'll get this after a
+ // session timeout, because the request is retried but can't
+ // succeed because the database has been closed by the session
+ // timing out.
+ var result = rpcRequest.getUserData("result");
+ var origins = swat.main.AbstractModuleFsm.JsonRpc_Origin;
+ var serverErrors = swat.main.AbstractModuleFsm.JsonRpc_ServerError;
+ if (result.type == "failed" &&
+ result.data.origin == origins.Server &&
+ result.data.code == serverErrors.ResourceError)
+ {
+ // Yup. Re-open the database
+ var dbName = fsm.getObject("dbName");
+ dbName.dispatchEvent(new qx.event.type.Event("changeSelection"),
+ true);
+ }
+ else
+ {
+ // Otherwise, display the result
+ gui.displayData(module, rpcRequest);
+ }
// Dispose of the request
rpcRequest.request.dispose();
diff --git a/webapps/swat/source/class/swat/module/statistics/Fsm.js b/webapps/swat/source/class/swat/module/statistics/Fsm.js
index b60501512a..3ecb42a49d 100644
--- a/webapps/swat/source/class/swat/module/statistics/Fsm.js
+++ b/webapps/swat/source/class/swat/module/statistics/Fsm.js
@@ -19,6 +19,9 @@ function()
qx.Class._startTimer = function(fsm)
{
+ // First, for good house keeping, ensure no timer exists
+ swat.module.statistics.Fsm._stopTimer(fsm);
+
// Create a timer instance to expire in a few seconds
var timer = new qx.client.Timer(5000);
timer.addEventListener("interval", fsm.eventListener, fsm);
@@ -46,6 +49,7 @@ qx.Proto.buildFsm = function(module)
{
var fsm = module.fsm;
var _this = this;
+ var _module = module;
/*
* State: Idle
@@ -78,7 +82,10 @@ qx.Proto.buildFsm = function(module)
rpcRequest.request = null;
// Restart the timer.
- swat.module.statistics.Fsm._startTimer(fsm);
+ if (_module.visible)
+ {
+ swat.module.statistics.Fsm._startTimer(fsm);
+ }
}
},
@@ -164,6 +171,7 @@ qx.Proto.buildFsm = function(module)
"ontransition" :
function(fsm, event)
{
+ _module.visible = true;
swat.module.statistics.Fsm._startTimer(fsm);
}
});
@@ -186,6 +194,7 @@ qx.Proto.buildFsm = function(module)
"ontransition" :
function(fsm, event)
{
+ _module.visible = false;
swat.module.statistics.Fsm._stopTimer(fsm);
}
});