se hicieron detalles en starter
[VSoRC/.git] / src / views / starter.ejs
1 <!DOCTYPE html>
2 <html>
3
4 <head>
5   <title></title>
6   <!-- <link rel="stylesheet" type="text/css" href="/styles/main.css" /> -->
7   <%include ../../partials/head%>
8   <style media="screen">
9     body{
10       display: flex;
11       flex-flow: row wrap;
12     }
13     main{
14       width: 100%;
15       flex-grow: 2;
16     }
17     aside{
18       flex-grow: 1;
19     }
20     footer{
21       position: absolute;
22       top: 100%;
23     }
24
25     input[type="text"]{
26       background-color: rgba(200,200,200,0.5);
27       border: 0;
28       border-bottom: 2px black solid;
29       overflow: hidden;
30       width: 15em;
31     }
32     .buttons{
33     display: flex;
34     width: 100%;
35     margin: 0;
36     padding: 0;
37     }
38     button{
39       flex-grow: 1;
40       border: 0;
41       border-bottom: 2px black solid;
42       overflow: hidden;
43       width: 15em;
44       background-color: white;
45       transition: background-color 0.3s ease-in, color 0.3s ease-in;
46     }
47     button:hover{
48       background-color: darkgrey;
49       color: white
50     }
51     textarea{
52       width: 25%;
53       font-size: 1.5em;
54       overflow: auto;
55       height: 15em
56     }
57   </style>
58 </head>
59 <header>
60   <%include ../../partials/header%>
61 </header>
62 <body>
63
64   <main>
65     <div class="buttons">
66       <button type="button" name="button" onclick="startvsorc()">Iniciar VsoRc</button>
67       <button type="button" name="button" onclick="stopvsorc()">Detener VsoRc</button>
68       <button type="button" name="button" onclick="startcontroller()">Iniciar controlador</button>
69       <button type="button" name="button" onclick="stopcontroller()">Detener controlador</button>
70     </div>
71       <textarea rows="20" cols="7" id="comandos"></textarea>
72     <script type="text/javascript">
73     let topo = document.getElementById('comandos') //Donde van escrito el DSL
74
75
76
77     function stopcontroller() {
78       let xhr = new XMLHttpRequest();
79       xhr.open('GET', '/stopcontroller', true);
80       xhr.onload = function() {
81         if (xhr.status == 200) { //can use this.status instead
82           //console.log(xhr.responseText);// para ver en la consola
83           console.log("controller stoped");
84         }
85       }
86       xhr.send();
87
88     }
89
90     function startcontroller() {
91       let xhr = new XMLHttpRequest();
92       xhr.open('GET', '/startcontroller', true);
93       //console.log(xhr); //para ver en la consola
94       xhr.onload = function() {
95         if (xhr.status == 200) { //can use this.status instead
96
97           console.log("controller started");
98         }
99       }
100       xhr.send();
101     }
102
103       function startvsorc() {
104           let xhr = new XMLHttpRequest();
105           topology = JSON.stringify(topo.value)
106           xhr.open('GET', '/startvsorc?topology='+topology, true);
107           xhr.onload = function() {
108             if (xhr.status == 200) { //can use this.status instead
109               //console.log(xhr.responseText);// para ver en la consola
110               console.log("vsorc started");
111             }
112           }
113
114           xhr.send();
115
116         }
117         function stopvsorc() {
118             let xhr = new XMLHttpRequest();
119             xhr.open('GET', '/stopvsorc', true);
120             xhr.onload = function() {
121               if (xhr.status == 200) { //can use this.status instead
122                 //console.log(xhr.responseText);// para ver en la consola
123                 console.log("vsorc stopped");
124               }
125             }
126             xhr.send();
127           }
128     </script>
129   </main>
130   <aside class="">
131     <div class="statuscontroller">
132
133     </div>
134     <div class="statusproyect">
135
136     </div>
137   </aside>
138 </body>
139 <footer>
140   <%include ../../partials/footer%>
141 </footer>
142
143
144 </html>