Driver Info Page
This commit is contained in:
50
public/app.js
Executable file
50
public/app.js
Executable file
@@ -0,0 +1,50 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
function updateStatus() {
|
||||
fetch('/api/status')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// WebClients
|
||||
const clientsUl = document.getElementById('clients');
|
||||
clientsUl.innerHTML = '';
|
||||
data.clients.forEach(client => {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = client;
|
||||
clientsUl.appendChild(li);
|
||||
});
|
||||
|
||||
// Sender
|
||||
const sendersUl = document.getElementById('senderList');
|
||||
sendersUl.innerHTML = '';
|
||||
data.senders.forEach(sender => {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = `${sender.name}: ${sender.status}`;
|
||||
sendersUl.appendChild(li);
|
||||
});
|
||||
|
||||
// Letzte Commands
|
||||
const commandsUl = document.getElementById('commandList');
|
||||
commandsUl.innerHTML = '';
|
||||
data.lastCommands.forEach(cmd => {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = cmd;
|
||||
commandsUl.appendChild(li);
|
||||
});
|
||||
|
||||
// Letzte Pings
|
||||
const pingsUl = document.getElementById('pingList');
|
||||
pingsUl.innerHTML = '';
|
||||
data.lastPings.forEach(ping => {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = ping;
|
||||
pingsUl.appendChild(li);
|
||||
});
|
||||
})
|
||||
.catch(error => console.error('Error fetching status:', error));
|
||||
}
|
||||
|
||||
// Initial load
|
||||
updateStatus();
|
||||
|
||||
// Update every 5 seconds
|
||||
setInterval(updateStatus, 5000);
|
||||
});
|
||||
35
public/index.html
Executable file
35
public/index.html
Executable file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Robot Driver Info</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; margin: 20px; }
|
||||
h1 { color: #333; }
|
||||
.section { margin-bottom: 20px; border: 1px solid #ccc; padding: 10px; }
|
||||
ul { list-style-type: none; padding: 0; }
|
||||
li { padding: 5px 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Robot Driver Status</h1>
|
||||
<div id="status" class="section">
|
||||
<h2>Verbundene WebClients</h2>
|
||||
<ul id="clients"></ul>
|
||||
</div>
|
||||
<div id="senders" class="section">
|
||||
<h2>Verbundene Sender</h2>
|
||||
<ul id="senderList"></ul>
|
||||
</div>
|
||||
<div id="commands" class="section">
|
||||
<h2>Letzte Commands</h2>
|
||||
<ul id="commandList"></ul>
|
||||
</div>
|
||||
<div id="pings" class="section">
|
||||
<h2>Letzte Ping Nachrichten</h2>
|
||||
<ul id="pingList"></ul>
|
||||
</div>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user