feat: add update service env label
This commit is contained in:
@ -70,6 +70,7 @@ By: Codex (GPT-5)
|
||||
| 15.01.2026 | 🏗️ Planning | ID: US_000045 Kriterien konkretisiert (lokale Zeit, OS-Login, Auto-Reaktivierung). By: Codex (GPT-5) |
|
||||
| 15.01.2026 | 🏗️ Planning | ID: US_000046/TASK_000055 Update-Service Erreichbarkeit anzeigen. By: Codex (GPT-5) |
|
||||
| 15.01.2026 | ⚙️ Code | ID: US_000046 Update-Service Statusanzeige implementiert. By: Codex (GPT-5) |
|
||||
| 15.01.2026 | ⚙️ Code | ID: Update-Service Status zeigt Dev/Prod und nutzt konsistente Panel-Styles. By: Codex (GPT-5) |
|
||||
| 15.01.2026 | ⚙️ Code | ID: Makefile restart-Target hinzugefuegt. By: Codex (GPT-5) |
|
||||
|
||||
---
|
||||
|
||||
@ -81,3 +81,4 @@ class UpdateServiceStatus(BaseModel):
|
||||
status_code: Optional[int] = None
|
||||
error: Optional[str] = None
|
||||
checked_url: str
|
||||
environment: str
|
||||
|
||||
@ -128,13 +128,13 @@
|
||||
<section id="updateSection" class="panel-section hidden">
|
||||
<h3><i data-lucide="download"></i> Update-Verwaltung</h3>
|
||||
|
||||
<div id="updateStatus" style="background: rgba(10, 14, 20, 0.6); border: 1px solid var(--color-border); border-left: 3px solid var(--color-accent); padding: 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem;">
|
||||
<div id="updateStatus" style="background: var(--bg-panel); border: 1px solid var(--border-main); border-left: 3px solid var(--primary); padding: 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem;">
|
||||
<div class="spinner" style="margin: 0 auto;"></div>
|
||||
<p class="text-center text-muted mt-1">Lade Update-Status...</p>
|
||||
</div>
|
||||
|
||||
<!-- Enrollment Section -->
|
||||
<div id="enrollmentSection" class="hidden" style="margin-bottom: 1rem; padding: 1rem; background: rgba(255, 255, 255, 0.05); border-radius: var(--radius-sm); border: 1px dashed var(--color-border);">
|
||||
<div id="enrollmentSection" class="hidden" style="margin-bottom: 1rem; padding: 1rem; background: var(--bg-panel); border-radius: var(--radius-sm); border: 1px dashed var(--border-main);">
|
||||
<h4 style="margin-top: 0; margin-bottom: 0.5rem;"><i data-lucide="link"></i> Gerät registrieren (Enrollment)</h4>
|
||||
<p class="text-muted" style="font-size: 0.875rem; margin-bottom: 0.5rem;">
|
||||
Dieses Gerät ist noch nicht beim Update-Service registriert. Bitte geben Sie einen gültigen Enrollment-Token ein.
|
||||
@ -442,6 +442,9 @@
|
||||
const serviceBadge = serviceStatus.reachable
|
||||
? '<span class="badge success"><i data-lucide="server"></i> Online</span>'
|
||||
: '<span class="badge error"><i data-lucide="server-off"></i> Offline</span>';
|
||||
const envLabel = serviceStatus.environment
|
||||
? serviceStatus.environment.toUpperCase()
|
||||
: 'UNKNOWN';
|
||||
const serviceHint = serviceStatus.status_code
|
||||
? `HTTP ${serviceStatus.status_code}`
|
||||
: (serviceStatus.error || 'keine Antwort');
|
||||
@ -455,6 +458,7 @@
|
||||
<div>
|
||||
<div class="text-muted" style="font-size: 0.75rem; text-transform: uppercase; margin-bottom: 0.25rem;">Update-Service</div>
|
||||
<div>${serviceBadge}</div>
|
||||
<div class="badge neutral" style="display: inline-flex; margin-top: 0.25rem;">${envLabel}</div>
|
||||
<div class="text-muted" style="font-size: 0.75rem;">${serviceStatus.url} (${serviceHint})</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@ -231,8 +231,16 @@ def get_service_status(settings: Settings) -> Dict[str, Any]:
|
||||
"status_code": None,
|
||||
"error": "update service url not configured",
|
||||
"checked_url": "",
|
||||
"environment": "unknown",
|
||||
}
|
||||
|
||||
env = "prod"
|
||||
lowered = base_url.lower()
|
||||
if "://dev." in lowered or lowered.startswith("dev."):
|
||||
env = "dev"
|
||||
elif "://staging." in lowered or lowered.startswith("staging."):
|
||||
env = "staging"
|
||||
|
||||
check_url = base_url
|
||||
try:
|
||||
with httpx.Client(timeout=3.0) as client:
|
||||
@ -243,6 +251,7 @@ def get_service_status(settings: Settings) -> Dict[str, Any]:
|
||||
"status_code": response.status_code,
|
||||
"error": None,
|
||||
"checked_url": check_url,
|
||||
"environment": env,
|
||||
}
|
||||
except Exception as exc:
|
||||
return {
|
||||
@ -251,4 +260,5 @@ def get_service_status(settings: Settings) -> Dict[str, Any]:
|
||||
"status_code": None,
|
||||
"error": str(exc),
|
||||
"checked_url": check_url,
|
||||
"environment": env,
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ curl -X POST -H "Authorization: Bearer $token" \
|
||||
### Update-API (lokal)
|
||||
Alle Update-Endpunkte erfordern Admin-Auth.
|
||||
- `GET /update/status`
|
||||
- `GET /update/service-status` (zeigt URL und Erreichbarkeit des Update-Services)
|
||||
- `GET /update/service-status` (zeigt URL, Erreichbarkeit und Dev/Prod-Umgebung)
|
||||
- `POST /update/enroll` (optional Body: `{ "enroll_token": "..." }`)
|
||||
- `POST /update/check`
|
||||
- `POST /update/apply` (optional Body: `{ "version": "x.y.z" }`)
|
||||
|
||||
@ -11,6 +11,7 @@ damit ich erkenne, ob das Geraet gegen Dev oder Prod konfiguriert ist.
|
||||
- When der Statusbereich angezeigt wird
|
||||
- Then sehe ich die konfigurierte Update-Service URL
|
||||
- And einen Online/Offline-Status basierend auf Erreichbarkeit
|
||||
- And eine Anzeige, ob es sich um Dev/Prod handelt (abgeleitet aus der URL)
|
||||
- And die Anzeige aktualisiert sich bei Status-Refresh
|
||||
|
||||
## Task-Platzhalter
|
||||
|
||||
@ -11,7 +11,7 @@ US_000046
|
||||
|
||||
## Beschreibung
|
||||
- `GET /update/service-status` liefert URL, Reachability, Status-Code.
|
||||
- UI zeigt Status im Update-Bereich.
|
||||
- UI zeigt Status im Update-Bereich inkl. Dev/Prod.
|
||||
|
||||
## Definition of Done (DoD)
|
||||
- Statusanzeige funktioniert auch bei Fehlern (Offline).
|
||||
|
||||
Reference in New Issue
Block a user