terminal intigration
This commit is contained in:
parent
68db073dfe
commit
66f5f97ee3
5 changed files with 119 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<script>
|
||||
let termdiv;
|
||||
<<<<<<< HEAD
|
||||
|
||||
function sendcommand(list) {
|
||||
fetch("/term",{
|
||||
|
@ -12,6 +13,29 @@
|
|||
});
|
||||
getterm();
|
||||
};
|
||||
=======
|
||||
let terminput;
|
||||
let timer;
|
||||
let timertext;
|
||||
const COMMAND = "command";
|
||||
|
||||
|
||||
function sendcommand(contentlist) {
|
||||
fetch("/term",{
|
||||
method:"POST",
|
||||
body: JSON.stringify({"content":contentlist}),
|
||||
headers: {"Content-type":"application/json; charset=UTF-8"}
|
||||
}).then(getterm());
|
||||
}
|
||||
function sendtermcommand() {
|
||||
sendcommand([COMMAND,
|
||||
`terminal-command`,
|
||||
terminput.value]
|
||||
);
|
||||
terminput.value = "";
|
||||
|
||||
}
|
||||
>>>>>>> 079d2a0 (terminal intigration)
|
||||
|
||||
function getterm() {
|
||||
let tmpterm = "";
|
||||
|
@ -26,6 +50,7 @@
|
|||
})
|
||||
.catch(termdiv.innerHTML = 'Fehler beim Abrufen der Daten');
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
function initstuff() {
|
||||
|
@ -35,6 +60,26 @@
|
|||
}
|
||||
|
||||
|
||||
=======
|
||||
function getterminterval() {
|
||||
timer -= 1
|
||||
timertext.innerHTML = `Reload in ${timer} Seconds`
|
||||
if (timer == 0) {
|
||||
getterm()
|
||||
timer = 5
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function initstuff() {
|
||||
timer = 5
|
||||
timertext = document.getElementById("timer")
|
||||
termdiv = document.getElementById("terminaltext");
|
||||
terminput = document.getElementById("terminalinput");
|
||||
getterm();
|
||||
setInterval(getterminterval,1000)
|
||||
}
|
||||
>>>>>>> 079d2a0 (terminal intigration)
|
||||
|
||||
window.onload = initstuff;
|
||||
</script>
|
||||
|
@ -48,10 +93,31 @@
|
|||
<img src="{{ url_for('static', filename='logo.png') }}" alt="Terra-Dash">
|
||||
<div id="dash">
|
||||
<div id="buttons">
|
||||
<<<<<<< HEAD
|
||||
<button class="button" onclick="sendcommand([`start`])">start</button>
|
||||
<button style="background-color: rgb(186, 0, 0);" class="button" onclick="sendcommand([`stop`])">stop</button>
|
||||
</div>
|
||||
<div id="terminal">
|
||||
=======
|
||||
<button style="margin-bottom: 10px;"
|
||||
class="button"
|
||||
onclick="sendcommand([COMMAND,`start`]);timer=2">start</button>
|
||||
<button style="margin-bottom: 10px; background-color: rgb(255, 0, 0);"
|
||||
class="button"
|
||||
onclick="sendcommand([COMMAND,`stop`]);timer=1">stop</button>
|
||||
</div>
|
||||
<div style="width: 100%;height: 100%;">
|
||||
<p style="font-size: 11px;margin: 0px;margin-left: 15px;" id="timer">Reload in _ Seconds</p>
|
||||
<div id="terminal">
|
||||
<div id="terminaltext"></div>
|
||||
<input id="terminalinput" type="text">
|
||||
<button
|
||||
style="margin-top: 15px;"
|
||||
class="button"
|
||||
onclick="sendtermcommand();
|
||||
terminput.value = ``">send</button>
|
||||
</div>
|
||||
>>>>>>> 079d2a0 (terminal intigration)
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue