updated CSS

This commit is contained in:
2025-03-11 10:45:08 +02:00
parent 64af49556d
commit 0b61f87ac5
3 changed files with 36 additions and 3 deletions

View File

@@ -67,7 +67,7 @@ def get_logs():
@app.route('/cleanup', methods=['DELETE'])
def cleanup_logs():
cutoff_date = datetime.utcnow() - timedelta(hours=24)
cutoff_date = datetime.utcnow() - timedelta(hours=app.config.get('CLEANUP_TIME', 24))
Log.query.filter(Log.timestamp < cutoff_date).delete()
db.session.commit()
return jsonify({'status': 'success', 'message': 'Old logs deleted'})
@@ -138,7 +138,8 @@ def control_relay(hostname, relay, action):
@app.route('/settings', methods=['GET'])
def settings():
return render_template('settings.html')
cleanup_time = app.config.get('CLEANUP_TIME', 24)
return render_template('settings.html', cleanup_time=cleanup_time)
@app.route('/set_cleanup_time', methods=['POST'])
def set_cleanup_time():
@@ -150,6 +151,15 @@ def set_cleanup_time():
flash('Invalid cleanup time!', 'danger')
return redirect(url_for('settings'))
@app.route('/run_cleanup_now', methods=['POST'])
def run_cleanup_now():
with app.app_context():
cutoff_date = datetime.utcnow() - timedelta(hours=app.config.get('CLEANUP_TIME', 24))
Log.query.filter(Log.timestamp < cutoff_date).delete()
db.session.commit()
flash('Cleanup executed successfully!', 'success')
return redirect(url_for('settings'))
def post_action_to_server(hostname, action):
url = "http://your-server-url.com/action"
payload = {

Binary file not shown.

View File

@@ -8,7 +8,7 @@
<style>
body {
background-color: #343a40;
color: #050505;
color: #f8f9fa;
}
.card {
background-color: #495057;
@@ -25,6 +25,13 @@
font-size: 1rem;
color: #ced4da;
}
.list-group-item {
background-color: #495057;
color: #f8f9fa;
}
.list-group-item .badge {
color: #f8f9fa;
}
.status-online {
color: #28a745;
font-weight: bold;
@@ -41,6 +48,22 @@
background-color: #0056b3;
border-color: #004085;
}
.btn-success {
background-color: #28a745;
border-color: #28a745;
}
.btn-success:hover {
background-color: #218838;
border-color: #1e7e34;
}
.btn-danger {
background-color: #dc3545;
border-color: #dc3545;
}
.btn-danger:hover {
background-color: #c82333;
border-color: #bd2130;
}
</style>
</head>
<body>