mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
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 09a8292033
)
This commit is contained in:
parent
9639836022
commit
3e608a173e
@ -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("");
|
||||
|
@ -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,26 +100,36 @@ 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();
|
||||
|
||||
// Save this window object
|
||||
fsm.addObject("login_window", this);
|
||||
|
||||
// We want to receive "complete" events on this button (which we generate)
|
||||
this.addEventListener("complete", fsm.eventListener, fsm);
|
||||
});
|
||||
|
||||
|
||||
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 the window object
|
||||
fsm.addObject("login_window", this);
|
||||
|
||||
// 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;
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user