Es scheint, dass es sich um eine Reihe von Dateien und Logs handelt, die wahrscheinlich mit einem großen, komplexen System zu tun haben. Hier ist ein zusammenfassender Überblick über die Dateien und ihre möglichen Funktionen:
This commit is contained in:
Binary file not shown.
108
backend/app.py
108
backend/app.py
@ -930,8 +930,112 @@ def admin():
|
||||
@app.route("/printers")
|
||||
@login_required
|
||||
def printers_page():
|
||||
"""Zeigt die Übersichtsseite für Drucker an."""
|
||||
return render_template("printers.html")
|
||||
"""Zeigt die Übersichtsseite für Drucker an mit Server-Side Rendering."""
|
||||
try:
|
||||
from utils.hardware_integration import printer_monitor
|
||||
from models import get_db_session, Printer
|
||||
|
||||
# Drucker-Daten server-side laden
|
||||
db_session = get_db_session()
|
||||
all_printers = db_session.query(Printer).filter(Printer.active == True).all()
|
||||
|
||||
# Live-Status für alle Drucker abrufen
|
||||
status_data = printer_monitor.get_live_printer_status()
|
||||
|
||||
# Drucker-Daten mit Status anreichern
|
||||
printers_with_status = []
|
||||
for printer in all_printers:
|
||||
printer_info = {
|
||||
'id': printer.id,
|
||||
'name': printer.name,
|
||||
'model': printer.model or 'Unbekannt',
|
||||
'location': printer.location or 'Unbekannt',
|
||||
'ip_address': printer.ip_address,
|
||||
'plug_ip': printer.plug_ip,
|
||||
'active': printer.active,
|
||||
'status': 'offline'
|
||||
}
|
||||
|
||||
# Status aus LiveData hinzufügen
|
||||
if printer.id in status_data:
|
||||
live_data = status_data[printer.id]
|
||||
printer_info.update({
|
||||
'plug_status': live_data.get('plug_status', 'unknown'),
|
||||
'plug_reachable': live_data.get('plug_reachable', False),
|
||||
'can_control': live_data.get('can_control', False),
|
||||
'last_checked': live_data.get('last_checked'),
|
||||
'error': live_data.get('error')
|
||||
})
|
||||
|
||||
# Status-Display für UI
|
||||
if live_data.get('plug_status') in printer_monitor.STATUS_DISPLAY:
|
||||
printer_info['status_display'] = printer_monitor.STATUS_DISPLAY[live_data.get('plug_status')]
|
||||
else:
|
||||
printer_info.update({
|
||||
'plug_status': 'unknown',
|
||||
'plug_reachable': False,
|
||||
'can_control': False,
|
||||
'status_display': {'text': 'Unbekannt', 'color': 'gray', 'icon': 'question'}
|
||||
})
|
||||
|
||||
printers_with_status.append(printer_info)
|
||||
|
||||
# Einzigartige Werte für Filter
|
||||
models = list(set([p['model'] for p in printers_with_status if p['model'] != 'Unbekannt']))
|
||||
locations = list(set([p['location'] for p in printers_with_status if p['location'] != 'Unbekannt']))
|
||||
|
||||
db_session.close()
|
||||
|
||||
return render_template("printers.html",
|
||||
printers=printers_with_status,
|
||||
models=models,
|
||||
locations=locations,
|
||||
no_javascript=True)
|
||||
|
||||
except Exception as e:
|
||||
app_logger.error(f"Fehler beim Laden der Drucker-Seite: {str(e)}")
|
||||
return render_template("printers.html",
|
||||
printers=[],
|
||||
models=[],
|
||||
locations=[],
|
||||
error=str(e),
|
||||
no_javascript=True)
|
||||
|
||||
@app.route("/printers/control", methods=["POST"])
|
||||
@login_required
|
||||
def printer_control():
|
||||
"""Server-Side Drucker-Steuerung ohne JavaScript."""
|
||||
try:
|
||||
from utils.hardware_integration import printer_monitor
|
||||
|
||||
printer_id = request.form.get('printer_id')
|
||||
action = request.form.get('action') # 'on' oder 'off'
|
||||
|
||||
if not printer_id or not action:
|
||||
flash('Ungültige Parameter für Drucker-Steuerung', 'error')
|
||||
return redirect(url_for('printers_page'))
|
||||
|
||||
if action not in ['on', 'off']:
|
||||
flash('Ungültige Aktion. Nur "on" oder "off" erlaubt.', 'error')
|
||||
return redirect(url_for('printers_page'))
|
||||
|
||||
# Drucker steuern
|
||||
success, message = printer_monitor.control_plug(int(printer_id), action)
|
||||
|
||||
if success:
|
||||
action_text = "eingeschaltet" if action == 'on' else "ausgeschaltet"
|
||||
flash(f'Drucker erfolgreich {action_text}', 'success')
|
||||
app_logger.info(f"✅ Drucker {printer_id} erfolgreich {action_text} durch {current_user.name}")
|
||||
else:
|
||||
flash(f'Fehler bei Drucker-Steuerung: {message}', 'error')
|
||||
app_logger.error(f"❌ Fehler bei Drucker {printer_id} Steuerung: {message}")
|
||||
|
||||
return redirect(url_for('printers_page'))
|
||||
|
||||
except Exception as e:
|
||||
app_logger.error(f"Unerwarteter Fehler bei Drucker-Steuerung: {str(e)}")
|
||||
flash(f'Systemfehler: {str(e)}', 'error')
|
||||
return redirect(url_for('printers_page'))
|
||||
|
||||
@app.route("/jobs")
|
||||
@login_required
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
backend/blueprints/__pycache__/tapo_control.cpython-311.pyc
Normal file
BIN
backend/blueprints/__pycache__/tapo_control.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user