Skip to content

Commit

Permalink
Merge pull request #11084 from miguelvazq/ResetTimeOnLock
Browse files Browse the repository at this point in the history
HPCC-19530 Reset_session_timeout after a click

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
  • Loading branch information
richardkchapman committed May 2, 2018
2 parents 7ee4cb8 + dcd73aa commit 12baa38
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
9 changes: 8 additions & 1 deletion esp/src/eclwatch/LockDialogWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ define([
this.tableContainer = registry.byId(this.id + "TableContainer");
this.unlockUserName = registry.byId(this.id + "UnlockUserName");
this.unlockPassword = registry.byId(this.id + "UnlockPassword");
this.unlockBtn = registry.byId(this.id + "UnlockBtn");
this.unlockForm = registry.byId(this.id + "UnlockForm");
},

Expand Down Expand Up @@ -110,6 +109,14 @@ define([
},

_onLock: function (event) {
var context = this;

on(this.unlockPassword, "keypress", function (event) {
if (event.key === "Enter") {
context._onUnlock();
}
});

xhr("esp/lock", {
method: "post",
});
Expand Down
18 changes: 17 additions & 1 deletion esp/src/eclwatch/stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define([
"dojo/topic",
"dojo/request/xhr",
"dojo/cookie",
"dojo/on",

"dijit/Dialog",
"dijit/form/Button",
Expand All @@ -39,7 +40,7 @@ define([
"css!dojo-themes/flat/flat.css",
"css!hpcc/css/hpcc.css"

], function (fx, dom, domStyle, ioQuery, ready, lang, arrayUtil, topic, xhr, cookie,
], function (fx, dom, domStyle, ioQuery, ready, lang, arrayUtil, topic, xhr, cookie, on,
Dialog, Button,
ESPUtil, Utility, LockDialogWidget,
entities, Toaster) {
Expand Down Expand Up @@ -155,11 +156,19 @@ define([
dojo.cookie("ECLWatchUser", "true");
}

var lock = dom.byId("Lock");
idleWatcher = new ESPUtil.IdleWatcher(IDLE_TIMEOUT);
monitorLockClick = new ESPUtil.MonitorLockClick();
on(lock, "click", function (event) {
monitorLockClick.locked();
});
monitorLockClick.on("unlocked", function (){
idleWatcher.start();
});
monitorLockClick.on("locked", function () {
idleWatcher.stop();
initUnlockListener();
});
idleWatcher.on("active", function () {
_resetESPTime();
});
Expand All @@ -178,6 +187,13 @@ define([
);
}

function initUnlockListener() {
var unlock = dom.byId("unlock");
on(unlock, "click", function (event) {
monitorLockClick.unlocked();
});
}

function parseUrl() {
var baseHost = (typeof debugConfig !== "undefined") ? "http://" + debugConfig.IP + ":" + debugConfig.Port : "";
var hashNodes = location.hash.split("#");
Expand Down
2 changes: 1 addition & 1 deletion esp/src/eclwatch/templates/LockDialogWidget.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<p id="UnlockStatus"></p>
</div>
<div class="dijitDialogPaneActionBar">
<button id="${id}UnlockBtn" data-dojo-attach-event="onClick:_onUnlock" data-dojo-type="dijit.form.Button">${i18n.Unlock}</button>
<button id="unlock" data-dojo-attach-event="onClick:_onUnlock" data-dojo-type="dijit.form.Button">${i18n.Unlock}</button>
</div>
</div>
</span>
4 changes: 4 additions & 0 deletions esp/src/src/ESPUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ export var MonitorLockClick = dojo.declare([Evented], {
unlocked: function () {
var context = this;
context.emit("unlocked", {});
},
locked: function () {
var context = this;
context.emit("locked", {});
}
});

Expand Down

0 comments on commit 12baa38

Please sign in to comment.