Webinterface

This commit is contained in:
2025-09-26 15:51:18 +00:00
parent f057dc65c5
commit 85d7872934
8 changed files with 81 additions and 33 deletions

3
.gitignore vendored
View File

@@ -31,6 +31,9 @@ __pycache__/
!/srv/poe_manager/*.* !/srv/poe_manager/*.*
!/srv/poe_manager/templates/ !/srv/poe_manager/templates/
!/srv/poe_manager/templates/*.* !/srv/poe_manager/templates/*.*
!/srv/poe_manager/static/
!/srv/poe_manager/static/css/
!/srv/poe_manager/static/css/*
# Optional: SQLite DB ignorieren (falls du nicht willst, dass Passwörter im Repo landen) # Optional: SQLite DB ignorieren (falls du nicht willst, dass Passwörter im Repo landen)
# /srv/poe_manager/sqlite.db # /srv/poe_manager/sqlite.db

View File

@@ -0,0 +1,24 @@
body {
padding: 20px;
}
.table-dark {
background-color: #343a40 !important;
color: #fff !important;
}
.badge {
font-size: 0.9rem;
}
pre {
background-color: #f8f9fa;
padding: 10px;
border-radius: 5px;
max-height: 600px;
overflow-y: scroll;
}
.mb-3 a.btn {
margin-right: 5px;
}

View File

@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>Devices</title> <title>Devices</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head> </head>
<body class="p-5"> <body class="p-5">

View File

@@ -2,18 +2,7 @@
<html> <html>
<head> <head>
<title>Device Dashboard</title> <title>Device Dashboard</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<style>
.device-card {
width: 150px;
margin: 5px;
text-align: center;
}
.status-badge {
font-size: 0.9rem;
margin-top: 5px;
}
</style>
</head> </head>
<body class="p-3"> <body class="p-3">
@@ -28,20 +17,28 @@
<p>Prüfintervall: <strong>{{ interval }} Minuten</strong></p> <p>Prüfintervall: <strong>{{ interval }} Minuten</strong></p>
<div class="d-flex flex-wrap"> <table class="table table-bordered table-striped">
{% for d in devices %} <thead class="table-dark">
<div class="card device-card"> <tr>
<div class="card-body"> <th>Device-Name</th>
<h6 class="card-title">{{ d['name'] }}</h6> <th>Status</th>
</tr>
</thead>
<tbody>
{% for d in devices %}
<tr>
<td>{{ d['name'] }}</td>
<td>
{% if status[d['name']] == 'online' %} {% if status[d['name']] == 'online' %}
<span class="badge bg-success status-badge">Online</span> <span class="badge bg-success">Online</span>
{% else %} {% else %}
<span class="badge bg-danger status-badge">Offline</span> <span class="badge bg-danger">Offline</span>
{% endif %} {% endif %}
</div> </td>
</div> </tr>
{% endfor %} {% endfor %}
</div> </tbody>
</table>
</body> </body>
</html> </html>

View File

@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>Login</title> <title>Login</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head> </head>
<body class="p-5"> <body class="p-5">
<h2>Login</h2> <h2>Login</h2>

View File

@@ -2,12 +2,36 @@
<html> <html>
<head> <head>
<title>Live Log</title> <title>Live Log</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<meta http-equiv="refresh" content="5"> <!-- alle 5 Sekunden neu laden --> <meta http-equiv="refresh" content="5"> <!-- automatische Aktualisierung alle 5 Sekunden -->
</head> </head>
<body class="p-3"> <body>
<h2>Live Log: {{ log_name }}</h2>
<a href="{{ url_for('index') }}" class="btn btn-secondary mb-3">Zurück zum Dashboard</a> <h2>Live Log</h2>
<pre style="height:80vh; overflow:auto; background:#f8f9fa; padding:10px;">{{ log_content }}</pre>
<div class="mb-3">
<a href="{{ url_for('index') }}" class="btn btn-secondary">Dashboard</a>
<a href="{{ url_for('devices') }}" class="btn btn-secondary">Devices verwalten</a>
<a href="{{ url_for('switches') }}" class="btn btn-secondary">Switches verwalten</a>
</div>
<table class="table table-bordered table-striped">
<thead class="table-dark">
<tr>
<th>Timestamp</th>
<th>Log</th>
</tr>
</thead>
<tbody>
{% for line in log_lines %}
<tr>
{% set parts = line.split(' ', 1) %}
<td>{{ parts[0] if parts|length > 0 else '' }}</td>
<td>{{ parts[1] if parts|length > 1 else line }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</body> </body>
</html> </html>

View File

@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>Einstellungen</title> <title>Einstellungen</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head> </head>
<body class="p-5"> <body class="p-5">

View File

@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>Switches</title> <title>Switches</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head> </head>
<body class="p-5"> <body class="p-5">