X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=src%2Fviews%2Fstarter.ejs;h=0caa1f52690aee7a65ce57d843835ccb13bec437;hp=de1868b9c452d0361a091817058e84937a37fca6;hb=b5e35e05af82a077db86a6400dad2871e1d95ca3;hpb=7319e156cc200d31b27ec9da78766d928d589c52 diff --git a/src/views/starter.ejs b/src/views/starter.ejs index de1868b..0caa1f5 100644 --- a/src/views/starter.ejs +++ b/src/views/starter.ejs @@ -5,107 +5,299 @@ <%include ../../partials/head%> - + + + + + + + + + +
<%include ../../partials/header%> +
+
- - - - +
+ +
+ +
+ + + + +
+
+ +
+ +
+ + + + + + + +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ -
- + + } + } + xhr.send(); + + vsorcout.scrollTop = vsorcout.scrollHeight; + } + function pingall() { + let xhr = new XMLHttpRequest(); + xhr.open('GET', '/pingall', 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("pingall"); + + + } + } + xhr.send(); + } + + function iperf() { + let xhr = new XMLHttpRequest(); + xhr.open('GET', '/iperf', 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("pingall"); + + + } + } + xhr.send(); + } + function placement() { + let xhr = new XMLHttpRequest(); + xhr.open('GET', '/placement', 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 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', '/status', 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(); + } + ///////////////////////////////////////////////////////////////////////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 + +