增加GIT代码检测节点
This commit is contained in:
parent
61ff98737d
commit
241eb3914b
@ -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 表达式语法,支持比较运算符(==、!=、>、<)和逻辑运算符(&&、||)
|
||||
{hasOtherDefaultBranch ? (
|
||||
<>当前已有默认分支,请填写条件表达式。使用 JUEL 语法,支持比较运算符(==、!=、>、<)和逻辑运算符(&&、||)</>
|
||||
) : (
|
||||
<>留空作为默认路径(所有条件不满足时执行)。填写时使用 JUEL 语法,支持比较运算符(==、!=、>、<)和逻辑运算符(&&、||)</>
|
||||
)}
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
||||
@ -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(() => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user