9587: include "owner" in trash rows; update trash icon.
[arvados.git] / apps / workbench / public / webshell / shell_in_a_box.js
index 448bfda59a7f8518507e142e862b57fe0098aafe..0c7e800ef8e71aa308fb8d2af6f51b0498d0e8ac 100644 (file)
@@ -134,7 +134,9 @@ ShellInABox.prototype.sessionClosed = function() {
       }
       this.vt100('Session closed.');
     }
-    this.showReconnect(true);
+    // Revealing the "reconnect" button is commented out until we hook
+    // up the username+token auto-login mechanism to the new session:
+    //this.showReconnect(true);
   } catch (e) {
   }
 };
@@ -175,7 +177,6 @@ ShellInABox.prototype.sendRequest = function(request) {
                                (this.session ? '&session=' +
                                 encodeURIComponent(this.session) : '&rooturl='+
                                 encodeURIComponent(this.rooturl));
-  request.setRequestHeader('Content-Length', content.length);
 
   request.onreadystatechange = function(shellInABox) {
     return function() {
@@ -186,6 +187,7 @@ ShellInABox.prototype.sendRequest = function(request) {
              }
            }
     }(this);
+  ShellInABox.lastRequestSent = Date.now();
   request.send(content);
 };
 
@@ -206,8 +208,13 @@ ShellInABox.prototype.onReadyStateChange = function(request) {
         this.sendRequest(request);
       }
     } else if (request.status == 0) {
-      // Time Out
-      this.sendRequest(request);
+        if (ShellInABox.lastRequestSent + 2000 < Date.now()) {
+            // Timeout, try again
+            this.sendRequest(request);
+        } else {
+            this.vt100('\r\n\r\nRequest failed.');
+            this.sessionClosed();
+        }
     } else {
       this.sessionClosed();
     }
@@ -233,7 +240,6 @@ ShellInABox.prototype.sendKeys = function(keys) {
                                  '&height=' + this.terminalHeight +
                                  '&session=' +encodeURIComponent(this.session)+
                                  '&keys=' + encodeURIComponent(keys);
-    request.setRequestHeader('Content-Length', content.length);
     request.onreadystatechange = function(shellInABox) {
       return function() {
                try {