Terra-Dash/templates/index.html

59 lines
1.8 KiB
HTML
Raw Normal View History

2024-09-13 15:07:56 +02:00
<!DOCTYPE html>
<html lang="de">
<head>
<script>
let termdiv;
function sendcommand(list) {
2024-09-13 15:07:56 +02:00
fetch("/term",{
method:"POST",
body: list,
2024-09-13 15:07:56 +02:00
headers: {"Content-type":"application/json; charset=UTF-8"}
});
getterm();
2024-09-13 15:07:56 +02:00
};
function getterm() {
let tmpterm = "";
2024-09-13 15:07:56 +02:00
fetch("/term", { method: "GET" })
.then(response => response.json())
.then(termarray => {
console.log(termarray);
for (let line of termarray) {
tmpterm += `${line}<br>`;
2024-09-13 15:07:56 +02:00
}
termdiv.innerHTML = tmpterm;
})
.catch(termdiv.innerHTML = 'Fehler beim Abrufen der Daten');
2024-09-13 15:07:56 +02:00
}
2024-09-13 15:07:56 +02:00
function initstuff() {
termdiv = document.getElementById("terminal");
getterm();
setInterval(getterm,8000)
}
window.onload = initstuff;
</script>
<link rel="stylesheet" href="/static/style.css">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Terradash</title>
</head>
<body style="background-size: cover; background-image: url({{ url_for('static', filename='background.png') }});">
<img src="{{ url_for('static', filename='logo.png') }}" alt="Terra-Dash">
2024-09-13 15:07:56 +02:00
<div id="dash">
<div id="buttons">
<button class="button" onclick="sendcommand([`start`])">start</button>
<button style="background-color: rgb(186, 0, 0);" class="button" onclick="sendcommand([`stop`])">stop</button>
2024-09-13 15:07:56 +02:00
</div>
<div id="terminal">
</div>
</div>
</body>
</html>