feat: add download functionality for example operator and update Dock… (#188)

* feat: add download functionality for example operator and update Dockerfile

* feat: enhance download response by exposing content disposition header

* feat: update download function to accept filename parameter for example operator
This commit is contained in:
hhhhsc701
2025-12-22 15:39:32 +08:00
committed by GitHub
parent 8fc4455b57
commit 46f4a8c219
6 changed files with 64 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import {
EditOutlined,
FilterOutlined,
PlusOutlined,
DownloadOutlined
} from "@ant-design/icons";
import { Boxes } from "lucide-react";
import { SearchControls } from "@/components/SearchControls";
@@ -20,6 +21,7 @@ import { ListView } from "./components/List";
import useFetchData from "@/hooks/useFetchData";
import {
deleteOperatorByIdUsingDelete,
downloadExampleOperatorUsingGet,
queryCategoryTreeUsingGet,
queryOperatorsUsingPost,
} from "../operator.api";
@@ -58,6 +60,11 @@ export default function OperatorMarketPage() {
navigate(`/data/operator-market/create`);
};
const handleDownload = async () => {
await downloadExampleOperatorUsingGet("test_operator.tar");
message.success("文件下载成功");
};
const handleUpdateOperator = (operator: OperatorI) => {
navigate(`/data/operator-market/create/${operator.id}`);
};
@@ -119,7 +126,13 @@ export default function OperatorMarketPage() {
<div className="flex justify-between">
<h1 className="text-xl font-bold text-gray-900"></h1>
<div className="flex gap-2">
<TagManagement />
{/*<TagManagement />*/}
<Button
icon={<DownloadOutlined />}
onClick={handleDownload}
>
</Button>
<Button
type="primary"
icon={<PlusOutlined />}

View File

@@ -48,6 +48,11 @@ export function uploadOperatorChunkUsingPost(_, data: FormData, config?: any) {
...config,
});
}
export function downloadExampleOperatorUsingGet(fileName: string) {
return download("/api/operators/examples/download", null, fileName);
}
// 发布算子
export function publishOperatorUsingPost(operatorId: string | number) {
return post(`/api/operators/${operatorId}/publish`);