Commit 5f1d13aa authored by chenshouchao's avatar chenshouchao

feat: 增加算子列表、参数设置切换

parent 24b9ce7c
.RadiosBox { .RadiosBox {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border: 1px solid #e6e8eb; border: 1px solid #e6e8eb;
border-radius: 4px; border-radius: 4px;
background-color: #e6e8eb; background-color: #e6e8eb;
cursor: pointer; cursor: pointer;
height: 32px; height: 32px;
box-sizing: border-box; box-sizing: border-box;
padding: 2px; padding: 2px;
} }
.radio { .radio {
height: 28px; height: 28px;
box-sizing: border-box; box-sizing: border-box;
font-size: 14px; font-size: 14px;
color: #565c66; color: #565c66;
border-radius: 4px; border-radius: 4px;
line-height: 20px; line-height: 20px;
padding: 3px 18px; padding: 3px 18px;
background-color: #e6e8eb; background-color: #e6e8eb;
display: flex; flex: 1;
align-items: center; display: flex;
align-items: center;
justify-content: center;
} }
.radioActive { .radioActive {
color: #1370ff; color: #1370ff;
background-color: #fff; background-color: #fff;
border: 1px solid #e6e8eb; border: 1px solid #e6e8eb;
} }
...@@ -3,37 +3,41 @@ import classnames from "classnames"; ...@@ -3,37 +3,41 @@ import classnames from "classnames";
import style from "./index.module.css"; import style from "./index.module.css";
type radioOption = { type radioOption = {
value: string; value: string;
label: string; label: string;
}; };
type IRadioGroupOfButtonStyleProps = { type IRadioGroupOfButtonStyleProps = {
radioOptions: Array<radioOption>; radioOptions: Array<radioOption>;
value: string; value: string;
handleRadio: any; handleRadio: any;
RadiosBoxStyle?: object;
radioStyle?: object;
}; };
const RadioGroupOfButtonStyle = (props: IRadioGroupOfButtonStyleProps) => { const RadioGroupOfButtonStyle = (props: IRadioGroupOfButtonStyleProps) => {
const { radioOptions, value, handleRadio } = props; const { radioOptions, value, handleRadio, RadiosBoxStyle, radioStyle } =
props;
return ( return (
<div className={style.RadiosBox}> <div className={style.RadiosBox} style={RadiosBoxStyle}>
{radioOptions.map((options) => { {radioOptions.map((options) => {
return ( return (
<div <div
key={options.value} key={options.value}
className={classnames({ className={classnames({
[style.radio]: true, [style.radio]: true,
[style.radioActive]: value === options.value, [style.radioActive]: value === options.value,
})} })}
onClick={() => handleRadio(options.value)} onClick={() => handleRadio(options.value)}
> style={radioStyle}
{options.label} >
</div> {options.label}
); </div>
})} );
</div> })}
); </div>
);
}; };
export default RadioGroupOfButtonStyle; export default RadioGroupOfButtonStyle;
...@@ -73,22 +73,22 @@ const ProjectSubmitWork = observer(() => { ...@@ -73,22 +73,22 @@ const ProjectSubmitWork = observer(() => {
const { name, state } = workFlowJobInfo || {}; const { name, state } = workFlowJobInfo || {};
/** 获取模版数据 */ /** 获取模版数据 */
const { run } = useMyRequest(fetchWorkFlowJob, { const { run } = useMyRequest(fetchWorkFlowJob, {
pollingInterval: 1000 * 60, pollingInterval: 1000 * 60,
pollingWhenHidden: false, pollingWhenHidden: false,
onSuccess: (res: IResponse<ITaskInfo>) => { onSuccess: (res: IResponse<ITaskInfo>) => {
getOutouts(res.data.outputs); getOutouts(res.data.outputs);
setWorkFlowJobInfo(res.data); setWorkFlowJobInfo(res.data);
}, },
}); });
useEffect(() => { useEffect(() => {
const locationInfo: any = location?.state; const locationInfo: any = location?.state;
run({ run({
id: locationInfo.taskId, id: locationInfo.taskId,
}); });
}, [location?.state, run]); }, [location?.state, run]);
const { run: getworkFlowTaskInfoRun } = useMyRequest(getworkFlowTaskInfo, { const { run: getworkFlowTaskInfoRun } = useMyRequest(getworkFlowTaskInfo, {
onSuccess: (res) => { onSuccess: (res) => {
...@@ -96,34 +96,35 @@ const ProjectSubmitWork = observer(() => { ...@@ -96,34 +96,35 @@ const ProjectSubmitWork = observer(() => {
}, },
}); });
const goToProjectData = (path: string) => { // 前往数据管理页面
path = path.slice(13); const goToProjectData = (path: string) => {
if (path) { path = path.slice(13);
navigate(`/product/cadd/projectData`, { if (path) {
state: { pathName: path }, navigate(`/product/cadd/projectData`, {
}); state: { pathName: path },
} else { });
navigate(`/product/cadd/projectData`, { } else {
state: { pathName: "/" }, navigate(`/product/cadd/projectData`, {
}); state: { pathName: "/" },
} });
}; }
};
// 通过文件路径获取文件所在文件夹路径 如 输入 /home/cloudam/task_a.out 输出/home/cloudam/ // 通过文件路径获取文件所在文件夹路径 如 输入 /home/cloudam/task_a.out 输出/home/cloudam/
const getFolderPath = (path: string) => { const getFolderPath = (path: string) => {
const lastIndex = path.lastIndexOf("/"); const lastIndex = path.lastIndexOf("/");
if (lastIndex !== -1) { if (lastIndex !== -1) {
path = path.slice(0, lastIndex + 1); path = path.slice(0, lastIndex + 1);
} }
return path; return path;
}; };
/** 返回事件 */ /** 返回事件 */
const onBack = useCallback(() => { const onBack = useCallback(() => {
navigate("/product/cadd/projectWorkbench", { navigate("/product/cadd/projectWorkbench", {
state: { type: "workbenchList" }, state: { type: "workbenchList" },
}); });
}, [navigate]); }, [navigate]);
const outputPathTransform = (path: string) => { const outputPathTransform = (path: string) => {
path = path.slice(13); path = path.slice(13);
...@@ -339,7 +340,9 @@ const ProjectSubmitWork = observer(() => { ...@@ -339,7 +340,9 @@ const ProjectSubmitWork = observer(() => {
<div key={index} className={styles.outputLi}> <div key={index} className={styles.outputLi}>
<MyPopconfirm <MyPopconfirm
title="即将跳转至项目数据内该任务的结果目录,确认继续吗?" title="即将跳转至项目数据内该任务的结果目录,确认继续吗?"
onConfirm={() => goToProjectData(getFolderPath(item.path))} onConfirm={() =>
goToProjectData(getFolderPath(item.path))
}
> >
<div className={styles.outputLiLeft}> <div className={styles.outputLiLeft}>
<img <img
...@@ -510,16 +513,16 @@ const ProjectSubmitWork = observer(() => { ...@@ -510,16 +513,16 @@ const ProjectSubmitWork = observer(() => {
{patchInfo?.children.map((item: any, index: number) => { {patchInfo?.children.map((item: any, index: number) => {
return ( return (
<div <div
key={index} key={index}
className={classNames({ className={classNames({
[styles.option]: true, [styles.option]: true,
[styles.optionActive]: [styles.optionActive]:
activeFlowIndex === index, activeFlowIndex === index,
})} })}
onClick={() => setActiveFlowIndex(index)} onClick={() => setActiveFlowIndex(index)}
> >
{item.title} {item.title}
</div> </div>
); );
})} })}
</div> </div>
......
...@@ -40,3 +40,7 @@ ...@@ -40,3 +40,7 @@
flex: 1; flex: 1;
height: calc(100vh - 56px); height: calc(100vh - 56px);
} }
.radiosBox {
background-color: #fff;
padding: 24px;
}
...@@ -12,11 +12,24 @@ import IconButton from "@mui/material/IconButton"; ...@@ -12,11 +12,24 @@ import IconButton from "@mui/material/IconButton";
import { useLocation, useNavigate } from "react-router-dom"; import { useLocation, useNavigate } from "react-router-dom";
import MyPopconfirm from "@/components/mui/MyPopconfirm"; import MyPopconfirm from "@/components/mui/MyPopconfirm";
import RadioGroupOfButtonStyle from "@/components/CommonComponents/RadioGroupOfButtonStyle";
import ButtonComponent from "@/components/mui/Button"; import ButtonComponent from "@/components/mui/Button";
import { ITemplateConfig } from "../Project/ProjectSubmitWork/interface"; import { ITemplateConfig } from "../Project/ProjectSubmitWork/interface";
import OperatorList from "./components/OperatorList"; import OperatorList from "./components/OperatorList";
import styles from "./index.module.css"; import styles from "./index.module.css";
import { style } from "@mui/system";
const radioOptions = [
{
value: "list",
label: "算子列表",
},
{
value: "setting",
label: "参数设置",
},
];
const WorkFlowEdit = () => { const WorkFlowEdit = () => {
const [templateConfigInfo, setTemplateConfigInfo] = const [templateConfigInfo, setTemplateConfigInfo] =
...@@ -24,6 +37,8 @@ const WorkFlowEdit = () => { ...@@ -24,6 +37,8 @@ const WorkFlowEdit = () => {
const location: any = useLocation(); const location: any = useLocation();
const navigate = useNavigate(); const navigate = useNavigate();
const [leftContentType, setLeftContentType] = useState("list");
return ( return (
<div className={styles.swBox}> <div className={styles.swBox}>
<div className={styles.swHeader}> <div className={styles.swHeader}>
...@@ -62,8 +77,30 @@ const WorkFlowEdit = () => { ...@@ -62,8 +77,30 @@ const WorkFlowEdit = () => {
</div> </div>
</div> </div>
<div className={styles.swContent}> <div className={styles.swContent}>
<div className={styles.swFormBox}> <div>
<OperatorList /> <div className={styles.radiosBox}>
<RadioGroupOfButtonStyle
radioOptions={radioOptions}
value={leftContentType}
handleRadio={setLeftContentType}
RadiosBoxStyle={{
height: "36px",
padding: "3px",
}}
radioStyle={{
fontSize: "16px",
height: "30px",
}}
></RadioGroupOfButtonStyle>
</div>
{leftContentType === "list" && (
<div className={styles.swFormBox}>
<OperatorList />
</div>
)}
{leftContentType !== "list" && (
<div className={styles.swFormBox}>123</div>
)}
</div> </div>
<div className={styles.swFlowBox}>右侧</div> <div className={styles.swFlowBox}>右侧</div>
</div> </div>
......
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