diff --git a/backend/static/event-modal.js b/backend/static/event-modal.js index 51d56fd..28a97d8 100644 --- a/backend/static/event-modal.js +++ b/backend/static/event-modal.js @@ -197,11 +197,46 @@ `; } - function _renderFileInfo(s) { + function _renderFileInfo(s, eventId) { const bw = s.blastware || {}; const src = s.source || {}; - return `
-
Blastware file ${_esc(bw.filename || '—')} ${bw.filesize ? `(${(bw.filesize / 1024).toFixed(1)} KB)` : ''}
+ const sizeKb = bw.filesize ? (bw.filesize / 1024).toFixed(1) : null; + const canDownloadBinary = !!(bw.available && bw.filename && eventId); + + const downloadButtons = ` +
+ ${canDownloadBinary ? ` + + + + + Download Blastware file + (${_esc(bw.filename)}${sizeKb ? `, ${sizeKb} KB` : ''}) + + ` : ` + + + + + Blastware file unavailable + + `} + + + + + Download sidecar JSON + +
+ `; + + return `${downloadButtons} +
+
Blastware file ${_esc(bw.filename || '—')} ${sizeKb ? `(${sizeKb} KB)` : ''}
SHA-256 ${_esc(bw.sha256 || '—')}
Captured at ${_esc(src.captured_at ? src.captured_at.slice(0, 19).replace('T', ' ') : '—')}
Tool version ${_esc(src.tool_version || '—')}
@@ -279,7 +314,7 @@ ` : ''} ${_sectionHeader('Source File')} - ${_renderFileInfo(s)} + ${_renderFileInfo(s, eventId)} `; };