// Excavation archive — scan history, navigates to Dashboard for viewing const ARCHIVE_API = 'https://r5vefiej3l.execute-api.eu-central-1.amazonaws.com/prod'; const ARCH_COG = '7nffjheavp985k7b4bgug45jf4'; function archToken() { const last = localStorage.getItem(`CognitoIdentityServiceProvider.${ARCH_COG}.LastAuthUser`); if (last) { const t = localStorage.getItem(`CognitoIdentityServiceProvider.${ARCH_COG}.${last}.idToken`); if (t) return t; } return window.getIdToken ? window.getIdToken() : ''; } async function archApi(method, path) { const res = await fetch(`${ARCHIVE_API}${path}`, { method, headers: { Authorization: `Bearer ${archToken()}` } }); const d = await res.json().catch(() => ({})); if (!res.ok) throw new Error(d.error || `HTTP ${res.status}`); return d; } function getHistory() { try { return JSON.parse(localStorage.getItem('fossyl_job_history') || '[]'); } catch { return []; } } function fmtDate(iso) { if (!iso) return '—'; try { return new Date(iso).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }); } catch { return iso.slice(0, 10); } } function fmtNum(n) { return n && n > 0 ? n.toLocaleString() : '—'; } function ReportPage() { const { go } = useNav(); const { toast } = useToast(); const [history, setHistory] = useState(getHistory); const [downloading, setDownloading] = useState(false); const [deleting, setDeleting] = useState(null); // job_id being confirmed const openReport = (jobId) => { localStorage.setItem('fossyl_active_job', jobId); go('report'); }; const handleDownload = async (jobId) => { setDownloading(true); try { const d = await archApi('GET', `/download/${jobId}`); window.location.href = d.download_url; } catch (e) { toast(e.message || 'Download failed', { tone: 'error' }); } finally { setDownloading(false); } }; const handleShare = async (jobId) => { try { const d = await archApi('GET', `/download/${jobId}?view=1`); navigator.clipboard?.writeText(d.download_url).catch(() => {}); toast('Link copied — valid 1 hour', { tone: 'success' }); } catch (e) { toast(e.message || 'Failed', { tone: 'error' }); } }; const handleDelete = (jobId) => { // Remove from localStorage history const updated = history.filter(j => j.job_id !== jobId); localStorage.setItem('fossyl_job_history', JSON.stringify(updated)); // If this was the active job, clear it if (localStorage.getItem('fossyl_active_job') === jobId) { localStorage.removeItem('fossyl_active_job'); } setHistory(updated); setDeleting(null); toast('Excavation removed from history', { tone: 'success' }); }; return (
This removes {deleting.slice(0, 8)} from your history. The report file will expire per your plan retention. This cannot be undone.
Upload a codebase ZIP + ZODB export to generate your first archaeological map.
| Scan ID | Date | Status | Size | TTW scripts | Dependencies | |
|---|---|---|---|---|---|---|
| {j.job_id.slice(0, 8)} | {fmtDate(j.created_at)} | {j.status} | {j.report_size_kb ? `${j.report_size_kb} KB` : '—'} | {fmtNum(j.ttw_count)} | {fmtNum(j.edge_count)} |
{j.status === 'done' && (
e.stopPropagation()}>
)}
{j.status !== 'done' && (
e.stopPropagation()}>
)}
|