feat(web): wire EXPORT button to fleet STIX endpoint

This commit is contained in:
2026-05-09 07:40:07 -04:00
parent c210a56fc8
commit e548be3c49

View File

@@ -119,10 +119,10 @@ const Attackers: React.FC = () => {
const handleExport = async () => { const handleExport = async () => {
try { try {
const res = await api.get('/attackers/export', { responseType: 'blob' }); const res = await api.get('/attackers/export/stix', { responseType: 'blob' });
const disposition: string = res.headers['content-disposition'] || ''; const disposition: string = res.headers['content-disposition'] || '';
const match = disposition.match(/filename="([^"]+)"/); const match = disposition.match(/filename="([^"]+)"/);
const filename = match ? match[1] : 'decnet-export.json'; const filename = match ? match[1] : 'decnet-fleet.stix.json';
const url = URL.createObjectURL(new Blob([res.data], { type: 'application/json' })); const url = URL.createObjectURL(new Blob([res.data], { type: 'application/json' }));
const a = document.createElement('a'); const a = document.createElement('a');
a.href = url; a.href = url;
@@ -232,7 +232,7 @@ const Attackers: React.FC = () => {
type="button" type="button"
className="btn btn-ghost" className="btn btn-ghost"
onClick={handleExport} onClick={handleExport}
title="Export all threat data as JSON" title="Export all attackers as STIX 2.1 bundle"
style={{ display: 'flex', alignItems: 'center', gap: 6 }} style={{ display: 'flex', alignItems: 'center', gap: 6 }}
> >
<Download size={13} /> <Download size={13} />