style: detail layout

This commit is contained in:
jialin
2026-01-30 18:48:55 +08:00
parent 667751dc5f
commit 5747cae87a
23 changed files with 506 additions and 234 deletions
@@ -0,0 +1,45 @@
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
import { downloadFile } from '@/utils/download-stream';
import { message } from 'antd';
import { EXPORT_BENCHMARK_LIST } from '../apis';
const matchFilename = (disposition: string | null): string | undefined => {
if (!disposition) return '';
const match = disposition.match(/filename="?([^"]+)"?/);
const filename = match ? match[1] : '';
return filename;
};
export function useExportBenchmark() {
const exportData = async (data: any[]) => {
try {
const res = await fetch(
`${GPUSTACK_API_BASE_URL}${EXPORT_BENCHMARK_LIST}`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
}
);
// header
const contentDispostion = res.headers.get('content-Disposition');
const filename =
matchFilename(contentDispostion) || `benchmark-export.yml`;
if (res.ok) {
const blob = await res.blob();
downloadFile(blob, filename);
} else {
message.error('Download failed');
}
} catch (error) {
message.error('Download failed');
}
};
return {
exportData
};
}