Let each tenant create named API keys with content and visibility scope.
Deploy Development / deploy (push) Failing after 32s
Test Suite / pytest-backend (push) Failing after 26s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Failing after 6s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Canceled after 1m34s
Deploy Development / deploy (push) Failing after 32s
Test Suite / pytest-backend (push) Failing after 26s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Failing after 6s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Canceled after 1m34s
Superadmins enable a club for the interface. Club admins and members create the keys. Exercise release lives on its own tab and picks one of those keys. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fe3633ba8b
commit
1527a430b9
14 files changed
+842
-290
No files matched your search
@@ -18,7 +18,7 @@ export default function AdminPageNav() {
|
||||
{ to: '/admin/ai-prompts', label: 'KI Prompts', icon: Sparkles },
|
||||
{ to: '/admin/openrouter', label: 'KI-Modell', icon: Bot },
|
||||
{ to: '/admin/exercise-enrichment', label: 'Übungs-Anreicherung', icon: Wand2 },
|
||||
{ to: '/admin/distribution', label: 'Distribution', icon: Share2 },
|
||||
{ to: '/admin/distribution', label: 'API-Schnittstelle', icon: Share2 },
|
||||
]
|
||||
|
||||
return (
|
||||
|
||||
@@ -8,18 +8,7 @@ import {
|
||||
withdrawDistributionRelease,
|
||||
} from '../../api/distribution'
|
||||
|
||||
const ACTIONS = [
|
||||
'store',
|
||||
'render',
|
||||
'stream',
|
||||
'download',
|
||||
'print',
|
||||
'course_display',
|
||||
'commercial_course_use',
|
||||
'adapt',
|
||||
'public_preview',
|
||||
'grant_customer_use',
|
||||
]
|
||||
const RELEASE_ACTIONS = ['store', 'render', 'stream', 'course_display', 'commercial_course_use']
|
||||
|
||||
const REASONS = [
|
||||
['rights', 'Rechte'],
|
||||
@@ -32,11 +21,9 @@ const REASONS = [
|
||||
export default function ExerciseDistributionPanel({ exerciseId }) {
|
||||
const [overview, setOverview] = useState(null)
|
||||
const [error, setError] = useState('')
|
||||
const [publisherId, setPublisherId] = useState('')
|
||||
const [recipientId, setRecipientId] = useState('')
|
||||
const [keyId, setKeyId] = useState('')
|
||||
const [draft, setDraft] = useState(null)
|
||||
const [evidence, setEvidence] = useState('nachweis')
|
||||
const [actions, setActions] = useState(['store', 'render'])
|
||||
const [retirePrevious, setRetirePrevious] = useState(true)
|
||||
const [reason, setReason] = useState('rights')
|
||||
const [busy, setBusy] = useState(false)
|
||||
@@ -55,12 +42,6 @@ export default function ExerciseDistributionPanel({ exerciseId }) {
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
function toggleAction(action) {
|
||||
setActions((current) =>
|
||||
current.includes(action) ? current.filter((item) => item !== action) : [...current, action]
|
||||
)
|
||||
}
|
||||
|
||||
function withRights(cut) {
|
||||
const rightsId = 'rights-main'
|
||||
const next = {
|
||||
@@ -70,7 +51,7 @@ export default function ExerciseDistributionPanel({ exerciseId }) {
|
||||
{
|
||||
id: rightsId,
|
||||
evidence_ref: evidence.trim(),
|
||||
actions,
|
||||
actions: RELEASE_ACTIONS,
|
||||
territories: ['DE'],
|
||||
valid_from: new Date(Date.now() - 60000).toISOString().replace(/\.\d{3}Z$/, 'Z'),
|
||||
valid_until: null,
|
||||
@@ -87,10 +68,7 @@ export default function ExerciseDistributionPanel({ exerciseId }) {
|
||||
setBusy(true)
|
||||
setError('')
|
||||
try {
|
||||
const created = await createDistributionDraft(exerciseId, {
|
||||
publisher_id: publisherId.trim(),
|
||||
recipient_id: recipientId.trim(),
|
||||
})
|
||||
const created = await createDistributionDraft(exerciseId, { key_id: keyId })
|
||||
const cut = withRights(created.cut)
|
||||
const updated = await updateDistributionDraft(exerciseId, created.draft_id, cut)
|
||||
setDraft(updated)
|
||||
@@ -110,9 +88,10 @@ export default function ExerciseDistributionPanel({ exerciseId }) {
|
||||
await updateDistributionDraft(exerciseId, draft.draft_id, cut)
|
||||
const result = await confirmDistributionDraft(exerciseId, draft.draft_id)
|
||||
if (retirePrevious && overview?.releases?.length && !result.replayed) {
|
||||
const recipientId = (overview.keys || []).find((item) => item.id === keyId)?.recipient_id
|
||||
const previous = [...overview.releases]
|
||||
.reverse()
|
||||
.find((item) => item.recipient_id === recipientId.trim() && !item.fetch_blocked)
|
||||
.find((item) => item.recipient_id === recipientId && !item.fetch_blocked)
|
||||
if (previous) {
|
||||
await retireDistributionRelease(previous.release_id)
|
||||
}
|
||||
@@ -140,53 +119,32 @@ export default function ExerciseDistributionPanel({ exerciseId }) {
|
||||
}
|
||||
|
||||
if (!overview) {
|
||||
return <section className="card">Distribution wird geladen …</section>
|
||||
return <p>Freigabe wird geladen …</p>
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card" style={{ marginBottom: 16 }}>
|
||||
<h2 style={{ marginTop: 0 }}>Externe Freigabe</h2>
|
||||
<div>
|
||||
{!overview.enabled ? (
|
||||
<p>Die Distribution ist auf dieser Instanz nicht aktiv. Bearbeitung und Planung bleiben davon unberührt.</p>
|
||||
) : (
|
||||
<>
|
||||
<p>
|
||||
Private Übungen gibt die Person frei, der sie gehören. Vereinsübungen gibt ein Vereinsadmin dieses Vereins frei.
|
||||
Globale Übungen gibt nur ein Superadmin frei.
|
||||
</p>
|
||||
{overview.release_block ? <p>{overview.release_block}</p> : null}
|
||||
<div className="form-row">
|
||||
<label className="form-label">
|
||||
Herausgeber
|
||||
<input className="form-input" value={publisherId} onChange={(event) => setPublisherId(event.target.value)} placeholder="UUID" />
|
||||
</label>
|
||||
<label className="form-label">
|
||||
Empfänger
|
||||
<input className="form-input" value={recipientId} onChange={(event) => setRecipientId(event.target.value)} placeholder="UUID" />
|
||||
</label>
|
||||
</div>
|
||||
{overview.publishers?.length ? (
|
||||
<ul>
|
||||
{overview.publishers.map((publisher) => (
|
||||
<li key={publisher.id}>
|
||||
<button type="button" className="btn btn-secondary" onClick={() => setPublisherId(publisher.id)}>
|
||||
{publisher.name} ({publisher.kind})
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
<fieldset>
|
||||
<legend>Nutzungsumfang</legend>
|
||||
{ACTIONS.map((action) => (
|
||||
<label key={action} style={{ display: 'inline-flex', gap: 6, marginRight: 12 }}>
|
||||
<input type="checkbox" checked={actions.includes(action)} onChange={() => toggleAction(action)} />
|
||||
{action}
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
<label className="form-label">
|
||||
Nachweisreferenz
|
||||
API-Schlüssel
|
||||
<select className="form-input" value={keyId} onChange={(event) => setKeyId(event.target.value)}>
|
||||
<option value="">Bitte wählen</option>
|
||||
{(overview.keys || []).map((item) => (
|
||||
<option key={item.id} value={item.id}>
|
||||
{item.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<p style={{ color: 'var(--text2)', fontSize: '13px' }}>
|
||||
Der Empfänger darf die Fassung übernehmen und im Kurs zeigen, auch kommerziell. Herunterladen und Bearbeiten sind nicht enthalten.
|
||||
</p>
|
||||
<label className="form-label">
|
||||
Nachweis
|
||||
<input className="form-input" value={evidence} onChange={(event) => setEvidence(event.target.value)} />
|
||||
</label>
|
||||
<label style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||
@@ -257,6 +215,6 @@ export default function ExerciseDistributionPanel({ exerciseId }) {
|
||||
</>
|
||||
) : null}
|
||||
{error ? <p role="alert">{error}</p> : null}
|
||||
</section>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
} from '../../utils/activeClub'
|
||||
import { COMBINATION_ARCHETYPE_OPTIONS, ARCHETYPE_DEFAULT_REP_SERIES_COUNT, defaultRepSeriesCountForArchetype } from '../../constants/combinationArchetypes'
|
||||
import { readSlotProfilesV1, normalizeAdvanceMode, parseComboRepSeriesCountUi } from '../../utils/combinationMethodProfileUi'
|
||||
import { GripVertical, FileText, BookOpen, Tags, Layers, GitBranch, Image as ImageIcon } from 'lucide-react'
|
||||
import { GripVertical, FileText, BookOpen, Tags, Layers, GitBranch, Image as ImageIcon, Share2 } from 'lucide-react'
|
||||
import UnsavedChangesPrompt from '../UnsavedChangesPrompt'
|
||||
import PageFormEditorChrome from '../PageFormEditorChrome'
|
||||
import { ExerciseFormTabBar, ExerciseFormPanel } from './ExerciseFormLayout'
|
||||
@@ -668,9 +668,11 @@ function ExerciseFormPageRoot() {
|
||||
})
|
||||
}
|
||||
tabs.push({ id: 'medien', label: 'Medien & Mehr', icon: ImageIcon })
|
||||
tabs.push({ id: 'freigabe', label: 'Freigabe', icon: Share2 })
|
||||
} else {
|
||||
tabs.push({ id: 'varianten', label: 'Varianten', icon: GitBranch, disabled: true })
|
||||
tabs.push({ id: 'medien', label: 'Medien & Mehr', icon: ImageIcon, disabled: true })
|
||||
tabs.push({ id: 'freigabe', label: 'Freigabe', icon: Share2, disabled: true })
|
||||
}
|
||||
return tabs
|
||||
}, [formData.exercise_kind, isEdit, variants.length])
|
||||
@@ -1612,8 +1614,6 @@ function ExerciseFormPageRoot() {
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
{isEdit && exerciseId ? <ExerciseDistributionPanel exerciseId={exerciseId} /> : null}
|
||||
|
||||
<div className="card exercise-form-edit">
|
||||
<form id="exercise-form" onSubmit={handleSubmit}>
|
||||
<ExerciseFormTabBar
|
||||
@@ -2905,6 +2905,14 @@ function ExerciseFormPageRoot() {
|
||||
/>
|
||||
)}
|
||||
</ExerciseFormPanel>
|
||||
<ExerciseFormPanel
|
||||
tab="freigabe"
|
||||
activeTab={activeFormTab}
|
||||
title="Freigabe"
|
||||
hint="Eingefrorene Fassung für einen Empfänger. Die Übung selbst bleibt davon unberührt."
|
||||
>
|
||||
<ExerciseDistributionPanel exerciseId={exerciseId} />
|
||||
</ExerciseFormPanel>
|
||||
) : null}
|
||||
|
||||
</form>
|
||||
|
||||
Reference in new issue
Block a user