Christian Mueller 5267baf0b4 feat: rewrite busylight as FastAPI web application with SQLite
Replace the standalone Python script + config.cfg with a full web
application featuring:
- FastAPI backend with REST API
- SQLite database (config, state, activity log separated)
- Bootstrap 5 web interface for configuration
- Pages: Dashboard, Users, Devices, Assignments, Color Rules, Settings, Log
- APScheduler background polling for Teams presence + AIDA status
- systemd service file for Linux deployment
- Migration script to import existing config.cfg data

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 20:46:33 +02:00

125 lines
6.5 KiB
HTML

{% extends "base.html" %}
{% block title %}WLED-Geraete - Busylight{% endblock %}
{% block content %}
<h4 class="mb-4">WLED-Geraete</h4>
<div class="row g-4">
<div class="col-lg-8">
<div class="card">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead>
<tr>
<th>Hostname / IP</th>
<th>Name</th>
<th>Segmente</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for device in devices %}
<tr>
<td>
<code>{{ device.hostname }}</code>
</td>
<td>{{ device.name }}</td>
<td>{{ device.segment_count }}</td>
<td>
<button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal"
data-bs-target="#edit-{{ device.id }}">
<i class="bi bi-pencil"></i>
</button>
<form method="post" action="/api/devices/{{ device.id }}/delete"
class="d-inline"
onsubmit="return confirm('Geraet wirklich loeschen?')">
<button type="submit" class="btn btn-sm btn-outline-danger">
<i class="bi bi-trash"></i>
</button>
</form>
</td>
</tr>
<!-- Edit Modal -->
<div class="modal fade" id="edit-{{ device.id }}" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<form method="post" action="/api/devices/{{ device.id }}/update">
<div class="modal-header">
<h5 class="modal-title">Geraet bearbeiten</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label">Hostname / IP</label>
<input type="text" name="hostname" class="form-control"
value="{{ device.hostname }}" required>
</div>
<div class="mb-3">
<label class="form-label">Name</label>
<input type="text" name="name" class="form-control"
value="{{ device.name }}">
</div>
<div class="mb-3">
<label class="form-label">Anzahl Segmente</label>
<input type="number" name="segment_count" class="form-control"
value="{{ device.segment_count }}" min="1" max="10">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
<button type="submit" class="btn btn-primary">Speichern</button>
</div>
</form>
</div>
</div>
</div>
{% endfor %}
{% if not devices %}
<tr>
<td colspan="4" class="text-center text-muted py-4">
Noch keine Geraete vorhanden.
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card">
<div class="card-header">
<h6 class="mb-0"><i class="bi bi-plus-circle"></i> Neues Geraet</h6>
</div>
<div class="card-body">
<form method="post" action="/api/devices">
<div class="mb-3">
<label class="form-label">Hostname / IP</label>
<input type="text" name="hostname" class="form-control"
placeholder="doorlight0027.intra.example.de" required>
</div>
<div class="mb-3">
<label class="form-label">Name (optional)</label>
<input type="text" name="name" class="form-control"
placeholder="Buero 027">
</div>
<div class="mb-3">
<label class="form-label">Anzahl Segmente</label>
<input type="number" name="segment_count" class="form-control"
value="2" min="1" max="10">
</div>
<button type="submit" class="btn btn-primary w-100">
<i class="bi bi-plus"></i> Hinzufuegen
</button>
</form>
</div>
</div>
</div>
</div>
{% endblock %}