You've already forked DataMate
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:
@@ -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 />}
|
||||
|
||||
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user