zip deformation outputs on download

This commit is contained in:
2026-05-03 01:33:18 +08:00
parent 0aa9cffb97
commit a795aa13bf
2 changed files with 78 additions and 84 deletions

View File

@@ -295,6 +295,9 @@ export default function App() {
};
const fileUrl = (path?: string) => path ? `${API_BASE}/api/file?path=${encodeURIComponent(path)}` : '';
const deformationDownloadUrl = (target: string) => deformationJob?.id
? `${API_BASE}/api/deformation/download?job=${encodeURIComponent(deformationJob.id)}&target=${encodeURIComponent(target)}`
: '';
const clearDeformationTask = () => {
setDeformationJob(null);
@@ -829,10 +832,10 @@ export default function App() {
<div className={`h-full ${deformationJob?.status === 'failed' ? 'bg-red-500' : 'bg-blue-600'} transition-all`} style={{ width: `${deformationJob?.status === 'completed' ? 100 : progress}%` }} />
</div>
{deformationJob?.error && <p className="text-[10px] text-red-500 font-bold mt-2 break-all">{deformationJob.error}</p>}
{deformationJob?.status === 'completed' && deformationJob.result?.zip?.path && (
{deformationJob?.status === 'completed' && deformationJob.result?.outputs && (
<a
href={fileUrl(deformationJob.result.zip.path)}
download={deformationJob.result.zip.name}
href={deformationDownloadUrl('all')}
download
className="mt-3 w-full py-3 bg-green-600 text-white rounded-xl text-xs font-bold hover:bg-green-700 transition-all flex items-center justify-center gap-2"
>
<Download size={14} /> ZIP
@@ -917,7 +920,6 @@ export default function App() {
].map(t => {
const screenshotDir = deformationJob?.result?.previews?.screenshots;
const imagePath = screenshotDir ? `${screenshotDir}/${t.key}.png` : '';
const stateZip = deformationJob?.result?.stateZips?.[t.key];
return (
<div key={t.key} className="bg-white p-4 rounded-2xl border flex flex-col hover:border-blue-200 transition-colors shadow-sm group min-h-[285px]">
<div className="flex justify-between items-center mb-3">
@@ -934,10 +936,10 @@ export default function App() {
</div>
)}
</div>
{stateZip?.path && (
{deformationJob?.status === 'completed' && deformationJob.result?.outputs?.[t.key] && (
<a
href={fileUrl(stateZip.path)}
download={stateZip.name}
href={deformationDownloadUrl(t.key)}
download
className="mt-3 py-2.5 bg-slate-100 text-slate-600 rounded-xl text-[11px] font-black hover:bg-green-600 hover:text-white transition-all flex items-center justify-center gap-2"
>
<Download size={13} /> DICOM ZIP