Commit 8d55fa8d authored by 吴永生#A02208's avatar 吴永生#A02208

Merge branch 'feat-20220705-customTemplate' of http://120.77.149.83/root/bkunyun…

Merge branch 'feat-20220705-customTemplate' of http://120.77.149.83/root/bkunyun into feat-20220705-customTemplate
parents bdfc974c 2489ece8
......@@ -22,7 +22,7 @@ interface MyInputProps extends Omit<TextFieldProps, "value"> {
InputProps?: any; // input加前后icon可以用这个
error?: boolean;
helperText?: string;
};
}
const MyInput = (props: MyInputProps) => {
const {
......@@ -39,6 +39,7 @@ const MyInput = (props: MyInputProps) => {
InputProps,
error = false,
helperText,
disabled,
} = props;
return (
......@@ -58,6 +59,7 @@ const MyInput = (props: MyInputProps) => {
InputProps={{
...InputProps,
}}
disabled={disabled}
value={value}
/>
);
......
......@@ -377,7 +377,8 @@ const ProjectSubmitWork = observer(() => {
{!activePatchId && (
<div className={styles.taskInfo}>
<div className={styles.title}>任务结果</div>
{workFlowJobInfo?.outputs && (
{workFlowJobInfo?.outputs &&
Object.keys(workFlowJobInfo?.outputs).length > 0 && (
<div className={styles.taskResults}>
{randerOutputs1.map((item, index) => {
return (
......@@ -395,7 +396,9 @@ const ProjectSubmitWork = observer(() => {
e,
"即将跳转至项目数据内该任务的结果目录,确认继续吗?"
);
setGoToProjectDataPath(getFolderPath(item.path));
setGoToProjectDataPath(
getFolderPath(item.path)
);
}}
>
<img
......@@ -416,7 +419,8 @@ const ProjectSubmitWork = observer(() => {
})}
</div>
)}
{!workFlowJobInfo?.outputs && (
{workFlowJobInfo?.outputs &&
Object.keys(workFlowJobInfo?.outputs).length === 0 && (
<div className={styles.notResults}>暂无结果文件</div>
)}
<div className={styles.title}>任务信息</div>
......
......@@ -110,11 +110,12 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
};
useEffect(() => {
setSelectTemplateData([]);
getAddTemplateList({
projectId: projectId as string,
productId: productId as string,
});
}, [getAddTemplateList, projectId, productId]);
}, [templateType, getAddTemplateList, projectId, productId]);
const hiddenBoxArr = useMemo(() => {
const length =
......
......@@ -255,6 +255,38 @@ const ParameterSetting = (props: IParameterSettingProps) => {
if (parameter.id === parameterId) {
console.log(e.target.checked);
parameter.hidden = !e.target.checked;
const checkResult = getCustomTemplateParameterCheckResult(
parameter,
parameter.defaultValue
);
parameter.error = checkResult.error;
parameter.helperText = checkResult.helperText;
}
});
}
setTemplateConfigInfo(result);
},
[templateConfigInfo, setTemplateConfigInfo]
);
const handleParameterChange = useCallback(
(e: any, parameterId: string) => {
console.log(e.target.value, taskId, parameterId);
const result: ITask[] = _.cloneDeep(templateConfigInfo);
console.log(result);
const taskIndex = result.findIndex((item) => {
return item.id === taskId;
});
if (taskIndex !== -1) {
result[taskIndex].parameters.forEach((parameter) => {
if (parameter.id === parameterId) {
parameter.defaultValue = e.target.value;
const checkResult = getCustomTemplateParameterCheckResult(
parameter,
e.target.value
);
parameter.error = checkResult.error;
parameter.helperText = checkResult.helperText;
}
});
}
......@@ -263,7 +295,8 @@ const ParameterSetting = (props: IParameterSettingProps) => {
[templateConfigInfo, setTemplateConfigInfo]
);
const renderInput = useCallback((parameter: IParameter) => {
const renderInput = useCallback(
(parameter: IParameter) => {
return (
<Tooltip title={parameter.description} placement="top">
<div>
......@@ -273,7 +306,9 @@ const ParameterSetting = (props: IParameterSettingProps) => {
InputProps={{
endAdornment: (
<img
onClick={() => handleOpenFileSelect(taskId, parameter.name)}
onClick={() =>
handleOpenFileSelect(taskId, parameter.name)
}
src={fileSelectIcon}
alt=""
className={styles.fileSelectImg}
......@@ -292,7 +327,9 @@ const ParameterSetting = (props: IParameterSettingProps) => {
InputProps={{
endAdornment: (
<img
onClick={() => handleOpenFileSelect(taskId, parameter.name)}
onClick={() =>
handleOpenFileSelect(taskId, parameter.name)
}
src={fileSelectIcon}
alt=""
className={styles.fileSelectImg}
......@@ -311,7 +348,9 @@ const ParameterSetting = (props: IParameterSettingProps) => {
InputProps={{
endAdornment: (
<img
onClick={() => handleOpenFileSelect(taskId, parameter.name)}
onClick={() =>
handleOpenFileSelect(taskId, parameter.name)
}
src={fileSelectIcon}
alt=""
className={styles.fileSelectImg}
......@@ -398,7 +437,9 @@ const ParameterSetting = (props: IParameterSettingProps) => {
</div>
</Tooltip>
);
}, []);
},
[handleParameterChange]
);
// 输入参数
const inParameters: Array<IParameter> = useMemo(() => {
......@@ -463,7 +504,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
return (
<div
className={styles.parameter}
key={parameter.id || "" + parameterIndex}
key={`${parameter.id}${parameterIndex}`}
>
<div className={styles.parameterTop}>
<div className={styles.parameterLeft}>
......@@ -509,44 +550,6 @@ const ParameterSetting = (props: IParameterSettingProps) => {
setFileSelectOpen(true);
};
const handleParameterChange = useCallback(
(e: any, parameterId: string) => {
console.log(e.target.value, taskId, parameterId);
const result: ITask[] = _.cloneDeep(templateConfigInfo);
console.log(result);
result.forEach((task) => {
if (task.id === taskId) {
let isCheck = true;
task.parameters.forEach((parameter) => {
if (parameter.id === parameterId) {
parameter.defaultValue = e.target.value;
const checkResult = getCustomTemplateParameterCheckResult(
parameter,
e.target.value
);
parameter.error = checkResult.error;
parameter.helperText = checkResult.helperText;
}
if (
getCustomTemplateParameterCheckResult(
parameter,
parameter.defaultValue
).error === true
) {
isCheck = false;
}
});
task.isCheck = isCheck;
} else {
return;
}
});
setTemplateConfigInfo(result);
// setParameter(e.target.value, taskId, parameterName);
},
[templateConfigInfo, setTemplateConfigInfo]
);
// 参数组tabs
const paramsTabList = useMemo(() => {
return [
......@@ -631,7 +634,10 @@ const ParameterSetting = (props: IParameterSettingProps) => {
<div className={styles.paramsList}>
{inParameters.map((parameter, index) => {
return (
<div className={styles.inOutParameterBox} key={index}>
<div
className={styles.inOutParameterBox}
key={`${parameter.id}${index}`}
>
<div className={styles.inOutParameterTop}>
<div className={styles.inOutParameterleft}>
<div
......@@ -666,9 +672,12 @@ const ParameterSetting = (props: IParameterSettingProps) => {
<div className={styles.inOutBox}>
<div className={styles.paramsTitle}>输出</div>
<div className={styles.paramsList}>
{inParameters.map((parameter, index) => {
{outParameters.map((parameter, index) => {
return (
<div className={styles.inOutParameterBox} key={index}>
<div
className={styles.inOutParameterBox}
key={`${parameter.id}${index}`}
>
<div className={styles.inOutParameterTop}>
<div className={styles.inOutParameterleft}>
<div
......
......@@ -23,6 +23,12 @@ export const getCustomTemplateParameterCheckResult = (
}
}
}
if (error) {
return {
error,
helperText,
};
}
if (parameter.validators.length > 0) {
parameter.validators.forEach((validator) => {
const reg = new RegExp(validator.regex);
......
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