Offer the current exercise through an explicit API switch.
Deploy Development / deploy (push) Successful in 53s
Test Suite / pytest-backend (push) Failing after 29s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 16s
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 29s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 16s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Failing after 7m42s
The exercise list turns the live catalog on or off for the caller's edit rights. A distribution key reads that current selection and the changes since its last cursor. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4ad62b6e38
commit
b59b7eae16
13 files changed
+488
-5
No files matched your search
@@ -81,6 +81,7 @@ function ExercisesListPageRoot() {
|
||||
const [bulkClubSelect, setBulkClubSelect] = useState('')
|
||||
const [bulkClubManual, setBulkClubManual] = useState('')
|
||||
const [bulkSubmitting, setBulkSubmitting] = useState(false)
|
||||
const [apiOfferingBusy, setApiOfferingBusy] = useState(false)
|
||||
const [bulkPatchFocusAreas, setBulkPatchFocusAreas] = useState(false)
|
||||
const [bulkFocusAreaIds, setBulkFocusAreaIds] = useState([])
|
||||
const [bulkPatchStyleDirections, setBulkPatchStyleDirections] = useState(false)
|
||||
@@ -483,6 +484,39 @@ function ExercisesListPageRoot() {
|
||||
}
|
||||
}, [user?.id, filters, checkAuth])
|
||||
|
||||
const handleApiOffering = async (apiOffered) => {
|
||||
const ids = Array.from(selectedIds).filter((item) => Number.isFinite(item) && item > 0)
|
||||
if (!ids.length) {
|
||||
alert('Keine Übungen ausgewählt.')
|
||||
return
|
||||
}
|
||||
if (ids.length > BULK_MAX_IDS) {
|
||||
alert(`Maximal ${BULK_MAX_IDS} Übungen pro Vorgang. Bitte Auswahl oder mehrere Durchläufe verwenden.`)
|
||||
return
|
||||
}
|
||||
setApiOfferingBusy(true)
|
||||
try {
|
||||
const result = await api.patchExerciseApiOffering({ exercise_ids: ids, api_offered: apiOffered })
|
||||
const updatedIds = new Set((result.updated || []).map((item) => Number(item.id)))
|
||||
const apply = (exercise) =>
|
||||
updatedIds.has(Number(exercise.id)) ? { ...exercise, api_offered: apiOffered } : exercise
|
||||
setExercises((prev) => prev.map(apply))
|
||||
setSelectedEntries((prev) => prev.map(apply))
|
||||
const changed = (result.updated || []).map((item) => item.title || `Übung ${item.id}`)
|
||||
const blocked = (result.denied || []).map(
|
||||
(item) => `${item.title || `Übung ${item.id}`}: ${item.detail || 'Keine Berechtigung'}`
|
||||
)
|
||||
const lines = []
|
||||
if (changed.length) lines.push(`Geändert: ${changed.join(', ')}`)
|
||||
if (blocked.length) lines.push(`Nicht geändert: ${blocked.join(' · ')}`)
|
||||
if (lines.length) alert(lines.join('\n'))
|
||||
} catch (error) {
|
||||
alert(error.message || 'Die API-Bereitstellung konnte nicht gespeichert werden.')
|
||||
} finally {
|
||||
setApiOfferingBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
const openBulkModal = () => {
|
||||
setBulkVisibility('')
|
||||
setBulkStatus('')
|
||||
@@ -727,6 +761,8 @@ function ExercisesListPageRoot() {
|
||||
onClearSelection={clearSelection}
|
||||
onOpenBulkModal={openBulkModal}
|
||||
onOpenSaveModuleModal={() => setSaveModuleModalOpen(true)}
|
||||
onSetApiOffering={handleApiOffering}
|
||||
apiOfferingBusy={apiOfferingBusy}
|
||||
/>
|
||||
|
||||
<ExerciseListFilterModal
|
||||
|
||||
Reference in new issue
Block a user