网关跟定时器无错。
This commit is contained in:
parent
fedcec4da3
commit
d6f3648229
@ -112,23 +112,27 @@ const NodeConfig: React.FC<NodeConfigProps> = ({ nodeType, form, onValuesChange
|
||||
const renderTimerConfig = () => {
|
||||
if (!nodeType.code?.includes('TIMER')) return null;
|
||||
|
||||
// 从schema中获取cron字段的配置
|
||||
const cronField = nodeSchema?.properties?.cron;
|
||||
if (!cronField) return null;
|
||||
|
||||
return (
|
||||
<Form.Item
|
||||
label="CRON表达式"
|
||||
label={cronField.title || "CRON表达式"}
|
||||
name="cron"
|
||||
tooltip="定时触发的CRON表达式"
|
||||
tooltip={cronField.description}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
required: nodeSchema?.required?.includes('cron'),
|
||||
message: '请输入CRON表达式'
|
||||
},
|
||||
{
|
||||
pattern: /^(\d+|\*|\*\/\d+|\d+\-\d+|\d+(,\d+)*) (\d+|\*|\*\/\d+|\d+\-\d+|\d+(,\d+)*) (\d+|\*|\*\/\d+|\d+\-\d+|\d+(,\d+)*) (\d+|\*|\*\/\d+|\d+\-\d+|\d+(,\d+)*) (\d+|\*|\*\/\d+|\d+\-\d+|\d+(,\d+)*) (\d+|\*|\*\/\d+|\d+\-\d+|\d+(,\d+)*)$/,
|
||||
...(cronField.pattern ? [{
|
||||
pattern: new RegExp(cronField.pattern),
|
||||
message: '请输入有效的CRON表达式'
|
||||
}
|
||||
}] : [])
|
||||
]}
|
||||
>
|
||||
<Input placeholder="例如: 0 0 * * * *" />
|
||||
<Input placeholder={`例如: ${cronField.examples?.[0] || ''}`} />
|
||||
</Form.Item>
|
||||
);
|
||||
};
|
||||
|
||||
@ -273,23 +273,9 @@ const FlowDesigner: React.FC = () => {
|
||||
const formValues = {
|
||||
name: data.name || nodeType.name,
|
||||
description: data.description,
|
||||
executor: data.config?.executor,
|
||||
...data.config // 直接展开所有配置
|
||||
};
|
||||
|
||||
// 如果是Shell节点,添加执行器特定配置
|
||||
if (data.type === 'SHELL' && data.config?.executor === 'SHELL') {
|
||||
console.log('Shell node config:', data.config);
|
||||
Object.assign(formValues, {
|
||||
script: data.config.script,
|
||||
timeout: data.config.timeout,
|
||||
workingDirectory: data.config.workingDirectory,
|
||||
environment: data.config.environment,
|
||||
successExitCode: data.config.successExitCode,
|
||||
retryTimes: data.config.retryTimes,
|
||||
retryInterval: data.config.retryInterval,
|
||||
});
|
||||
}
|
||||
|
||||
console.log('Setting form values:', formValues);
|
||||
form.setFieldsValue(formValues);
|
||||
setConfigVisible(true);
|
||||
@ -563,15 +549,12 @@ const FlowDesigner: React.FC = () => {
|
||||
|
||||
// 加载节点配置数据
|
||||
if (detail.nodeConfig) {
|
||||
console.log('Loading node config:', detail.nodeConfig);
|
||||
const nodeConfigData = JSON.parse(detail.nodeConfig);
|
||||
console.log('Parsed node config:', nodeConfigData);
|
||||
|
||||
// 更新节点数据和显示
|
||||
graph.getNodes().forEach(node => {
|
||||
const nodeConfig = nodeConfigData.nodes.find((n: any) => n.id === node.id);
|
||||
if (nodeConfig) {
|
||||
console.log('Node config found:', nodeConfig);
|
||||
console.log('Node config found:', nodeConfig.config);
|
||||
const nodeData = {
|
||||
type: nodeConfig.type,
|
||||
name: nodeConfig.name,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user