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

80 lines
3.2 KiB
HTML

{% extends "base.html" %}
{% block title %}Farb-Regeln - Busylight{% endblock %}
{% block content %}
<h4 class="mb-4">Farb-Regeln</h4>
{% if request.query_params.get('saved') %}
<div class="alert alert-success alert-dismissible fade show">
<i class="bi bi-check-circle"></i> Farben gespeichert.
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endif %}
<form method="post" action="/api/colors">
<div class="row g-3">
{% for rule in rules %}
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card busylight-card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<strong>{{ rule.status }}</strong>
<input type="hidden" name="status" value="{{ rule.status }}">
</div>
<div class="color-preview"
style="background: rgb({{ rule.r }}, {{ rule.g }}, {{ rule.b }});"
title="Aktuelle Farbe"></div>
</div>
<div class="mb-2">
<label class="form-label small text-muted mb-1">Farbe</label>
<input type="color" name="color_{{ rule.status }}" class="form-control form-control-color w-100"
value="#{{ '%02x%02x%02x' % (rule.r, rule.g, rule.b) | default('000000') }}">
</div>
<div>
<label class="form-label small text-muted mb-1">Effekt (optional)</label>
<input type="text" name="effect_{{ rule.status }}" class="form-control form-control-sm"
value="{{ rule.effect or '' }}" placeholder="z.B. /win&A=255">
</div>
</div>
</div>
</div>
{% endfor %}
</div>
<div class="mt-4">
<button type="submit" class="btn btn-primary">
<i class="bi bi-check-lg"></i> Alle Farben speichern
</button>
</div>
</form>
<hr class="my-4">
<div class="card" style="max-width: 400px;">
<div class="card-header">
<h6 class="mb-0"><i class="bi bi-plus-circle"></i> Neue Farb-Regel</h6>
</div>
<div class="card-body">
<form method="post" action="/api/colors/add">
<div class="mb-3">
<label class="form-label">Status-Name</label>
<input type="text" name="status" class="form-control"
placeholder="z.B. teams_focusing" required>
</div>
<div class="mb-3">
<label class="form-label">Farbe</label>
<input type="color" name="color" class="form-control form-control-color w-100"
value="#00ff00">
</div>
<div class="mb-3">
<label class="form-label">Effekt (optional)</label>
<input type="text" name="effect" class="form-control"
placeholder="z.B. /win&A=255">
</div>
<button type="submit" class="btn btn-outline-primary w-100">Hinzufuegen</button>
</form>
</div>
</div>
{% endblock %}