模版解析正确

This commit is contained in:
dengqichen 2024-12-06 12:58:01 +08:00
parent 49a711356b
commit 656900d1db

View File

@ -26,6 +26,11 @@ interface NodeData {
description?: string;
config: {
executor?: string;
retryTimes?: number;
retryInterval?: number;
script?: string;
timeout?: number;
workingDir?: string;
[key: string]: any;
};
}
@ -259,13 +264,27 @@ const FlowDesigner: React.FC = () => {
const nodeType = nodeTypes.find(type => type.code === data.type);
if (nodeType) {
setCurrentNodeType(nodeType);
// 设置表单值,包括基本信息和配置信息
form.setFieldsValue({
// 合并节点基本配置和执行器配置
const formValues = {
name: data.name || nodeType.name,
description: data.description,
executor: data.config?.executor,
...data.config
});
retryTimes: data.config?.retryTimes,
retryInterval: data.config?.retryInterval,
};
// 如果是Shell节点添加执行器特定配置
if (data.type === 'SHELL' && data.config?.executor === 'SHELL') {
Object.assign(formValues, {
script: data.config?.script || '',
timeout: data.config?.timeout || 300,
workingDir: data.config?.workingDir || '/tmp'
});
}
// 设置表单值
form.setFieldsValue(formValues);
setConfigVisible(true);
} else {
message.error('未找到对应的节点类型');