- |
+ |
Loading mappings...
|
@@ -1395,7 +1396,7 @@
const tbody = document.getElementById('mappings-table-body');
if (data.mappings.length === 0) {
- tbody.innerHTML = '| No manual mappings found. |
';
+ tbody.innerHTML = '| No manual mappings found. |
';
return;
}
@@ -1419,6 +1420,9 @@
${typeBadge} |
${targetDisplay} |
${createdDate} |
+
+
+ |
`;
}).join('');
@@ -1428,6 +1432,29 @@
}
}
+ async function deleteTrackMapping(playlist, spotifyId) {
+ if (!confirm(`Remove manual mapping for ${spotifyId} in playlist "${playlist}"?\n\nThis will:\n• Delete the manual mapping from the cache\n• Allow the track to be matched automatically again\n• For local (Jellyfin) tracks: Stop injecting locally if now available via Spotify Import plugin\n• For external tracks: Allow re-matching with potentially better results\n\nThis action cannot be undone.`)) {
+ return;
+ }
+
+ try {
+ const res = await fetch(`/api/admin/mappings/tracks?playlist=${encodeURIComponent(playlist)}&spotifyId=${encodeURIComponent(spotifyId)}`, {
+ method: 'DELETE'
+ });
+
+ if (res.ok) {
+ showToast('Mapping removed successfully', 'success');
+ await fetchTrackMappings();
+ } else {
+ const error = await res.json();
+ showToast(error.error || 'Failed to remove mapping', 'error');
+ }
+ } catch (error) {
+ console.error('Failed to delete mapping:', error);
+ showToast('Failed to remove mapping', 'error');
+ }
+ }
+
async function fetchConfig() {
try {
const res = await fetch('/api/admin/config');