Commit a3af50d4 authored by chenshouchao's avatar chenshouchao

feat: 整理新增批算子的代码

parent 4c4cb316
...@@ -54,54 +54,6 @@ const OperatorList = (props: IProps) => { ...@@ -54,54 +54,6 @@ const OperatorList = (props: IProps) => {
}; };
}); });
setIsLastPage(res?.data?.last); setIsLastPage(res?.data?.last);
// todo 去掉parameters添加
// arr.forEach((item: any, index: number) => {
// item.edges = [];
// item.parameters.push({
// choices: [],
// classType: "STRING",
// classTypeName: "String",
// defaultValue: null,
// description: "",
// domType: "dataset",
// hidden: false,
// isnull: false,
// level: null,
// linked: false,
// many: false,
// name: `in${index + 1}`,
// order: 0,
// parameterGroup: "in",
// promoted: false,
// promotedName: null,
// required: false,
// title: null,
// validators: [],
// });
// });
// arr.forEach((item: any, index: number) => {
// item.parameters.push({
// choices: [],
// classType: "STRING",
// classTypeName: "String",
// defaultValue: null,
// description: "",
// domType: "dataset",
// hidden: false,
// isnull: false,
// level: null,
// linked: false,
// many: false,
// name: `out${index + 1}`,
// order: 0,
// parameterGroup: "out",
// promoted: false,
// promotedName: null,
// required: false,
// title: null,
// validators: [],
// });
// });
setList([...list, ...arr]); setList([...list, ...arr]);
}, },
}); });
...@@ -115,7 +67,6 @@ const OperatorList = (props: IProps) => { ...@@ -115,7 +67,6 @@ const OperatorList = (props: IProps) => {
page, page,
size: 20, size: 20,
}); });
// size: 20 todo
}, },
[productId, getOperatorListRun] [productId, getOperatorListRun]
); );
......
import { saveUserSpec } from "@/api/workbench_api";
import MyDialog from "@/components/mui/MyDialog"; import MyDialog from "@/components/mui/MyDialog";
import MyInput from "@/components/mui/MyInput"; import MyInput from "@/components/mui/MyInput";
import { checkIsNumberLetterChinese } from "@/utils/util"; import { checkIsNumberLetterChinese } from "@/utils/util";
...@@ -8,7 +7,6 @@ import useMyRequest from "@/hooks/useMyRequest"; ...@@ -8,7 +7,6 @@ import useMyRequest from "@/hooks/useMyRequest";
import { saveBatchActor } from "@/api/project_api"; import { saveBatchActor } from "@/api/project_api";
import { useStores } from "@/store"; import { useStores } from "@/store";
// import styles from "./index.module.css";
import { useMessage } from "@/components/MySnackbar"; import { useMessage } from "@/components/MySnackbar";
import { toJS } from "mobx"; import { toJS } from "mobx";
import { ITask } from "@/views/Project/ProjectSubmitWork/interface"; import { ITask } from "@/views/Project/ProjectSubmitWork/interface";
...@@ -33,13 +31,12 @@ const SaveOperator = (props: IProps) => { ...@@ -33,13 +31,12 @@ const SaveOperator = (props: IProps) => {
const [description, setDescription] = useState(""); const [description, setDescription] = useState("");
// 保存批算子 // 保存批算子
const { run: saveBatchActorRun } = useMyRequest(saveBatchActor, { const { run: saveBatchActorRun, loading } = useMyRequest(saveBatchActor, {
onSuccess: (res) => { onSuccess: (res) => {
Message.success("保存算子成功"); Message.success("保存算子成功");
sessionStorage.setItem("operatorList", "[]"); sessionStorage.setItem("operatorList", "[]");
setSaveFormDialog(false); setSaveFormDialog(false);
setShowCustomOperator(); setShowCustomOperator();
console.log("res", res);
}, },
}); });
...@@ -153,7 +150,6 @@ const SaveOperator = (props: IProps) => { ...@@ -153,7 +150,6 @@ const SaveOperator = (props: IProps) => {
// 表单弹窗确定,新建算子 // 表单弹窗确定,新建算子
const handleOncofirm = () => { const handleOncofirm = () => {
console.log(operatorList);
if (checkTitle(title) && checkVersion(version)) { if (checkTitle(title) && checkVersion(version)) {
saveBatchActorRun({ saveBatchActorRun({
query: { query: {
...@@ -163,576 +159,7 @@ const SaveOperator = (props: IProps) => { ...@@ -163,576 +159,7 @@ const SaveOperator = (props: IProps) => {
description: description, description: description,
}, },
body: positionTransform(), body: positionTransform(),
// body: [
// {
// id: "62c7965c9bf7ba39f2dcefc0",
// title: "RecordFileReader",
// description: "这是一段RecordFileReader算子的描述",
// type: "FLOW",
// productId: "cadd",
// creator: "root",
// parameters: [
// {
// name: "raw",
// classType: "BOOLEAN",
// classTypeName: "Boolean",
// required: false,
// defaultValue: "false",
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "RADIO",
// validators: [],
// choices: [
// {
// value: "true",
// },
// {
// value: "false",
// },
// ],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "sep",
// classType: "STRING",
// classTypeName: "String",
// required: false,
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [],
// choices: [],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "contains_sep",
// classType: "BOOLEAN",
// classTypeName: "Boolean",
// required: false,
// defaultValue: "false",
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "RADIO",
// validators: [],
// choices: [
// {
// value: "true",
// },
// {
// value: "false",
// },
// ],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "encoding",
// classType: "STRING",
// classTypeName: "String",
// required: false,
// defaultValue: "UTF-8",
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [],
// choices: [],
// parameterGroup: "senior",
// linked: false,
// },
// {
// name: "chunk_size",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "1000",
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "senior",
// linked: false,
// },
// {
// name: "compression",
// classType: "STRING",
// classTypeName: "String",
// required: false,
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [],
// choices: [],
// parameterGroup: "senior",
// linked: false,
// },
// {
// name: "cpus",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "1",
// description: "",
// hidden: true,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "hardware",
// linked: false,
// },
// {
// name: "ntasks",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "1",
// description: "",
// hidden: true,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "hardware",
// linked: false,
// },
// {
// name: "partition",
// classType: "STRING",
// classTypeName: "String",
// required: false,
// defaultValue: "c-4-1",
// description: "",
// hidden: true,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// choices: [],
// parameterGroup: "hardware",
// linked: false,
// },
// {
// name: "parallelism",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "1",
// description: "",
// hidden: true,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "hardware",
// linked: false,
// },
// ],
// edges: [
// {
// id: "d3ffaf04-b3dc-4c1c-a3c0-a897536131ba",
// source: "62c7965c9bf7ba39f2dcefc0",
// target: "62c7965c9bf7ba39f2dcefc1",
// },
// ],
// version: "1.0.0",
// allVersions: ["1.0.0", "2.0.0"],
// scatter: false,
// _class: "com.cloudam.c3.domain.ActorSpec",
// },
// {
// id: "62c7965c9bf7ba39f2dcefc2",
// title: "Docking",
// description: "这是一段Docking算子的描述",
// type: "FLOW",
// productId: "cadd",
// creator: "root",
// parameters: [
// {
// name: "core_num",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "1",
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "centerX",
// classType: "INT",
// classTypeName: "Int",
// required: true,
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "centerY",
// classType: "INT",
// classTypeName: "Int",
// required: true,
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "centerZ",
// classType: "INT",
// classTypeName: "Int",
// required: true,
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "boxSizeX",
// classType: "INT",
// classTypeName: "Int",
// required: true,
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "boxSizeY",
// classType: "INT",
// classTypeName: "Int",
// required: true,
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "boxSizeZ",
// classType: "INT",
// classTypeName: "Int",
// required: true,
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "basis",
// linked: false,
// },
// {
// name: "poses_num",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "9",
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "senior",
// linked: false,
// },
// {
// name: "verbosity",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "1",
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "senior",
// linked: false,
// },
// {
// name: "exhaustiveness",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "1",
// description: "",
// hidden: false,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "senior",
// linked: false,
// },
// {
// name: "cpus",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "1",
// description: "",
// hidden: true,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "hardware",
// linked: false,
// },
// {
// name: "ntasks",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "4",
// description: "",
// hidden: true,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "hardware",
// linked: false,
// },
// {
// name: "partition",
// classType: "STRING",
// classTypeName: "String",
// required: false,
// defaultValue: "c-4-1",
// description: "",
// hidden: true,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [],
// choices: [],
// parameterGroup: "hardware",
// linked: false,
// },
// {
// name: "parallelism",
// classType: "INT",
// classTypeName: "Int",
// required: false,
// defaultValue: "6",
// description: "",
// hidden: true,
// many: false,
// isnull: false,
// promoted: false,
// order: 0,
// domType: "INPUT",
// validators: [
// {
// regex: "^[1-9]\\d*$",
// },
// ],
// choices: [],
// parameterGroup: "hardware",
// linked: false,
// },
// ],
// edges: [
// {
// id: "33f82dd3-47ed-4aae-85bc-0a9e763e0981",
// source: "62c7965c9bf7ba39f2dcefc2",
// target: "62c7965c9bf7ba39f2dcefc3",
// },
// ],
// version: "1.0.0",
// allVersions: ["1.0.0", "2.0.0"],
// scatter: false,
// _class: "com.cloudam.c3.domain.ActorSpec",
// },
// ],
}); });
// operatorList
// if (id) {
// saveUserSpecRun({
// title,
// version,
// description,
// tasks: templateConfigInfo,
// productId,
// id,
// creator,
// });
// } else {
// saveUserSpecRun({
// title,
// version,
// description,
// tasks: templateConfigInfo,
// productId,
// });
// }
} }
}; };
...@@ -742,6 +169,7 @@ const SaveOperator = (props: IProps) => { ...@@ -742,6 +169,7 @@ const SaveOperator = (props: IProps) => {
title="保存算子" title="保存算子"
onClose={handleCloseDialog} onClose={handleCloseDialog}
onConfirm={handleOncofirm} onConfirm={handleOncofirm}
loading={loading}
> >
<div style={{ width: "388px" }}> <div style={{ width: "388px" }}>
<MyInput <MyInput
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment