261 lines
8.5 KiB
HTML
261 lines
8.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>MYP Debug Server</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
background-color: #f5f5f5;
|
|
}
|
|
h1, h2, h3 {
|
|
color: #2c3e50;
|
|
}
|
|
.section {
|
|
background-color: white;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
padding: 15px;
|
|
margin-bottom: 20px;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
font-weight: bold;
|
|
color: #34495e;
|
|
}
|
|
input[type="text"] {
|
|
width: 100%;
|
|
padding: 8px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
box-sizing: border-box;
|
|
}
|
|
.btn {
|
|
background-color: #3498db;
|
|
color: white;
|
|
border: none;
|
|
padding: 10px 15px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
margin-right: 5px;
|
|
}
|
|
.btn:hover {
|
|
background-color: #2980b9;
|
|
}
|
|
.btn-success {
|
|
background-color: #2ecc71;
|
|
}
|
|
.btn-success:hover {
|
|
background-color: #27ae60;
|
|
}
|
|
.btn-warning {
|
|
background-color: #f39c12;
|
|
}
|
|
.btn-warning:hover {
|
|
background-color: #e67e22;
|
|
}
|
|
.status {
|
|
padding: 8px;
|
|
border-radius: 4px;
|
|
margin-top: 5px;
|
|
}
|
|
.status-good {
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
}
|
|
.status-warning {
|
|
background-color: #fff3cd;
|
|
color: #856404;
|
|
}
|
|
.status-error {
|
|
background-color: #f8d7da;
|
|
color: #721c24;
|
|
}
|
|
.interface-item {
|
|
background-color: #f8f9fa;
|
|
padding: 10px;
|
|
margin-bottom: 10px;
|
|
border-radius: 4px;
|
|
border-left: 4px solid #3498db;
|
|
}
|
|
.message {
|
|
display: none;
|
|
padding: 10px;
|
|
margin: 10px 0;
|
|
border-radius: 4px;
|
|
}
|
|
.message-success {
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
}
|
|
.message-error {
|
|
background-color: #f8d7da;
|
|
color: #721c24;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>MYP Debug Server</h1>
|
|
<p>Letzte Aktualisierung: {{ last_check }}</p>
|
|
|
|
<div id="message" class="message"></div>
|
|
|
|
<div class="section">
|
|
<h2>Netzwerkkonfiguration</h2>
|
|
<form id="configForm">
|
|
<div class="form-group">
|
|
<label for="backend_hostname">Backend Hostname/IP:</label>
|
|
<input type="text" id="backend_hostname" name="backend_hostname" value="{{ config.backend_hostname }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="backend_port">Backend Port:</label>
|
|
<input type="text" id="backend_port" name="backend_port" value="{{ config.backend_port }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="frontend_hostname">Frontend Hostname/IP:</label>
|
|
<input type="text" id="frontend_hostname" name="frontend_hostname" value="{{ config.frontend_hostname }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="frontend_port">Frontend Port:</label>
|
|
<input type="text" id="frontend_port" name="frontend_port" value="{{ config.frontend_port }}">
|
|
</div>
|
|
|
|
<button type="button" class="btn" onclick="testConnection()">Verbindung testen</button>
|
|
<button type="button" class="btn btn-success" onclick="saveConfig()">Konfiguration speichern</button>
|
|
<button type="button" class="btn btn-warning" onclick="syncFrontend()">Frontend synchronisieren</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>Verbindungsstatus</h2>
|
|
|
|
<h3>Backend</h3>
|
|
<div class="status {{ 'status-good' if 'Verbunden' in backend_status else 'status-error' }}">
|
|
{{ backend_status }}
|
|
</div>
|
|
|
|
<h3>Frontend</h3>
|
|
<div class="status {{ 'status-good' if 'Verbunden' in frontend_status else 'status-error' }}">
|
|
{{ frontend_status }}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>Netzwerkschnittstellen</h2>
|
|
{% for interface in interfaces %}
|
|
<div class="interface-item">
|
|
<strong>{{ interface.name }}</strong>: {{ interface.address }}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<script>
|
|
function showMessage(message, isError = false) {
|
|
const messageEl = document.getElementById('message');
|
|
messageEl.textContent = message;
|
|
messageEl.className = isError ? 'message message-error' : 'message message-success';
|
|
messageEl.style.display = 'block';
|
|
|
|
// Verstecke Nachricht nach 5 Sekunden
|
|
setTimeout(() => {
|
|
messageEl.style.display = 'none';
|
|
}, 5000);
|
|
}
|
|
|
|
function getFormData() {
|
|
return {
|
|
backend_hostname: document.getElementById('backend_hostname').value,
|
|
backend_port: document.getElementById('backend_port').value,
|
|
frontend_hostname: document.getElementById('frontend_hostname').value,
|
|
frontend_port: document.getElementById('frontend_port').value
|
|
};
|
|
}
|
|
|
|
function testConnection() {
|
|
const formData = getFormData();
|
|
const data = new FormData();
|
|
|
|
for (const key in formData) {
|
|
data.append(key, formData[key]);
|
|
}
|
|
|
|
fetch('/test-connection', {
|
|
method: 'POST',
|
|
body: data
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
let message = 'Backend: ';
|
|
message += data.results.backend.ping ? 'Ping OK' : 'Ping fehlgeschlagen';
|
|
message += ', ';
|
|
message += data.results.backend.connection ? 'Verbindung OK' : 'Keine Verbindung';
|
|
|
|
message += ' | Frontend: ';
|
|
message += data.results.frontend.ping ? 'Ping OK' : 'Ping fehlgeschlagen';
|
|
message += ', ';
|
|
message += data.results.frontend.connection ? 'Verbindung OK' : 'Keine Verbindung';
|
|
|
|
showMessage(message, !(data.results.backend.connection && data.results.frontend.connection));
|
|
} else {
|
|
showMessage(data.message, true);
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showMessage('Fehler bei der Verbindungsprüfung: ' + error, true);
|
|
});
|
|
}
|
|
|
|
function saveConfig() {
|
|
const formData = getFormData();
|
|
const data = new FormData();
|
|
|
|
for (const key in formData) {
|
|
data.append(key, formData[key]);
|
|
}
|
|
|
|
fetch('/save-config', {
|
|
method: 'POST',
|
|
body: data
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
showMessage(data.message, !data.success);
|
|
if (data.success) {
|
|
// Aktualisiere die Seite nach erfolgreicher Speicherung
|
|
setTimeout(() => {
|
|
location.reload();
|
|
}, 1500);
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showMessage('Fehler beim Speichern: ' + error, true);
|
|
});
|
|
}
|
|
|
|
function syncFrontend() {
|
|
fetch('/sync-frontend', {
|
|
method: 'POST'
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
showMessage(data.message, !data.success);
|
|
})
|
|
.catch(error => {
|
|
showMessage('Fehler bei der Frontend-Synchronisierung: ' + error, true);
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |