reorder
This commit is contained in:
@@ -75,6 +75,11 @@
|
||||
|
||||
<div id="loading" style="display:none">Running consistency check...</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Archived Items <span class="info">(Manually archived, recoverable)</span></h2>
|
||||
<div id="archivedList">No archived items found.</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Orphaned Records <span class="info">(In DB, but file missing on disk)</span></h2>
|
||||
<div id="missingList">No orphaned records found.</div>
|
||||
@@ -108,11 +113,17 @@
|
||||
body: JSON.stringify({ filename, action })
|
||||
});
|
||||
const d = await r.json();
|
||||
showToast(d.status === 'deleted' ? 'Record deleted' : 'File imported');
|
||||
let msg = 'Done';
|
||||
if (d.status === 'deleted') msg = 'Record deleted';
|
||||
else if (d.status === 'imported') msg = 'File imported';
|
||||
else if (d.status === 'restored') msg = 'Item restored';
|
||||
else if (d.status === 'deleted_permanently') msg = 'Permanently deleted';
|
||||
|
||||
showToast(msg);
|
||||
loadInconsistencies();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
showToast('Repair failed');
|
||||
showToast('Action failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +134,7 @@
|
||||
const r = await fetch(url);
|
||||
const d = await r.json();
|
||||
|
||||
renderArchived(d.archived_items || []);
|
||||
renderMissing(d.missing_files || []);
|
||||
renderUntracked(d.untracked_files || []);
|
||||
|
||||
@@ -138,6 +150,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
function renderArchived(files) {
|
||||
const container = document.getElementById('archivedList');
|
||||
if (files.length === 0) {
|
||||
container.innerHTML = 'No archived items found.';
|
||||
return;
|
||||
}
|
||||
container.innerHTML = files.map(f => `
|
||||
<div class="item">
|
||||
<div>
|
||||
<div class="filename">${f.filename}</div>
|
||||
<div class="info">Group: ${f.group_id || 'none'} | Name: ${f.name || 'none'}</div>
|
||||
</div>
|
||||
<div style="display:flex;gap:8px">
|
||||
<button class="btn success" onclick="repair('${f.filename}', 'restore')">Restore</button>
|
||||
<button class="btn danger" onclick="if(confirm('Permanently delete ${f.filename}?')) repair('${f.filename}', 'delete_permanently')">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
function renderMissing(files) {
|
||||
const container = document.getElementById('missingList');
|
||||
if (files.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user