Enrichment manager: rebuilt header + global process-first + cleaner rows

- Rebuilt the modal header: gradient top bar with a glowing 🧬 icon chip,
  gradient title + subtitle, and styled refresh/close — replaces the flat bar.
- Global 'process first everywhere' control in the header: Artists/Albums/
  Tracks/Auto applies to every worker at once (workers that don't enrich a
  group are skipped via the 400 the endpoint already returns). Sets order only.
- Match rows: replaced the loud accent-gradient artwork placeholder with a
  subtle neutral chip showing the entity glyph; real images layer over it and
  remove themselves on error, so missing/broken art never leaves ragged gaps.
- Removed overflow:hidden from .em-row.

Frontend only; JS syntax clean.
This commit is contained in:
BoulderBadgeDad 2026-06-02 20:41:05 -07:00
parent f827ddc282
commit 3a560bd1bb
2 changed files with 96 additions and 17 deletions

View file

@ -140,12 +140,26 @@ async function openEnrichmentManager(workerId) {
overlay.innerHTML = `
<div class="enrichment-manager-modal" role="dialog" aria-modal="true"
aria-label="Manage Enrichment Workers" tabindex="-1">
<div class="enhanced-bulk-modal-header">
<h3>🧬 Manage Enrichment Workers</h3>
<div class="em-header-actions">
<div class="em-topbar">
<div class="em-topbar-icon"><span>🧬</span></div>
<div class="em-topbar-titles">
<h3 class="em-topbar-title">Enrichment Workers</h3>
<div class="em-topbar-sub">Match your library across every metadata source</div>
</div>
<div class="em-global">
<span class="em-global-label">Process first<br><span>everywhere</span></span>
<div class="em-global-tabs" id="em-global-tabs">
<button data-e="artist" onclick="setGlobalPriority('artist', this)">Artists</button>
<button data-e="album" onclick="setGlobalPriority('album', this)">Albums</button>
<button data-e="track" onclick="setGlobalPriority('track', this)">Tracks</button>
<button data-e="" class="em-global-auto" onclick="setGlobalPriority('', this)">Auto</button>
</div>
</div>
<div class="em-topbar-actions">
<button class="em-icon-btn" id="em-refresh-btn" title="Refresh"
onclick="refreshEnrichmentManager(this)"></button>
<button class="enhanced-bulk-modal-close" onclick="closeEnrichmentManager()">&times;</button>
<button class="em-icon-btn em-icon-btn--close" title="Close"
onclick="closeEnrichmentManager()">&times;</button>
</div>
</div>
<div class="em-body">
@ -259,6 +273,29 @@ function _emStatusInfo(status) {
return { cls: 'stopped', label: 'Stopped' };
}
// Global "process first" — applies a group to EVERY worker. Workers that don't
// enrich that entity (Genius/album, Discogs/track) reject with 400 and are
// skipped. Sets processing order only (no mass failed re-queue across sources).
async function setGlobalPriority(entity, btn) {
if (btn) {
document.querySelectorAll('#em-global-tabs button').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
}
const results = await Promise.all(ENRICHMENT_WORKERS.map(w =>
fetch(`/api/enrichment/${w.id}/priority`, {
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ entity: entity || 'none' }),
}).then(r => r.ok).catch(() => false)
));
const n = results.filter(Boolean).length;
showToast(entity
? `${n} worker${n === 1 ? '' : 's'} will process ${_emEntityLabel(entity, true).toLowerCase()} first`
: `${n} worker${n === 1 ? '' : 's'} back to automatic order`, 'success');
// Reflect on the currently-open worker.
const sel = enrichmentManagerState.selected;
if (sel) { await _emLoadPriority(sel); _emRenderEntityCards(); }
}
// ── Left rail ───────────────────────────────────────────────────────────────
// Overall library coverage (% of items this source has attempted) from the
@ -737,9 +774,14 @@ function _emRenderUnmatchedList() {
const id = enrichmentManagerState.selected;
const entity = enrichmentManagerState.entityTab;
host.innerHTML = data.items.map(item => {
const img = item.image_url
? `<img class="em-row-img" src="${_emEscape(item.image_url)}" alt="" loading="lazy" onerror="this.style.display='none'">`
: '<div class="em-row-img em-row-img--ph">♪</div>';
// Unmatched items rarely have artwork yet, so the box always shows a
// subtle entity glyph; a real image (if any) layers over it and, on
// error, removes itself to reveal the glyph — no ragged gaps.
const phGlyph = { artist: '🎤', album: '💿', track: '🎵' }[entity] || '♪';
const pic = item.image_url
? `<img class="em-row-img-pic" src="${_emEscape(item.image_url)}" alt="" loading="lazy" onerror="this.remove()">`
: '';
const img = `<div class="em-row-img em-row-img--ph">${phGlyph}${pic}</div>`;
const rel = _emRelativeTime(item.last_attempted);
const last = rel
? `<span class="em-muted">tried ${rel}</span>`
@ -1090,6 +1132,7 @@ window.onEnrichmentSearchInput = onEnrichmentSearchInput;
window.changeEnrichmentPage = changeEnrichmentPage;
window.toggleEnrichmentWorker = toggleEnrichmentWorker;
window.setEnrichmentPriority = setEnrichmentPriority;
window.setGlobalPriority = setGlobalPriority;
window.retryEnrichmentItem = retryEnrichmentItem;
window.retryAllFailedEnrichment = retryAllFailedEnrichment;
window.toggleEnrichmentRowSelect = toggleEnrichmentRowSelect;

View file

@ -64819,11 +64819,45 @@ body.reduce-effects .dash-card::after {
background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.6), transparent);
z-index: 2;
}
.enrichment-manager-modal .enhanced-bulk-modal-header {
flex: 0 0 auto;
background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.14), transparent 70%);
/* Top bar (rebuilt header) */
.em-topbar {
flex: 0 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
padding: 15px 18px; position: relative;
background: linear-gradient(120deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-rgb), 0.05) 45%, transparent 78%);
border-bottom: 1px solid rgba(255,255,255,0.08);
}
.enrichment-manager-modal .enhanced-bulk-modal-header h3 { letter-spacing: 0.3px; }
.em-topbar-icon {
flex: 0 0 auto; width: 46px; height: 46px; border-radius: 13px;
display: flex; align-items: center; justify-content: center; font-size: 22px;
background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.95), rgba(var(--accent-rgb), 0.5));
box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.45), inset 0 1px 0 rgba(255,255,255,0.25);
}
.em-topbar-icon span { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }
.em-topbar-titles { flex: 1 1 auto; min-width: 0; }
.em-topbar-title {
margin: 0; font-size: 19px; font-weight: 800; letter-spacing: 0.2px;
background: linear-gradient(90deg, #fff, rgba(255,255,255,0.72));
-webkit-background-clip: text; background-clip: text; color: transparent;
}
.em-topbar-sub { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 1px; }
/* Global 'process first everywhere' control */
.em-global { display: flex; align-items: center; gap: 11px; flex: 0 0 auto;
padding: 6px 6px 6px 12px; border-radius: 13px;
background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.08); }
.em-global-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px;
color: rgba(255,255,255,0.4); line-height: 1.25; text-align: right; }
.em-global-label span { color: rgba(255,255,255,0.7); }
.em-global-tabs { display: inline-flex; gap: 3px; padding: 3px; background: rgba(255,255,255,0.05);
border-radius: 9px; border: 1px solid rgba(255,255,255,0.07); }
.em-global-tabs button { padding: 6px 12px; border: none; background: transparent; border-radius: 7px;
color: rgba(255,255,255,0.6); font-size: 12px; font-weight: 700; cursor: pointer; transition: all 0.15s ease; }
.em-global-tabs button:hover { color: #fff; background: rgba(255,255,255,0.06); }
.em-global-tabs button.active { background: rgb(var(--accent-rgb)); color: #fff; box-shadow: 0 2px 10px rgba(var(--accent-rgb), 0.5); }
.em-topbar-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.em-icon-btn--close { font-size: 20px; }
.em-body { display: flex; flex: 1 1 auto; min-height: 0; }
/* Left rail */
@ -64981,7 +65015,7 @@ body.reduce-effects .dash-card::after {
display: flex; align-items: center; gap: 13px; padding: 10px 14px 10px 16px;
background: linear-gradient(100deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
border: 1px solid rgba(255,255,255,0.07); border-radius: 12px;
position: relative; overflow: hidden;
position: relative;
transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
/* status stripe down the left edge */
@ -64996,11 +65030,13 @@ body.reduce-effects .dash-card::after {
background: linear-gradient(100deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
border-color: rgba(var(--em-accent-rgb, 255,255,255), 0.22);
}
.em-row-img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: 0 0 auto;
box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.em-row-img--ph { display: flex; align-items: center; justify-content: center;
background: linear-gradient(135deg, rgba(var(--em-accent-rgb, 99,102,241), 0.3), rgba(255,255,255,0.06));
color: rgba(255,255,255,0.55); font-size: 20px; }
.em-row-img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.em-row-img--ph {
position: relative; display: flex; align-items: center; justify-content: center;
background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.06);
color: rgba(255,255,255,0.28); font-size: 18px;
}
.em-row-img-pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.em-row-info { flex: 1 1 auto; min-width: 0; }
.em-row-name { font-size: 14.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-row-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 11px; }