Explorar o código

YARN-9091. Improve terminal message when connection is refused. Contributed by Eric Yang

Billie Rinaldi %!s(int64=6) %!d(string=hai) anos
pai
achega
4f622337ee

+ 14 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/resources/TERMINAL/terminal.template

@@ -87,11 +87,25 @@
         if (user != null) {
           url = url + "?user.name=" + encodeURI(user);
         }
+        document.title = getQueryVariable("container");
         console.log(url);
         var sock = new WebSocket(url);
         sock.addEventListener('open', function () {
           term.attach(sock, true, true);
         });
+        sock.addEventListener('close', function(event) {
+          switch(event.code) {
+            case 1000:
+              term.write('Remote Connection closed.');
+              break;
+            case 1008:
+              term.write('Remote Connection refused.');
+              break;
+            case 1001:
+              term.write('Remote Connection going away.');
+              break;
+          }
+        });
         term.open(container);
         term.winptyCompatInit();
         term.fit();