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