#889 Phase 5: wire the Re-identify button into the Enhanced library view

Adds a per-track ⇄ action (admin-only, alongside source-info/redownload/delete)
that opens the Re-identify modal seeded with the track's title/artist/album/art.
The loop is now live: click ⇄ → pick a release → file stages + hint writes →
auto-import re-files it under the chosen single/EP/album (and replaces the old
entry on success when 'replace' is ticked).

Double-gated: the button only renders for admins, and /api/reidentify/apply
re-checks is_admin server-side.
This commit is contained in:
BoulderBadgeDad 2026-06-18 15:39:41 -07:00
parent f4c16ecc22
commit c4c112d17e
2 changed files with 14 additions and 0 deletions

View file

@ -4190,6 +4190,7 @@ function _buildTrackRow(track, album, admin) {
actionsTd.innerHTML = `
<div class="enhanced-track-actions-group">
<button class="enhanced-source-info-btn" title="View download source info"></button>
<button class="enhanced-reidentify-btn" title="Re-identify — file this track under a different release">&#8644;</button>
<button class="enhanced-redownload-btn" title="Redownload this track">&#8635;</button>
<button class="enhanced-delete-btn" title="Delete track from library">&#10005;</button>
</div>
@ -4387,6 +4388,15 @@ function _attachTableDelegation(table, album) {
return;
}
// Re-identify button (admin) — #889
if (target.closest('.enhanced-reidentify-btn')) {
e.stopPropagation();
const artistName = artistDetailPageState.enhancedData ? artistDetailPageState.enhancedData.artist.name : '';
openReidentifyModal(track.id, track.title || 'Unknown', artistName,
album.title || '', album.thumb_url || '');
return;
}
// Redownload button (admin)
if (target.closest('.enhanced-redownload-btn')) {
e.stopPropagation();

View file

@ -59621,6 +59621,7 @@ tr:hover .enhanced-track-actions-group { opacity: 1; }
.enhanced-track-actions-group.visible { opacity: 1; }
.enhanced-source-info-btn,
.enhanced-reidentify-btn,
.enhanced-redownload-btn {
background: none; border: none; cursor: pointer;
width: 24px; height: 24px; border-radius: 5px;
@ -59631,6 +59632,9 @@ tr:hover .enhanced-track-actions-group { opacity: 1; }
.enhanced-source-info-btn { color: rgba(255,255,255,0.35); font-size: 13px; }
.enhanced-source-info-btn:hover { color: rgba(100,181,246,0.9); background: rgba(100,181,246,0.1); }
.enhanced-reidentify-btn { color: rgba(255,255,255,0.35); font-size: 15px; }
.enhanced-reidentify-btn:hover { color: rgb(var(--accent-light-rgb)); background: rgba(var(--accent-rgb),0.1); }
.enhanced-redownload-btn { color: rgba(255,255,255,0.35); font-size: 15px; }
.enhanced-redownload-btn:hover { color: var(--accent); background: rgba(var(--accent-rgb),0.1); }