bugs fixed
[VSoRC/.git] / src / views / starter.ejs
index 59c535b7ce6afc813aaa24ffa83a8039f5fe8d3f..01aca3a536c7c07d53bd5f840ad20abc799ad5d9 100644 (file)
           <button type="button" name="button" onclick="pingall()">Ping all</button>
           <button type="button" name="button" onclick="placement()">Placement</button>
           <button type="button" name="button" onclick="iperf()">Iperf3</button>
-          <button type="button" name="button" onclick="net()">net</button>
-          <button type="button" name="button" onclick="nodes()">nodes</button>
-          <button type="button" name="button" onclick="status()">status</button>
+          <button type="button" name="button" onclick="net()">Network</button>
+          <button type="button" name="button" onclick="nodes()">Nodes</button>
+          <button type="button" name="button" onclick="status()">Status</button>
+          <button type="button" name="button" onclick="intfs()">Interfaces</button>
         </div>
       </div>
 
@@ -55,9 +56,9 @@
       <div class="panel">
         <textarea class="text" style="font-size: 12px;" disabled rows="20" cols="7" id="controllerout" placeholder="Salida del controlador"></textarea>
       </div>
-
-      <div class="terminal"></div>
-
+      <div class="panel">
+        <textarea class="text" style="font-size: 12px;" disabled rows="20" cols="7" id="a" placeholder="Salida del controlador"></textarea>
+      </div>
     </div>
 
     <script type="text/javascript">
         }
         xhr.send();
       }
-    ///////////////////////////////////////////////////////////////////////CODIGO DE LA terminal
-    // No idea what these are about. Just copied them from the demo code
-     // Terminal.applyAddon(attach);
-     // Terminal.applyAddon(fit);
-     // Terminal.applyAddon(winptyCompat);
-     // The terminal
-
-     // const fitAddon = new FitAddon();
-     // term.loadAddon(fitAddon);
-
-
-     const term = new Terminal();
-     // No idea what this does
-     // term.winptyCompatInit();
-     // This kinda makes sense
-     const container = document.getElementById('terminal');
-     term.open(container);
-     // Open the websocket connection to the backend
-     const protocol = (location.protocol === 'https:') ? 'wss://' : 'ws://';
-     const port = location.port ? `:${location.port}` : '';
-     const socketUrl = `${protocol}${location.hostname}${port}/shell`;
-     const socket = new WebSocket(socketUrl);
-     const attachAddon = new AttachAddon(socket);
-     term.loadAddon(attachAddon);
-     // Attach the socket to the terminal
-     socket.onopen = (ev) => { term.attach(socket); };
-     // Not going to worry about close/error for the websocket
-     //////////////////////////////////////////////////////////////////////FIN DEL CODIGO DE LA TERMINAL
+
+      function net() {
+        let xhr = new XMLHttpRequest();
+        xhr.open('GET', '/net', true);
+        xhr.onload = function() {
+          if (xhr.status == 200) { //can use this.status instead
+            //console.log(xhr.responseText);// para ver en la consola
+            vsorcout.value+=xhr.response;
+            console.log("net");
+
+
+          }
+        }
+        xhr.send();
+      }
+
+      function nodes() {
+        let xhr = new XMLHttpRequest();
+        xhr.open('GET', '/nodes', true);
+        xhr.onload = function() {
+          if (xhr.status == 200) { //can use this.status instead
+            //console.log(xhr.responseText);// para ver en la consola
+            vsorcout.value+=xhr.response;
+            console.log("nodes");
+
+
+          }
+        }
+        xhr.send();
+      }
+
+      function status() {
+        let xhr = new XMLHttpRequest();
+        xhr.open('GET', '/statusnodes', true);
+        xhr.onload = function() {
+          if (xhr.status == 200) { //can use this.status instead
+            //console.log(xhr.responseText);// para ver en la consola
+            vsorcout.value+=xhr.response;
+            console.log("placement");
+
+
+          }
+        }
+        xhr.send();
+      }
+
+      function intfs() {
+        let xhr = new XMLHttpRequest();
+        xhr.open('GET', '/intfs', true);
+        xhr.onload = function() {
+          if (xhr.status == 200) { //can use this.status instead
+            //console.log(xhr.responseText);// para ver en la consola
+            vsorcout.value+=xhr.response;
+            console.log("placement");
+
+
+          }
+        }
+        xhr.send();
+      }
+
     </script>
   </main>
 </body>