diff --git a/docs/design/batch-duplicate-review.md b/docs/design/batch-duplicate-review.md index 654ae3a..5d2f20d 100644 --- a/docs/design/batch-duplicate-review.md +++ b/docs/design/batch-duplicate-review.md @@ -18,6 +18,10 @@ backup containing every affected audio file plus the Serato metadata snapshot, then installs all compatibility shortcuts as one rollback unit. Any validation or filesystem failure prevents or rolls back the batch. +The dry-run opens in a closable modal that names every selected keeper and every +path that will become a compatibility shortcut. Closing the modal preserves the +queue position and all decisions so the DJ can continue reviewing before apply. + ## Edge cases - The same group cannot be submitted twice. diff --git a/serato_doctor/web.py b/serato_doctor/web.py index 7b26505..e71d7e9 100644 --- a/serato_doctor/web.py +++ b/serato_doctor/web.py @@ -360,6 +360,13 @@ def duplicate_repair_batch( result = { "choice_count": len(plans), "replaced": replaced, + "decisions": [ + { + "keeper": str(plan.keeper), + "replaced": [str(path) for path in plan.replaced], + } + for plan in plans + ], "metadata_backups": len(plans[0].metadata_files), "strategy": "shortcut", "database_v2_modified": False, diff --git a/serato_doctor/webui/app.js b/serato_doctor/webui/app.js index 0126106..06f1c85 100644 --- a/serato_doctor/webui/app.js +++ b/serato_doctor/webui/app.js @@ -22,6 +22,13 @@ const audioPreview = document.querySelector('#audio-preview'); const audioPreviewName = document.querySelector('#audio-preview-name'); const audioPlayer = document.querySelector('#audio-player'); const closeAudioPreview = document.querySelector('#close-audio-preview'); +const batchPreviewModal = document.querySelector('#batch-preview-modal'); +const batchPreviewSummary = document.querySelector('#batch-preview-summary'); +const batchPreviewList = document.querySelector('#batch-preview-list'); +const batchPreviewSafety = document.querySelector('#batch-preview-safety'); +const closeBatchPreview = document.querySelector('#close-batch-preview'); +const continueReviewing = document.querySelector('#continue-reviewing'); +const acceptPreview = document.querySelector('#accept-preview'); let latestAnalysis = null; let selectedDuplicateGroup = null; let previewedRepair = null; @@ -191,12 +198,23 @@ previewRepairButton.addEventListener('click', async () => { repairMessage.textContent = 'Checking the plan…'; applyRepairButton.disabled = true; try { previewedRepair = await requestRepair('/api/duplicates/batch/preview'); - repairPreview.innerHTML = `One safe plan for ${previewedRepair.choice_count} approved group(s)
${previewedRepair.replaced.length} duplicate file(s) will be backed up, then replaced with shortcuts to their selected keepers. ${previewedRepair.metadata_backups} Serato metadata file(s) will also be copied into the rollback snapshot. Database V2 will not be changed.
`; + batchPreviewSummary.textContent = `${previewedRepair.choice_count} keeper decision(s) · ${previewedRepair.replaced.length} duplicate file(s) consolidated`; + batchPreviewList.innerHTML = previewedRepair.decisions.map((decision, index) => ` +${previewedRepair.choice_count} keeper decision(s) are ready for one backed-up apply.
`; repairPreview.hidden = false; applyRepairButton.disabled = false; repairMessage.textContent = 'Preview complete. Nothing has changed yet.'; + batchPreviewModal.showModal(); } catch (error) { repairMessage.textContent = error.message; } }); +function dismissBatchPreview() { batchPreviewModal.close(); } +closeBatchPreview.addEventListener('click', dismissBatchPreview); +continueReviewing.addEventListener('click', dismissBatchPreview); +acceptPreview.addEventListener('click', dismissBatchPreview); + applyRepairButton.addEventListener('click', async () => { if (!previewedRepair) return; applyRepairButton.disabled = true; repairMessage.textContent = 'Creating the backup before making changes…'; diff --git a/serato_doctor/webui/index.html b/serato_doctor/webui/index.html index bc55502..aeb6058 100644 --- a/serato_doctor/webui/index.html +++ b/serato_doctor/webui/index.html @@ -121,8 +121,15 @@ + - +