9587: include "owner" in trash rows; update trash icon.
[arvados.git] / apps / workbench / public / webshell / shell_in_a_box.js
index 115cc743a0244c96f0bcb1f4ff9c502b3a19bf83..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 {
@@ -800,7 +806,7 @@ VT100.prototype.initializeUserCSSStyles = function() {
                           sheet.disabled = false;
                         }
                         if (!sheet.disabled) {
-                          label.innerHTML= '<img src="enabled.gif" />' +
+                          label.innerHTML= '<img src="/webshell/enabled.gif" />' +
                                            label.innerHTML;
                         }
                       } else {
@@ -839,7 +845,7 @@ VT100.prototype.initializeUserCSSStyles = function() {
       // both ends), or whether this is a on/off toggle, which can be grouped
       // together with other on/off options.
       group                             +=
-        '<li>' + (enabled ? '<img src="enabled.gif" />' : '') +
+        '<li>' + (enabled ? '<img src="/webshell/enabled.gif" />' : '') +
                  label +
         '</li>';
     }
@@ -1249,7 +1255,7 @@ VT100.prototype.initializeElements = function(container) {
                        '<div id="scrollable">' +
                          '<table id="kbd_button">' +
                            '<tr><td width="100%">&nbsp;</td>' +
-                           '<td><img id="kbd_img" src="keyboard.png" /></td>' +
+                           '<td><img id="kbd_img" src="/webshell/keyboard.png" /></td>' +
                            '<td>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>' +
                          '</table>' +
                          '<pre id="lineheight">&nbsp;</pre>' +
@@ -1269,7 +1275,7 @@ VT100.prototype.initializeElements = function(container) {
                          (typeof suppressAllAudio != 'undefined' &&
                           suppressAllAudio ? "" :
                          embed + '<bgsound id="beep_bgsound" loop=1 />') +
-                          '<iframe id="layout" src="keyboard.html" />' +
+                          '<iframe id="layout" src="/webshell/keyboard.html" />' +
                         '</div>';
   }
 
@@ -2840,16 +2846,16 @@ VT100.prototype.showContextMenu = function(x, y) {
           '<li id="reset">Reset</li>' +
           '<hr />' +
           '<li id="beginconfig">' +
-             (this.utfEnabled ? '<img src="enabled.gif" />' : '') +
+             (this.utfEnabled ? '<img src="/webshell/enabled.gif" />' : '') +
              'Unicode</li>' +
           '<li>' +
-             (this.visualBell ? '<img src="enabled.gif" />' : '') +
+             (this.visualBell ? '<img src="/webshell/enabled.gif" />' : '') +
              'Visual Bell</li>'+
           '<li>' +
-             (this.softKeyboard ? '<img src="enabled.gif" />' : '') +
+             (this.softKeyboard ? '<img src="/webshell/enabled.gif" />' : '') +
              'Onscreen Keyboard</li>' +
           '<li id="endconfig">' +
-             (this.blinkingCursor ? '<img src="enabled.gif" />' : '') +
+             (this.blinkingCursor ? '<img src="/webshell/enabled.gif" />' : '') +
              'Blinking Cursor</li>'+
           (this.usercss.firstChild ?
            '<hr id="beginusercss" />' +