Struktur: Meldung zur Workspace-Zuweisung bei der OE
Die Distro-Ablehnung stand oben auf der Seite und wurde übersehen (Befund Liebherr 23.10.2026). Jetzt erscheint sie im aufgeklappten Formular der OE, die Seite springt dorthin; ebenso im Admin-Reiter. Kundenseitig zeigt jede OE zusätzlich Gerätezahl und Distro. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ff7f9d314e
commit
4e701cdf82
4 files changed
+35
-4
No files matched your search
@@ -334,8 +334,12 @@ def struktur_oe_workspace(
|
||||
"PUT", f"/api/v1/organisationseinheiten/{oe_id}/workspace",
|
||||
json={"workspace_id": workspace_id or None, "version_id": version_id or None, "automatisch": not version_id},
|
||||
)
|
||||
# Meldung bei der OE selbst, wie routers/struktur.py:oe_workspace().
|
||||
meldung = {"hinweis": "Gespeichert."} if result.get("success") else {"fehler": result.get("message", "Nicht möglich.")}
|
||||
return RedirectResponse(f"/admin/kunden/{organization_id}/struktur?" + urlencode(meldung), status_code=303)
|
||||
meldung["oe"] = oe_id
|
||||
return RedirectResponse(
|
||||
f"/admin/kunden/{organization_id}/struktur?" + urlencode(meldung) + f"#oe-{oe_id}-workspace", status_code=303
|
||||
)
|
||||
|
||||
|
||||
@router.post("/{organization_id}/hostname-konvention")
|
||||
|
||||
+14
-1
@@ -39,6 +39,15 @@ def struktur_ansicht(request: Request, user=Depends(get_current_user)):
|
||||
# Workspace-Zuweisung je OE nur mit freigeschaltetem Creator (GUI-Runde
|
||||
# 23.10.2026); sonst richtet tuxflotte sie ein.
|
||||
creator = workspace_creator.ist_freigeschaltet(user.organization_id)
|
||||
if creator:
|
||||
# Geräte je OE mit Distro, wie im Admin-Reiter - damit vor dem
|
||||
# Zuweisen sichtbar ist, welcher Workspace passt.
|
||||
devices_result = anode_request("GET", f"/api/v1/organizations/{user.organization_id}/devices")
|
||||
devices = devices_result.get("devices", []) if devices_result.get("success") else []
|
||||
for oe in oes:
|
||||
eigene = [d for d in devices if d.get("oe_id") == oe["id"]]
|
||||
oe["anzahl_geraete"] = len(eigene)
|
||||
oe["distros"] = sorted({d["distro"] for d in eigene if d.get("distro")})
|
||||
|
||||
return templates.TemplateResponse(
|
||||
request, "struktur.html",
|
||||
@@ -46,6 +55,7 @@ def struktur_ansicht(request: Request, user=Depends(get_current_user)):
|
||||
"user": user, "organisationseinheiten": oes,
|
||||
"workspaces": zuweisbare_workspaces(str(user.organization_id)) if creator else None,
|
||||
"fehler": request.query_params.get("fehler"), "hinweis": request.query_params.get("hinweis"),
|
||||
"meldung_oe": request.query_params.get("oe"),
|
||||
},
|
||||
)
|
||||
|
||||
@@ -74,8 +84,11 @@ def oe_workspace(
|
||||
"PUT", f"/api/v1/organisationseinheiten/{oe_id}/workspace",
|
||||
json={"workspace_id": workspace_id or None, "version_id": version_id or None, "automatisch": not version_id},
|
||||
)
|
||||
# Meldung bei der OE selbst, Formular offen (Befund Liebherr 23.10.2026:
|
||||
# die Distro-Ablehnung oben auf der Seite wurde übersehen).
|
||||
meldung = {"hinweis": "Gespeichert."} if result.get("success") else {"fehler": result.get("message", "Nicht möglich.")}
|
||||
return RedirectResponse("/struktur?" + urlencode(meldung), status_code=303)
|
||||
meldung["oe"] = oe_id
|
||||
return RedirectResponse("/struktur?" + urlencode(meldung) + f"#oe-{oe_id}-workspace", status_code=303)
|
||||
|
||||
|
||||
@router.post("/struktur")
|
||||
|
||||
@@ -480,8 +480,11 @@
|
||||
Workspace an der OE, vererbt nach unten. Die Distro-Konfliktregel
|
||||
prüft anode beim Speichern. #}
|
||||
<section>
|
||||
{% set meldung_oe = request.query_params.get("oe") %}
|
||||
{% if not meldung_oe %}
|
||||
{% if request.query_params.get("fehler") %}<p><mark>{{ request.query_params.get("fehler") }}</mark></p>{% endif %}
|
||||
{% if request.query_params.get("hinweis") %}<p><ins>{{ request.query_params.get("hinweis") }}</ins></p>{% endif %}
|
||||
{% endif %}
|
||||
<p><small>Ein Workspace an einer OE gilt für alle Geräte darin und in ihren Unter-OEs (außer eine Unter-OE hat einen eigenen). Geräte müssen zur Distro des Workspace passen – sonst wird das Speichern mit Begründung abgelehnt. Gruppen ergänzen nur.</small></p>
|
||||
<style>
|
||||
.oe-karte { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: 0.6rem 0.9rem; margin-bottom: 0.5rem; }
|
||||
@@ -501,8 +504,13 @@
|
||||
{% else %}
|
||||
<small>Kein Workspace – es gilt der Workspace der Installation</small>
|
||||
{% endif %}
|
||||
<details>
|
||||
{% set hier = request.query_params.get("oe") == oe.id %}
|
||||
{% set oe_fehler = request.query_params.get("fehler") if hier %}
|
||||
{% set oe_hinweis = request.query_params.get("hinweis") if hier %}
|
||||
{% if oe_hinweis %}<p><ins>{{ oe_hinweis }}</ins></p>{% endif %}
|
||||
<details id="oe-{{ oe.id }}-workspace"{% if oe_fehler %} open{% endif %}>
|
||||
<summary>Workspace ändern · Unter-OE anlegen</summary>
|
||||
{% if oe_fehler %}<p><mark>{{ oe_fehler }}</mark></p>{% endif %}
|
||||
<form method="post" action="/admin/kunden/{{ organization_id }}/struktur/{{ oe.id }}/workspace">
|
||||
<div class="grid">
|
||||
<label>Workspace
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
{% block title %}Struktur — Tuxflotte{% endblock %}
|
||||
{% block content %}
|
||||
<h2>Struktur</h2>
|
||||
{% if not meldung_oe %}
|
||||
{% if fehler %}<p><mark>{{ fehler }}</mark></p>{% endif %}
|
||||
{% if hinweis %}<p><ins>{{ hinweis }}</ins></p>{% endif %}
|
||||
{% endif %}
|
||||
<p>Organisationseinheiten (OEs) zum Verorten deiner Geräte — z.B. Gebäude oder Klassen. Ein Gerät gehört immer zu genau einer OE, neu aktivierte Geräte landen automatisch in "Neue Geräte".</p>
|
||||
<p><small>
|
||||
Wofür: Du kannst jeder OE eigene Merkmal-Einstellungen geben, die
|
||||
@@ -23,6 +25,7 @@
|
||||
<strong>{{ oe.name }}</strong>{% if oe.ist_standard %} <small>(Standard)</small>{% endif %}
|
||||
{% if oe.workspace %}<small> · Workspace: {{ oe.workspace.name }} ({{ oe.workspace.distro }})</small>
|
||||
{% elif oe.wirksamer_workspace %}<small> · Workspace: {{ oe.wirksamer_workspace.name }} (geerbt von {{ oe.wirksamer_workspace.geerbt_von }})</small>{% endif %}
|
||||
{% if oe.anzahl_geraete is defined %}<small> · {{ oe.anzahl_geraete }} Gerät(e){% if oe.distros %}: {{ oe.distros | join(", ") }}{% endif %}</small>{% endif %}
|
||||
<small>
|
||||
· <a href="/struktur/{{ oe.id }}/merkmale">Merkmale bearbeiten</a>
|
||||
{% if not oe.ist_standard %}
|
||||
@@ -31,8 +34,11 @@
|
||||
{% endif %}
|
||||
</small>
|
||||
{% if workspaces is not none %}
|
||||
<details>
|
||||
{% set hier = meldung_oe == oe.id %}
|
||||
{% if hier and hinweis %}<p><ins>{{ hinweis }}</ins></p>{% endif %}
|
||||
<details id="oe-{{ oe.id }}-workspace"{% if hier and fehler %} open{% endif %}>
|
||||
<summary role="button" class="secondary outline">Workspace zuweisen</summary>
|
||||
{% if hier and fehler %}<p><mark>{{ fehler }}</mark></p>{% endif %}
|
||||
<p><small>Gilt für alle Geräte dieser OE und ihrer Unter-OEs, außer eine Unter-OE hat einen eigenen.
|
||||
Die Geräte müssen zur Distro des Workspace passen, sonst lehnt das Speichern mit Begründung ab.</small></p>
|
||||
<form method="post" action="/struktur/{{ oe.id }}/workspace">
|
||||
|
||||
Reference in new issue
Block a user