Show which exercises differ from their last published release.
Deploy Development / deploy (push) Successful in 53s
Test Suite / pytest-backend (push) Failing after 30s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 17s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Failing after 7m42s
Deploy Development / deploy (push) Successful in 53s
Test Suite / pytest-backend (push) Failing after 30s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 17s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Failing after 7m42s
The release tab names the changed areas, and an admin list collects those exercises so a new release stays a deliberate publication. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4b33b17b2d
commit
4ad62b6e38
14 files changed
+305
-6
No files matched your search
@@ -30,7 +30,7 @@ Fortlaufend gemäß `ACCESS_LAYER_AND_GOVERNANCE_PLAN.md` Stufe A–C.
|
|||||||
| media_assets | `GET /api/media-assets/{id}/file` | ja | `get_tenant_context_flexible` | ja | aktiv: Bibliotheks-Sichtbarkeit; `trash_soft`/`trash_hidden`: wie Lifecycle-Verwaltung |
|
| media_assets | `GET /api/media-assets/{id}/file` | ja | `get_tenant_context_flexible` | ja | aktiv: Bibliotheks-Sichtbarkeit; `trash_soft`/`trash_hidden`: wie Lifecycle-Verwaltung |
|
||||||
| exercises | `POST /api/exercises/{id}/media/from-asset` | ja | `get_tenant_context` | ja | Verknüpfung `exercise_media` → bestehendes `media_asset_id`; Bearbeitungsrecht Übung + Leserecht Archiv |
|
| exercises | `POST /api/exercises/{id}/media/from-asset` | ja | `get_tenant_context` | ja | Verknüpfung `exercise_media` → bestehendes `media_asset_id`; Bearbeitungsrecht Übung + Leserecht Archiv |
|
||||||
| distribution | `GET /api/distribution/v1/*` | Kanal aus Schlüssel | kein Trainer-Tenant | ja, Empfänger der Anbindung | ACCESS_LAYER exempt: Bearer-Distributions-Schlüssel, nicht `X-Auth-Token`. `GET …/exercises/{source_id}/availability` meldet Quelle und Paketstand dieses Kanals |
|
| distribution | `GET /api/distribution/v1/*` | Kanal aus Schlüssel | kein Trainer-Tenant | ja, Empfänger der Anbindung | ACCESS_LAYER exempt: Bearer-Distributions-Schlüssel, nicht `X-Auth-Token`. `GET …/exercises/{source_id}/availability` meldet Quelle und Paketstand dieses Kanals |
|
||||||
| distribution | `POST /api/exercises/{id}/distribution/*`, `/api/distribution/access/*` | ja | `get_tenant_context` | ja | Privat: Besitzer; Verein: `club_admin` und freigeschalteter Verein; global: nur `superadmin`. Schlüssel legt der Mandant an. Vereinsfreischaltung nur `superadmin` |
|
| distribution | `POST /api/exercises/{id}/distribution/*`, `/api/distribution/access/*`, `GET /api/distribution/release-updates` | ja | `get_tenant_context` | ja | Privat: Besitzer; Verein: `club_admin` und freigeschalteter Verein; global: nur `superadmin`. Schlüssel legt der Mandant an. Vereinsfreischaltung nur `superadmin`. Der Release-Abgleich zeigt nur Übungen, die der Aufrufer erneut freigeben darf |
|
||||||
| auth | `/api/auth/*` | nein | — | Login/Session | EXEMPT |
|
| auth | `/api/auth/*` | nein | — | Login/Session | EXEMPT |
|
||||||
| catalogs | Katalog-CRUD | nein (global) | `require_auth` | Admin/Trainer je Endpoint | EXEMPT; bei späterem `club_id` nachziehen |
|
| catalogs | Katalog-CRUD | nein (global) | `require_auth` | Admin/Trainer je Endpoint | EXEMPT; bei späterem `club_id` nachziehen |
|
||||||
| skills | `/api/skills*` | nein (global) | `require_auth` | je Endpoint | EXEMPT |
|
| skills | `/api/skills*` | nein (global) | `require_auth` | je Endpoint | EXEMPT |
|
||||||
|
|||||||
@@ -410,6 +410,71 @@ def _duration_note(exercise: dict) -> Optional[str]:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _manifest_part_text(manifest: dict, role: str) -> str:
|
||||||
|
parts = ((manifest.get("exercise") or {}).get("parts") or [])
|
||||||
|
return "\n".join((part.get("text") or "").strip() for part in parts if part.get("role") == role).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def _instruction_texts(exercise: dict, variants: list[dict]) -> list[str]:
|
||||||
|
texts = []
|
||||||
|
base = plaintext(exercise.get("execution"))
|
||||||
|
if variants:
|
||||||
|
for variant in variants:
|
||||||
|
extra = plaintext(variant.get("execution_changes"))
|
||||||
|
combined = "\n".join(piece for piece in (base, extra) if piece)
|
||||||
|
if combined:
|
||||||
|
texts.append(combined)
|
||||||
|
elif base:
|
||||||
|
texts.append(base)
|
||||||
|
return texts
|
||||||
|
|
||||||
|
|
||||||
|
def changed_areas(exercise: dict, variants: list[dict], media: list[dict], manifest: dict) -> list[str]:
|
||||||
|
"""Benannte Abweichungen der Arbeitsfassung vom gespeicherten Release-Manifest."""
|
||||||
|
body = manifest.get("exercise") or {}
|
||||||
|
areas: list[str] = []
|
||||||
|
if (exercise.get("title") or "") != (body.get("title") or ""):
|
||||||
|
areas.append("Titel")
|
||||||
|
if (plaintext(exercise.get("summary")) or "") != (body.get("summary") or ""):
|
||||||
|
areas.append("Kurztext")
|
||||||
|
for role, label, current in (
|
||||||
|
("goal", "Ziel", plaintext(exercise.get("goal"))),
|
||||||
|
("preparation", "Vorbereitung", plaintext(exercise.get("preparation"))),
|
||||||
|
("trainer_notes", "Trainerhinweise", plaintext(exercise.get("trainer_notes"))),
|
||||||
|
("equipment", "Material", plaintext(_equipment_text(exercise))),
|
||||||
|
("duration_note", "Dauer", plaintext(_duration_note(exercise))),
|
||||||
|
):
|
||||||
|
if (current or "") != _manifest_part_text(manifest, role):
|
||||||
|
areas.append(label)
|
||||||
|
released_instructions = sorted(
|
||||||
|
(part.get("text") or "").strip()
|
||||||
|
for part in (body.get("parts") or [])
|
||||||
|
if part.get("role") == "instructions" and (part.get("text") or "").strip()
|
||||||
|
)
|
||||||
|
if sorted(_instruction_texts(exercise, variants)) != released_instructions:
|
||||||
|
areas.append("Durchführung")
|
||||||
|
released_variants = list(body.get("variants") or [])
|
||||||
|
if variants:
|
||||||
|
current_variants = sorted((str(item.get("public_id")), item.get("variant_name") or "") for item in variants)
|
||||||
|
released_pairs = sorted((str(item.get("id")), item.get("label") or "") for item in released_variants)
|
||||||
|
if current_variants != released_pairs:
|
||||||
|
areas.append("Varianten")
|
||||||
|
elif len(released_variants) != 1:
|
||||||
|
areas.append("Varianten")
|
||||||
|
current_by_id = {str(item.get("public_id")): item.get("sha256") or "" for item in media}
|
||||||
|
released_by_id = {str(item.get("id")): item.get("sha256") or "" for item in (body.get("assets") or [])}
|
||||||
|
media_changed = set(current_by_id) != set(released_by_id)
|
||||||
|
if not media_changed:
|
||||||
|
for key, digest in current_by_id.items():
|
||||||
|
released_digest = released_by_id.get(key) or ""
|
||||||
|
if digest and released_digest and digest != released_digest:
|
||||||
|
media_changed = True
|
||||||
|
break
|
||||||
|
if media_changed:
|
||||||
|
areas.append("Medien")
|
||||||
|
return areas
|
||||||
|
|
||||||
|
|
||||||
def _equipment_text(exercise: dict) -> Optional[str]:
|
def _equipment_text(exercise: dict) -> Optional[str]:
|
||||||
raw = exercise.get("equipment")
|
raw = exercise.get("equipment")
|
||||||
if isinstance(raw, str):
|
if isinstance(raw, str):
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ from distribution_contract import (
|
|||||||
REASON_CODES,
|
REASON_CODES,
|
||||||
can_withdraw,
|
can_withdraw,
|
||||||
canonical_json,
|
canonical_json,
|
||||||
|
changed_areas,
|
||||||
collect_blockers,
|
collect_blockers,
|
||||||
cut_hash,
|
cut_hash,
|
||||||
decide_confirm,
|
decide_confirm,
|
||||||
@@ -415,6 +416,7 @@ def overview(cur, exercise_id: int, profile_id: int, role: str) -> dict:
|
|||||||
"release_block": release_block,
|
"release_block": release_block,
|
||||||
"releases": releases,
|
"releases": releases,
|
||||||
"keys": keys,
|
"keys": keys,
|
||||||
|
"drift": exercise_release_drift(cur, exercise),
|
||||||
"profile_id": profile_id,
|
"profile_id": profile_id,
|
||||||
"role": role,
|
"role": role,
|
||||||
}
|
}
|
||||||
@@ -1572,6 +1574,99 @@ def release_keys_for_exercise(cur, exercise: dict, profile_id: int, role: str) -
|
|||||||
return keys, None
|
return keys, None
|
||||||
|
|
||||||
|
|
||||||
|
def _latest_release_row(cur, source_id: str) -> Optional[dict]:
|
||||||
|
cur.execute(
|
||||||
|
"""
|
||||||
|
SELECT r.release_id, r.revision, r.published_at, r.manifest_text, sr.snapshot_hash
|
||||||
|
FROM distribution_releases r
|
||||||
|
JOIN distribution_source_revisions sr
|
||||||
|
ON sr.source_id = r.source_id AND sr.revision = r.revision
|
||||||
|
WHERE r.source_id = %s
|
||||||
|
ORDER BY r.revision DESC, r.published_at DESC
|
||||||
|
LIMIT 1
|
||||||
|
""",
|
||||||
|
(str(source_id),),
|
||||||
|
)
|
||||||
|
return _one(cur)
|
||||||
|
|
||||||
|
|
||||||
|
def _drift_from_row(exercise: dict, variants: list[dict], media: list[dict], row: dict) -> dict:
|
||||||
|
published = row.get("published_at")
|
||||||
|
base = {
|
||||||
|
"differs": False,
|
||||||
|
"revision": row.get("revision"),
|
||||||
|
"release_id": str(row["release_id"]),
|
||||||
|
"published_at": format_utc(published) if published and not isinstance(published, str) else published,
|
||||||
|
}
|
||||||
|
if snapshot_hash(exercise, variants, media) == row.get("snapshot_hash"):
|
||||||
|
return base
|
||||||
|
manifest = row.get("manifest_text")
|
||||||
|
if isinstance(manifest, str):
|
||||||
|
import json
|
||||||
|
|
||||||
|
manifest = json.loads(manifest)
|
||||||
|
areas = changed_areas(exercise, variants, media, manifest or {})
|
||||||
|
return {**base, "differs": True, "areas": areas or ["Weitere Angaben"]}
|
||||||
|
|
||||||
|
|
||||||
|
def exercise_release_drift(cur, exercise: dict) -> dict:
|
||||||
|
row = _latest_release_row(cur, str(exercise["public_id"]))
|
||||||
|
if not row:
|
||||||
|
return {"differs": False}
|
||||||
|
variants = _load_variants(cur, int(exercise["id"]))
|
||||||
|
media = _load_media(cur, int(exercise["id"]))
|
||||||
|
return _drift_from_row(exercise, variants, media, row)
|
||||||
|
|
||||||
|
|
||||||
|
def _may_rerelease(cur, exercise: dict, profile_id: int, role: str) -> bool:
|
||||||
|
vis = (exercise.get("visibility") or "private").strip().lower()
|
||||||
|
kind = {"official": "platform", "club": "club"}.get(vis, "own")
|
||||||
|
return _denial_for(cur, exercise, {"kind": kind, "club_id": exercise.get("club_id")}, profile_id, role) is None
|
||||||
|
|
||||||
|
|
||||||
|
def list_release_drift(cur, profile_id: int, role: str) -> list[dict]:
|
||||||
|
cur.execute(
|
||||||
|
"""
|
||||||
|
SELECT DISTINCT ON (e.id)
|
||||||
|
e.id, e.public_id, e.title, e.summary, e.goal, e.execution, e.preparation,
|
||||||
|
e.trainer_notes, e.equipment, e.duration_min, e.duration_max, e.status,
|
||||||
|
e.visibility, e.club_id, e.exercise_kind, e.created_by,
|
||||||
|
c.name AS club_name,
|
||||||
|
r.release_id, r.revision, r.published_at, r.manifest_text, sr.snapshot_hash
|
||||||
|
FROM exercises e
|
||||||
|
JOIN distribution_releases r ON r.source_id = e.public_id
|
||||||
|
JOIN distribution_source_revisions sr
|
||||||
|
ON sr.source_id = r.source_id AND sr.revision = r.revision
|
||||||
|
LEFT JOIN clubs c ON c.id = e.club_id
|
||||||
|
ORDER BY e.id, r.revision DESC, r.published_at DESC
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
rows = [r2d(row) for row in _rows(cur)]
|
||||||
|
items = []
|
||||||
|
for exercise in rows:
|
||||||
|
if not _may_rerelease(cur, exercise, profile_id, role):
|
||||||
|
continue
|
||||||
|
variants = _load_variants(cur, int(exercise["id"]))
|
||||||
|
media = _load_media(cur, int(exercise["id"]))
|
||||||
|
drift = _drift_from_row(exercise, variants, media, exercise)
|
||||||
|
if not drift["differs"]:
|
||||||
|
continue
|
||||||
|
vis = (exercise.get("visibility") or "private").strip().lower()
|
||||||
|
items.append(
|
||||||
|
{
|
||||||
|
"exercise_id": int(exercise["id"]),
|
||||||
|
"title": exercise.get("title") or "Übung",
|
||||||
|
"visibility": vis,
|
||||||
|
"club_name": exercise.get("club_name"),
|
||||||
|
"revision": drift["revision"],
|
||||||
|
"published_at": drift["published_at"],
|
||||||
|
"areas": drift["areas"],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
items.sort(key=lambda item: (item["title"] or "").lower())
|
||||||
|
return items
|
||||||
|
|
||||||
|
|
||||||
def target_for_key(cur, exercise_id: int, key_id: str, profile_id: int, role: str) -> tuple[str, str]:
|
def target_for_key(cur, exercise_id: int, key_id: str, profile_id: int, role: str) -> tuple[str, str]:
|
||||||
exercise = _load_exercise(cur, exercise_id)
|
exercise = _load_exercise(cur, exercise_id)
|
||||||
keys, block = release_keys_for_exercise(cur, exercise, profile_id, role)
|
keys, block = release_keys_for_exercise(cur, exercise, profile_id, role)
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ from distribution_service import (
|
|||||||
create_named_key,
|
create_named_key,
|
||||||
issue_key,
|
issue_key,
|
||||||
list_changes,
|
list_changes,
|
||||||
|
list_release_drift,
|
||||||
load_asset,
|
load_asset,
|
||||||
load_availability,
|
load_availability,
|
||||||
load_manifest,
|
load_manifest,
|
||||||
@@ -500,6 +501,13 @@ def get_backlog(tenant: TenantContext = Depends(get_tenant_context)):
|
|||||||
return {"count": backlog_count(cur)}
|
return {"count": backlog_count(cur)}
|
||||||
|
|
||||||
|
|
||||||
|
@editorial.get("/api/distribution/release-updates")
|
||||||
|
def get_release_updates(tenant: TenantContext = Depends(get_tenant_context)):
|
||||||
|
with get_db() as conn:
|
||||||
|
cur = get_cursor(conn)
|
||||||
|
return {"items": list_release_drift(cur, tenant.profile_id, tenant.global_role or "")}
|
||||||
|
|
||||||
|
|
||||||
@editorial.get("/api/distribution/access")
|
@editorial.get("/api/distribution/access")
|
||||||
def get_access(tenant: TenantContext = Depends(get_tenant_context)):
|
def get_access(tenant: TenantContext = Depends(get_tenant_context)):
|
||||||
with get_db() as conn:
|
with get_db() as conn:
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ from distribution_contract import (
|
|||||||
official_write_allowed,
|
official_write_allowed,
|
||||||
plan_available,
|
plan_available,
|
||||||
rate_decision,
|
rate_decision,
|
||||||
|
changed_areas,
|
||||||
release_denial,
|
release_denial,
|
||||||
retrievable_release_ids,
|
retrievable_release_ids,
|
||||||
sha256_bytes,
|
sha256_bytes,
|
||||||
@@ -281,6 +282,35 @@ def test_release_screen_keeps_the_application_key() -> None:
|
|||||||
assert [item["label"] for item in keys] == ["Lara"]
|
assert [item["label"] for item in keys] == ["Lara"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_changed_areas_names_the_edited_instruction() -> None:
|
||||||
|
exercise = {
|
||||||
|
"title": "Stand",
|
||||||
|
"summary": "",
|
||||||
|
"goal": "Sehen",
|
||||||
|
"execution": "Neuer Weg",
|
||||||
|
"preparation": "",
|
||||||
|
"trainer_notes": "",
|
||||||
|
"equipment": None,
|
||||||
|
"duration_min": None,
|
||||||
|
"duration_max": None,
|
||||||
|
}
|
||||||
|
manifest = {
|
||||||
|
"exercise": {
|
||||||
|
"title": "Stand",
|
||||||
|
"summary": None,
|
||||||
|
"parts": [
|
||||||
|
{"role": "goal", "text": "Sehen"},
|
||||||
|
{"role": "instructions", "text": "Alter Weg"},
|
||||||
|
],
|
||||||
|
"variants": [{"id": "v", "label": "Standard"}],
|
||||||
|
"assets": [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert changed_areas(exercise, [], [], manifest) == ["Durchführung"]
|
||||||
|
exercise["execution"] = "Alter Weg"
|
||||||
|
assert changed_areas(exercise, [], [], manifest) == []
|
||||||
|
|
||||||
|
|
||||||
def test_channel_sequence_is_locked() -> None:
|
def test_channel_sequence_is_locked() -> None:
|
||||||
assert "FOR UPDATE" in inspect.getsource(_lock_recipient)
|
assert "FOR UPDATE" in inspect.getsource(_lock_recipient)
|
||||||
|
|
||||||
|
|||||||
+9
-2
@@ -1,6 +1,6 @@
|
|||||||
# Shinkan Jinkendo Version Information
|
# Shinkan Jinkendo Version Information
|
||||||
|
|
||||||
APP_VERSION = "0.8.255"
|
APP_VERSION = "0.8.256"
|
||||||
BUILD_DATE = "2026-11-23"
|
BUILD_DATE = "2026-11-23"
|
||||||
DB_SCHEMA_VERSION = "20261123101"
|
DB_SCHEMA_VERSION = "20261123101"
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ MODULE_VERSIONS = {
|
|||||||
"skill_profiles": "1.0.0", # Phase 3: gewichtetes Fähigkeiten-Profil + skill-discovery/suggestions
|
"skill_profiles": "1.0.0", # Phase 3: gewichtetes Fähigkeiten-Profil + skill-discovery/suggestions
|
||||||
"methods": "0.1.0",
|
"methods": "0.1.0",
|
||||||
"exercises": "2.38.0", # Globale Übungen schreibt und gibt nur superadmin frei
|
"exercises": "2.38.0", # Globale Übungen schreibt und gibt nur superadmin frei
|
||||||
"distribution": "1.3.1", # Freigabe liest den Schlüssel, bevor weitere Abfragen denselben Cursor benutzen
|
"distribution": "1.4.0", # Arbeitsfassung gegen letztes Release: Übung und zentrale Abgleichliste
|
||||||
"planning_exercise_suggest": "0.23.8", # Progressionsgraph: Katalog-Kontext (Fokus/Stil/TT/ZG) im Match-Profil
|
"planning_exercise_suggest": "0.23.8", # Progressionsgraph: Katalog-Kontext (Fokus/Stil/TT/ZG) im Match-Profil
|
||||||
"training_units": "0.4.0", # POST .../publish-to-framework: Ablauf aus geplanter Einheit → Rahmen-Slot-Blueprint
|
"training_units": "0.4.0", # POST .../publish-to-framework: Ablauf aus geplanter Einheit → Rahmen-Slot-Blueprint
|
||||||
"training_programs": "0.1.0",
|
"training_programs": "0.1.0",
|
||||||
@@ -55,6 +55,13 @@ MODULE_VERSIONS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CHANGELOG = [
|
CHANGELOG = [
|
||||||
|
{
|
||||||
|
"version": "0.8.256",
|
||||||
|
"date": "2026-11-23",
|
||||||
|
"changes": [
|
||||||
|
"Die Übungsfreigabe zeigt, wo die Arbeitsfassung vom letzten Release abweicht. Eine Adminseite listet diese Übungen zum gezielten neuen Release.",
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "0.8.255",
|
"version": "0.8.255",
|
||||||
"date": "2026-11-23",
|
"date": "2026-11-23",
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ const AdminUsersPage = lazyWithRetry(() => import('./pages/AdminUsersPage'))
|
|||||||
const AdminClubCreationRequestsPage = lazyWithRetry(() => import('./pages/AdminClubCreationRequestsPage'))
|
const AdminClubCreationRequestsPage = lazyWithRetry(() => import('./pages/AdminClubCreationRequestsPage'))
|
||||||
const AdminRightsPage = lazyWithRetry(() => import('./pages/AdminRightsPage'))
|
const AdminRightsPage = lazyWithRetry(() => import('./pages/AdminRightsPage'))
|
||||||
const AdminDistributionPage = lazyWithRetry(() => import('./pages/AdminDistributionPage'))
|
const AdminDistributionPage = lazyWithRetry(() => import('./pages/AdminDistributionPage'))
|
||||||
|
const AdminReleaseUpdatesPage = lazyWithRetry(() => import('./pages/AdminReleaseUpdatesPage'))
|
||||||
const MediaLibraryPage = lazyWithRetry(() => import('./pages/MediaLibraryPage'))
|
const MediaLibraryPage = lazyWithRetry(() => import('./pages/MediaLibraryPage'))
|
||||||
const LegalPage = lazyWithRetry(() => import('./pages/LegalPage'))
|
const LegalPage = lazyWithRetry(() => import('./pages/LegalPage'))
|
||||||
const AdminLegalDocumentsPage = lazyWithRetry(() => import('./pages/AdminLegalDocumentsPage'))
|
const AdminLegalDocumentsPage = lazyWithRetry(() => import('./pages/AdminLegalDocumentsPage'))
|
||||||
@@ -328,6 +329,10 @@ const appRouter = createBrowserRouter([
|
|||||||
path: 'admin/distribution',
|
path: 'admin/distribution',
|
||||||
element: <AdminDistributionPage />,
|
element: <AdminDistributionPage />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'admin/release-updates',
|
||||||
|
element: <AdminReleaseUpdatesPage />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'admin/rights',
|
path: 'admin/rights',
|
||||||
element: (
|
element: (
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ export function getDistributionAccess() {
|
|||||||
return request('/api/distribution/access')
|
return request('/api/distribution/access')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDistributionReleaseUpdates() {
|
||||||
|
return request('/api/distribution/release-updates')
|
||||||
|
}
|
||||||
|
|
||||||
export function setClubDistributionApi(clubId, enabled) {
|
export function setClubDistributionApi(clubId, enabled) {
|
||||||
return request(`/api/distribution/access/clubs/${clubId}`, {
|
return request(`/api/distribution/access/clubs/${clubId}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { NavLink } from 'react-router-dom'
|
import { NavLink } from 'react-router-dom'
|
||||||
import { TreePine, FolderTree, Download, Grid3x3, Users, Scale, Sparkles, Bot, Wand2, Activity, Building2, Shield, Share2 } from 'lucide-react'
|
import { TreePine, FolderTree, Download, Grid3x3, Users, Scale, Sparkles, Bot, Wand2, Activity, Building2, Shield, Share2, FileDiff } from 'lucide-react'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin-Seiten-Navigation (horizontal) — nur für Super-Admins (globaler Portal-Mandant).
|
* Admin-Seiten-Navigation (horizontal) — nur für Super-Admins (globaler Portal-Mandant).
|
||||||
@@ -19,6 +19,7 @@ export default function AdminPageNav() {
|
|||||||
{ to: '/admin/openrouter', label: 'KI-Modell', icon: Bot },
|
{ to: '/admin/openrouter', label: 'KI-Modell', icon: Bot },
|
||||||
{ to: '/admin/exercise-enrichment', label: 'Übungs-Anreicherung', icon: Wand2 },
|
{ to: '/admin/exercise-enrichment', label: 'Übungs-Anreicherung', icon: Wand2 },
|
||||||
{ to: '/admin/distribution', label: 'API-Schnittstelle', icon: Share2 },
|
{ to: '/admin/distribution', label: 'API-Schnittstelle', icon: Share2 },
|
||||||
|
{ to: '/admin/release-updates', label: 'Release-Abgleich', icon: FileDiff },
|
||||||
]
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -128,6 +128,15 @@ export default function ExerciseDistributionPanel({ exerciseId }) {
|
|||||||
<p>Die Distribution ist auf dieser Instanz nicht aktiv. Bearbeitung und Planung bleiben davon unberührt.</p>
|
<p>Die Distribution ist auf dieser Instanz nicht aktiv. Bearbeitung und Planung bleiben davon unberührt.</p>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
{overview.drift?.differs ? (
|
||||||
|
<p>
|
||||||
|
Die Arbeitsfassung weicht vom Release Revision {overview.drift.revision} ab
|
||||||
|
{overview.drift.areas?.length ? `: ${overview.drift.areas.join(', ')}` : ''}. Ein neues Release
|
||||||
|
veröffentlicht diesen Stand. Das bisherige Release bleibt unter seiner ID abrufbar.
|
||||||
|
</p>
|
||||||
|
) : overview.releases?.length ? (
|
||||||
|
<p>Die Arbeitsfassung entspricht dem letzten Release.</p>
|
||||||
|
) : null}
|
||||||
{overview.release_block ? <p>{overview.release_block}</p> : null}
|
{overview.release_block ? <p>{overview.release_block}</p> : null}
|
||||||
<label className="form-label">
|
<label className="form-label">
|
||||||
API-Schlüssel
|
API-Schlüssel
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useState, useRef, useMemo, useCallback } from 'react'
|
import React, { useEffect, useState, useRef, useMemo, useCallback } from 'react'
|
||||||
import { useNavigate, useParams, Link, useLocation } from 'react-router-dom'
|
import { useNavigate, useParams, Link, useLocation, useSearchParams } from 'react-router-dom'
|
||||||
import api, { buildExerciseApiPayload } from '../../utils/api'
|
import api, { buildExerciseApiPayload } from '../../utils/api'
|
||||||
import { resolveExerciseMediaFileUrl, resolveMediaAssetFileUrl, useMediaAccessToken } from '../../utils/exerciseMediaUrl'
|
import { resolveExerciseMediaFileUrl, resolveMediaAssetFileUrl, useMediaAccessToken } from '../../utils/exerciseMediaUrl'
|
||||||
import RichTextEditor from '../RichTextEditor'
|
import RichTextEditor from '../RichTextEditor'
|
||||||
@@ -647,7 +647,13 @@ function ExerciseFormPageRoot() {
|
|||||||
const [aiSuggestBusy, setAiSuggestBusy] = useState(false)
|
const [aiSuggestBusy, setAiSuggestBusy] = useState(false)
|
||||||
const [aiSuggestionPreview, setAiSuggestionPreview] = useState(null)
|
const [aiSuggestionPreview, setAiSuggestionPreview] = useState(null)
|
||||||
const [variantEditSelection, setVariantEditSelection] = useState(null)
|
const [variantEditSelection, setVariantEditSelection] = useState(null)
|
||||||
const [activeFormTab, setActiveFormTab] = useState('stammdaten')
|
const [searchParams] = useSearchParams()
|
||||||
|
const requestedTab = searchParams.get('tab')
|
||||||
|
const [activeFormTab, setActiveFormTab] = useState(
|
||||||
|
['stammdaten', 'anleitung', 'einordnung', 'kombination', 'varianten', 'medien', 'freigabe'].includes(requestedTab)
|
||||||
|
? requestedTab
|
||||||
|
: 'stammdaten',
|
||||||
|
)
|
||||||
const variantsSavedSnapshotRef = useRef({})
|
const variantsSavedSnapshotRef = useRef({})
|
||||||
|
|
||||||
const exerciseFormTabs = useMemo(() => {
|
const exerciseFormTabs = useMemo(() => {
|
||||||
|
|||||||
@@ -608,6 +608,8 @@ function AccountSettingsPage() {
|
|||||||
|
|
||||||
<p className="muted" style={{ marginTop: '1.75rem', fontSize: '0.875rem', lineHeight: 1.5 }}>
|
<p className="muted" style={{ marginTop: '1.75rem', fontSize: '0.875rem', lineHeight: 1.5 }}>
|
||||||
<Link to="/admin/distribution">API-Schlüssel</Link>
|
<Link to="/admin/distribution">API-Schlüssel</Link>
|
||||||
|
{' · '}
|
||||||
|
<Link to="/admin/release-updates">Offene Release-Änderungen</Link>
|
||||||
{' — Schnittstelle für Übungen und spätere Planungsinhalte'}
|
{' — Schnittstelle für Übungen und spätere Planungsinhalte'}
|
||||||
</p>
|
</p>
|
||||||
<p className="muted" style={{ marginTop: '0.6rem', fontSize: '0.875rem', lineHeight: 1.5 }}>
|
<p className="muted" style={{ marginTop: '0.6rem', fontSize: '0.875rem', lineHeight: 1.5 }}>
|
||||||
|
|||||||
@@ -200,6 +200,9 @@ export default function AdminDistributionPage() {
|
|||||||
<div style={{ padding: 16, maxWidth: 880 }}>
|
<div style={{ padding: 16, maxWidth: 880 }}>
|
||||||
{superadmin ? <AdminPageNav /> : <p><Link to="/settings">Zurück zu Einstellungen</Link></p>}
|
{superadmin ? <AdminPageNav /> : <p><Link to="/settings">Zurück zu Einstellungen</Link></p>}
|
||||||
<h1>API-Schnittstelle</h1>
|
<h1>API-Schnittstelle</h1>
|
||||||
|
<p>
|
||||||
|
<Link to="/admin/release-updates">Offene Änderungen gegenüber dem letzten Release</Link>
|
||||||
|
</p>
|
||||||
<p style={{ color: 'var(--text2)', maxWidth: '68ch' }}>
|
<p style={{ color: 'var(--text2)', maxWidth: '68ch' }}>
|
||||||
Ein Schlüssel gehört zu einer Anwendung. Du weist ihm die Bereiche zu, die diese Anwendung abrufen darf.
|
Ein Schlüssel gehört zu einer Anwendung. Du weist ihm die Bereiche zu, die diese Anwendung abrufen darf.
|
||||||
Fällt dir eine Rolle weg, liefert der Schlüssel diesen Bereich nicht mehr aus.
|
Fällt dir eine Rolle weg, liefert der Schlüssel diesen Bereich nicht mehr aus.
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import React, { useCallback, useEffect, useState } from 'react'
|
||||||
|
import { Link } from 'react-router-dom'
|
||||||
|
import AdminPageNav from '../components/AdminPageNav'
|
||||||
|
import { useAuth } from '../context/AuthContext'
|
||||||
|
import { getDistributionReleaseUpdates } from '../api/distribution'
|
||||||
|
|
||||||
|
const VISIBILITY = {
|
||||||
|
official: 'Global',
|
||||||
|
club: 'Verein',
|
||||||
|
private: 'Eigene',
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function AdminReleaseUpdatesPage() {
|
||||||
|
const { user } = useAuth()
|
||||||
|
const superadmin = user?.role === 'superadmin'
|
||||||
|
const [items, setItems] = useState(null)
|
||||||
|
const [error, setError] = useState('')
|
||||||
|
|
||||||
|
const load = useCallback(async () => {
|
||||||
|
try {
|
||||||
|
const data = await getDistributionReleaseUpdates()
|
||||||
|
setItems(data.items || [])
|
||||||
|
setError('')
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message || 'Die offenen Änderungen konnten nicht geladen werden.')
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
load()
|
||||||
|
}, [load])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ padding: 16, maxWidth: 880 }}>
|
||||||
|
{superadmin ? <AdminPageNav /> : <p><Link to="/admin/distribution">Zurück zur API-Schnittstelle</Link></p>}
|
||||||
|
<h1>Release-Abgleich</h1>
|
||||||
|
<p style={{ color: 'var(--text2)', maxWidth: '68ch' }}>
|
||||||
|
Hier stehen Übungen, deren Arbeitsfassung vom letzten veröffentlichten Release abweicht.
|
||||||
|
Ein neues Release übernimmt den aktuellen Stand. Das bisherige Release bleibt unter seiner ID abrufbar.
|
||||||
|
</p>
|
||||||
|
{error ? <p role="alert">{error}</p> : null}
|
||||||
|
{!items ? <p>Wird geladen …</p> : null}
|
||||||
|
{items && !items.length ? (
|
||||||
|
<p>Keine Arbeitsfassung weicht von ihrem letzten Release ab.</p>
|
||||||
|
) : null}
|
||||||
|
{items?.length ? (
|
||||||
|
<ul style={{ paddingLeft: 18 }}>
|
||||||
|
{items.map((item) => (
|
||||||
|
<li key={item.exercise_id} style={{ marginBottom: 16 }}>
|
||||||
|
<strong>{item.title}</strong>
|
||||||
|
<div style={{ color: 'var(--text2)', fontSize: 13 }}>
|
||||||
|
{item.visibility === 'club' && item.club_name ? item.club_name : VISIBILITY[item.visibility] || item.visibility}
|
||||||
|
{' · Release Revision '}
|
||||||
|
{item.revision}
|
||||||
|
{item.areas?.length ? ` · ${item.areas.join(', ')}` : ''}
|
||||||
|
</div>
|
||||||
|
<Link to={`/exercises/${item.exercise_id}/edit?tab=freigabe`}>Freigabe öffnen</Link>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in new issue
Block a user