增加GIT代码检测节点

This commit is contained in:
dengqichen 2025-12-05 13:19:36 +08:00
parent 61ff98737d
commit 241eb3914b
2 changed files with 62 additions and 32 deletions

View File

@ -256,19 +256,16 @@ const EdgeConfigModal: React.FC<EdgeConfigModalProps> = ({
{/* 错误提示:多个默认分支(网关节点) */}
{isFromGateway && gatewayType && gatewayType !== 'parallelGateway' && hasOtherDefaultBranch && isDefaultBranch && (
<div className="rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-800 p-4 mb-6">
<div className="flex items-start gap-3">
<div className="flex-shrink-0 w-5 h-5 mt-0.5 rounded-full bg-red-500 flex items-center justify-center">
<svg className="w-3 h-3 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<div className="rounded border border-red-300 dark:border-red-700 bg-red-50/50 dark:bg-red-950/10 px-3 py-2.5 mb-4">
<div className="flex items-start gap-2">
<div className="flex-shrink-0 w-4 h-4 mt-0.5 rounded-full bg-red-500 flex items-center justify-center">
<svg className="w-2.5 h-2.5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
</div>
<div className="flex-1">
<p className="font-semibold text-red-900 dark:text-red-200 mb-2">
</p>
<p className="text-sm text-red-800 dark:text-red-300 mb-2">
"表达式"
<p className="text-sm text-red-800 dark:text-red-300">
</p>
</div>
</div>
@ -284,34 +281,36 @@ const EdgeConfigModal: React.FC<EdgeConfigModalProps> = ({
) : (
<Form {...form}>
<form onSubmit={form.handleSubmit(handleSubmit)} className="space-y-6">
{/* 智能提示:默认路径说明 */}
{isDefaultBranch && (
<div className="rounded-md bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 p-4 text-sm">
{/* 智能提示:默认路径说明(仅在没有冲突时显示) */}
{isDefaultBranch && !hasOtherDefaultBranch && (
<div className="rounded border border-blue-300 dark:border-blue-700 bg-blue-50/50 dark:bg-blue-950/10 px-3 py-2.5 mb-4">
<div className="flex items-start gap-2">
<span className="text-blue-600 dark:text-blue-400"></span>
<div className="flex-1 space-y-2">
<p className="font-medium text-blue-900 dark:text-blue-200">
</p>
<p className="text-blue-800 dark:text-blue-300">
<strong></strong>999
<div className="flex-shrink-0 w-4 h-4 mt-0.5 rounded-full bg-blue-500 flex items-center justify-center">
<svg className="w-2.5 h-2.5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div className="flex-1">
<p className="text-sm text-blue-800 dark:text-blue-300">
999
</p>
</div>
</div>
</div>
)}
{/* 错误提示:多个默认分支(仅非网关节点) */}
{/* 错误提示:多个默认分支(仅非网关节点) */}
{!isFromGateway && isDefaultBranch && hasOtherDefaultBranch && (
<div className="rounded-md bg-red-50 dark:bg-red-950/20 border-2 border-red-400 dark:border-red-600 p-4 text-sm">
<div className="rounded border border-red-300 dark:border-red-700 bg-red-50/50 dark:bg-red-950/10 px-3 py-2.5 mb-4">
<div className="flex items-start gap-2">
<span className="text-red-600 dark:text-red-400"></span>
<div className="flex-1 space-y-2">
<p className="font-bold text-red-900 dark:text-red-200">
</p>
<p className="text-red-800 dark:text-red-300">
"<strong>{sourceNode?.data.label}</strong>"
<div className="flex-shrink-0 w-4 h-4 mt-0.5 rounded-full bg-red-500 flex items-center justify-center">
<svg className="w-2.5 h-2.5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
</div>
<div className="flex-1">
<p className="text-sm text-red-800 dark:text-red-300">
"{sourceNode?.data.label}"
</p>
</div>
</div>
@ -334,13 +333,19 @@ const EdgeConfigModal: React.FC<EdgeConfigModalProps> = ({
currentNodeId={edge?.target || ''}
formFields={formFields}
variant="textarea"
placeholder="例如: ${Jenkins构建.status} == 'SUCCESS',留空表示默认路径"
placeholder={hasOtherDefaultBranch
? "例如: ${Jenkins构建.status} == 'SUCCESS'"
: "例如: ${Jenkins构建.status} == 'SUCCESS',留空表示默认路径"
}
rows={4}
/>
</FormControl>
<FormDescription>
💡 <strong></strong>
使 JUEL ==!=&gt;&lt;&amp;&amp;||
{hasOtherDefaultBranch ? (
<>使 JUEL ==!=&gt;&lt;&amp;&amp;||</>
) : (
<>使 JUEL ==!=&gt;&lt;&amp;&amp;||</>
)}
</FormDescription>
<FormMessage />
</FormItem>

View File

@ -469,8 +469,33 @@ const WorkflowDesignInner: React.FC = () => {
: node
)
);
// 如果是网关节点且改为并行网关,清理所有出边的条件配置
const updatedNode = getNodes().find(n => n.id === nodeId);
const isGateway = updatedNode?.data?.nodeType === 'GATEWAY_NODE';
const gatewayType = (updatedData.inputMapping as any)?.gatewayType;
if (isGateway && gatewayType === 'parallelGateway') {
setEdges((edges) =>
edges.map((edge) =>
edge.source === nodeId
? {
...edge,
label: undefined, // 清理边的显示文字
data: {
...edge.data,
label: undefined, // 清理 data 中的 label
condition: undefined // 清理条件配置
}
}
: edge
)
);
message.success('已切换为并行网关,所有分支的条件配置已清除');
}
markUnsaved(); // 标记有未保存更改
}, [setNodes, markUnsaved]);
}, [setNodes, setEdges, getNodes, markUnsaved]);
// 关闭节点配置模态框
const handleCloseConfigModal = useCallback(() => {