fix: batchDeleteGroups should ungroup (rename to Unassigned), not hard delete
Changed from apiCall('delete_trace', ...) to updateTraceProfileGroup(name='Unassigned').
This preserves all trace data and just removes the group assignment.
Traces move back to Pending Faces instead of being deleted.
This commit is contained in:
@@ -1698,39 +1698,33 @@ async function batchDeleteGroups() {
|
||||
allTraceIds.push(...(g.trace_ids || []))
|
||||
}
|
||||
|
||||
if (!confirm(`Delete ${groupsToDelete.length} group(s) with ${totalTraces} trace(s)?`)) return
|
||||
if (!confirm(`Ungroup ${groupsToDelete.length} group(s) with ${totalTraces} trace(s)?\n\nTraces will be renamed to "Unassigned", not deleted.`)) return
|
||||
|
||||
operationLoading.value = true
|
||||
operationMessage.value = `Deleting ${totalTraces} trace(s)...`
|
||||
operationMessage.value = `Ungrouping ${totalTraces} trace(s)...`
|
||||
|
||||
lastDeletedTraces.value = []
|
||||
for (const g of groupsToDelete) {
|
||||
const traceIds = g.trace_ids || []
|
||||
for (const tid of traceIds) {
|
||||
const trace = clusterTracesMap.value[String(tid)]
|
||||
const fileUuid = trace?.file_uuid
|
||||
console.log('[batchDeleteGroups] trace_id:', tid, 'trace:', trace, 'fileUuid:', fileUuid)
|
||||
if (!fileUuid) {
|
||||
console.error('[batchDeleteGroups] Missing file_uuid for trace:', tid)
|
||||
continue
|
||||
}
|
||||
try {
|
||||
await apiCall('delete_trace', { file_uuid: fileUuid, trace_id: tid })
|
||||
lastDeletedTraces.value.push({ file_uuid: fileUuid, trace_id: tid })
|
||||
console.log('[batchDeleteGroups] Deleted trace:', tid)
|
||||
} catch (e) {
|
||||
console.error('Delete trace failed:', tid, e)
|
||||
}
|
||||
if (!traceIds.length) continue
|
||||
const fileUuid = g.rep_trace?.file_uuid || selectedFileUuid.value
|
||||
if (!fileUuid) continue
|
||||
try {
|
||||
await updateTraceProfileGroup(fileUuid, traceIds, { name: 'Unassigned' })
|
||||
} catch (e) {
|
||||
console.error('Ungroup failed:', g.name, e)
|
||||
}
|
||||
}
|
||||
|
||||
removeTracesFromClusterCache(allTraceIds)
|
||||
// Remove ungrouped traces from cluster cache so they show in Pending Faces
|
||||
for (const tid of allTraceIds) {
|
||||
delete clusterTracesMap.value[String(tid)]
|
||||
}
|
||||
|
||||
operationLoading.value = false
|
||||
operationMessage.value = ''
|
||||
|
||||
clearSelection()
|
||||
showUndoBannerWithTimer()
|
||||
await loadClusterResults()
|
||||
}
|
||||
|
||||
async function batchMergeGroups() {
|
||||
|
||||
Reference in New Issue
Block a user