summaryrefslogtreecommitdiffstats
path: root/web/client.js
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-02-22 16:28:26 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-02-22 16:30:06 +0200
commitb22244d6d0dc8d3e4cf124eadb09cb09d9574f24 (patch)
tree0d38cd52c4c1ef39e8853ccf62331be6a8fedd8e /web/client.js
parent1e4cb26264f67b5fe8e3e55e17d1ad785c137f24 (diff)
downloadaconf-b22244d6d0dc8d3e4cf124eadb09cb09d9574f24.tar.bz2
aconf-b22244d6d0dc8d3e4cf124eadb09cb09d9574f24.tar.xz
web client: ignore navigation events when UI is blocked
eliminates race condition when sorting list elements by dragging from an anchor
Diffstat (limited to 'web/client.js')
-rw-r--r--web/client.js28
1 files changed, 20 insertions, 8 deletions
diff --git a/web/client.js b/web/client.js
index 346e458..0dd510a 100644
--- a/web/client.js
+++ b/web/client.js
@@ -1,10 +1,11 @@
/*
- * Copyright (c) 2012-2014 Kaarle Ritvanen
+ * Copyright (c) 2012-2015 Kaarle Ritvanen
* See LICENSE file for license details
*/
define(
[
+ "aconf/blocking",
"aconf/dom",
"aconf/error",
"aconf/navigation",
@@ -17,11 +18,20 @@ define(
"underscore",
"aconf/layout/stacked",
"aconf/layout/tabular",
- "domReady",
- "jquery-blockui"
+ "domReady"
],
function(
- dom, formatError, navi, pth, statusBar, txnMgr, type, Inline, $, _
+ blocking,
+ dom,
+ formatError,
+ navi,
+ pth,
+ statusBar,
+ txnMgr,
+ type,
+ Inline,
+ $,
+ _
) {
return function() {
$("#login").submit(function() {
@@ -194,11 +204,11 @@ define(
function clearState() {
statusBar.reset();
render();
- $.unblockUI();
+ blocking.disable();
}
$("#commit").click(function() {
- $.blockUI();
+ blocking.enable();
txnMgr.commit().done(clearState).fail(function(xhr) {
statusBar.setError(
formatError("Commit failed", xhr), "txn"
@@ -206,7 +216,7 @@ define(
})
});
$("#revert").click(function() {
- $.blockUI();
+ blocking.enable();
txnMgr.abort();
clearState();
});
@@ -220,7 +230,9 @@ define(
statusBar.reset();
$("#content").empty();
- $(window).bind("hashchange", render);
+ $(window).bind("hashchange", function() {
+ if (!blocking.isEnabled()) render();
+ });
navi.setPath("/");
}).fail(function() {