From: Stephen Smith Date: Thu, 5 May 2022 15:06:29 +0000 (-0400) Subject: Merge branch '18978-webshell-timeout-ux' into main. Closes #18978 X-Git-Tag: 2.4.1~1^2~5 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/1bc3f80b1aebb3c81b55e1afaad0a649aa9b3b9f?hp=bc91a5fab017163d856ad559d0b435921cb7ee17 Merge branch '18978-webshell-timeout-ux' into main. Closes #18978 Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- diff --git a/public/webshell/index.html b/public/webshell/index.html index 028664c4..aae70a97 100644 --- a/public/webshell/index.html +++ b/public/webshell/index.html @@ -60,7 +60,7 @@ if (currentTime - lastTime > idleTimeoutMs) { //logout sh.reset(); - sh.sessionClosed(); + sh.sessionClosed("Session timed out after " + timeout + " seconds."); document.body.onmousemove = undefined; document.body.onkeydown = undefined; } else { @@ -88,10 +88,12 @@ sh.keysPressed(token + "\n"); sh.vt100('(sent authentication token)\n'); token = null; - updateIdleTimer(); - document.body.onmousemove = updateIdleTimer; - document.body.onkeydown = updateIdleTimer; - setTimeout(checkIdleTimer, 1000); + if (timeout > 0) { + updateIdleTimer(); + document.body.onmousemove = updateIdleTimer; + document.body.onkeydown = updateIdleTimer; + setTimeout(checkIdleTimer, 1000); + } } else { setTimeout(trySendToken, 200); } diff --git a/public/webshell/shell_in_a_box.js b/public/webshell/shell_in_a_box.js index c258b5d7..6b0a5b69 100644 --- a/public/webshell/shell_in_a_box.js +++ b/public/webshell/shell_in_a_box.js @@ -128,7 +128,7 @@ function ShellInABox(url, container) { }; extend(ShellInABox, VT100); -ShellInABox.prototype.sessionClosed = function() { +ShellInABox.prototype.sessionClosed = function(msg) { try { this.connected = false; if (this.session) { @@ -136,7 +136,7 @@ ShellInABox.prototype.sessionClosed = function() { if (this.cursorX > 0) { this.vt100('\r\n'); } - this.vt100('Session closed.'); + this.vt100(msg || 'Session closed.'); this.currentRequest.abort(); } // Revealing the "reconnect" button is commented out until we hook