feat(versioning) : add entity versioning frontend with restore flow

- useEntityVersions composable (list, preview, restore API calls)
- EntityVersionList component with auto-refresh after save
- VersionRestoreModal with context-aware messages per entity type
- Integrate into machine, composant, piece, product detail pages
- Add restore action label to historyDisplayUtils
- Show structure slots in composant/piece consultation mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-26 14:58:39 +01:00
parent d197d30eb0
commit 767c9a7424
9 changed files with 573 additions and 43 deletions

View File

@@ -71,10 +71,10 @@
@update:machine-reference="d.machineReference.value = $event"
@update:machine-site-id="d.machineSiteId.value = $event"
@update:constructeur-ids="d.handleMachineConstructeurChange"
@blur-field="d.updateMachineInfo"
@blur-field="() => { d.updateMachineInfo(); refreshVersions() }"
@set-custom-field-value="d.setMachineCustomFieldValue"
@update-custom-field="d.updateMachineCustomField"
@custom-fields-saved="d.loadMachineData()"
@custom-fields-saved="() => { d.loadMachineData(); refreshVersions() }"
/>
<!-- Documents -->
@@ -146,6 +146,17 @@
:field-labels="historyFieldLabels"
/>
<!-- Versions -->
<EntityVersionList
ref="versionListRef"
entity-type="machine"
:entity-id="String(machineId)"
:field-labels="historyFieldLabels"
:refresh-key="versionRefreshKey"
@restored="d.loadMachineData()"
/>
<!-- Comments -->
<div class="mt-4">
<CommentSection
@@ -201,6 +212,7 @@ import MachineComponentsCard from '~/components/machine/MachineComponentsCard.vu
import MachinePiecesCard from '~/components/machine/MachinePiecesCard.vue'
import AddEntityToMachineModal from '~/components/machine/AddEntityToMachineModal.vue'
import EntityHistorySection from '~/components/common/EntityHistorySection.vue'
import EntityVersionList from '~/components/common/EntityVersionList.vue'
import IconLucideAlertTriangle from '~icons/lucide/alert-triangle'
const route = useRoute()
@@ -212,6 +224,8 @@ if (!machineId) {
}
const d = useMachineDetailData(machineId)
const versionRefreshKey = ref(0)
const refreshVersions = () => { versionRefreshKey.value++ }
const {
history,