From caf0bf34dd9875f81fb5ac2dc0ddbd8049017343 Mon Sep 17 00:00:00 2001 From: yessenia Date: Wed, 22 Oct 2025 10:36:35 +0800 Subject: [PATCH] fix(trigger): add event node status & min-height in modal --- web/app/components/base/modal/modal.tsx | 2 +- web/app/components/base/node-status/index.tsx | 74 +++++++++++++++++++ .../workflow/nodes/trigger-plugin/node.tsx | 11 ++- web/i18n/en-US/plugin-trigger.ts | 5 ++ web/i18n/zh-Hans/plugin-trigger.ts | 5 ++ 5 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 web/app/components/base/node-status/index.tsx diff --git a/web/app/components/base/modal/modal.tsx b/web/app/components/base/modal/modal.tsx index e8edc48fba..3ab941b0f4 100644 --- a/web/app/components/base/modal/modal.tsx +++ b/web/app/components/base/modal/modal.tsx @@ -55,7 +55,7 @@ const Modal = ({ >
= { + [NodeStatusEnum.warning]: { IconComponent: AlertTriangle, message: 'Warning' }, + [NodeStatusEnum.error]: { IconComponent: RiErrorWarningFill, message: 'Error' }, +} + +export type NodeStatusProps = { + message?: string + styleCss?: CSSProperties + iconClassName?: string +} & React.HTMLAttributes & VariantProps + +const NodeStatus = ({ + className, + status, + message, + styleCss, + iconClassName, + children, + ...props +}: NodeStatusProps) => { + const Icon = StatusIconMap[status ?? NodeStatusEnum.warning].IconComponent + const defaultMessage = StatusIconMap[status ?? NodeStatusEnum.warning].message + + return ( +
+ + {message ?? defaultMessage} + {children} +
+ ) +} + +NodeStatus.displayName = 'NodeStatus' + +export default React.memo(NodeStatus) diff --git a/web/app/components/workflow/nodes/trigger-plugin/node.tsx b/web/app/components/workflow/nodes/trigger-plugin/node.tsx index f2ae1baf97..446781a7e3 100644 --- a/web/app/components/workflow/nodes/trigger-plugin/node.tsx +++ b/web/app/components/workflow/nodes/trigger-plugin/node.tsx @@ -1,7 +1,10 @@ +import NodeStatus, { NodeStatusEnum } from '@/app/components/base/node-status' +import { INVALID_SUBSCRIPTION_ID } from '@/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry' +import type { NodeProps } from '@/app/components/workflow/types' import type { FC } from 'react' import React from 'react' +import { useTranslation } from 'react-i18next' import type { PluginTriggerNodeType } from './types' -import type { NodeProps } from '@/app/components/workflow/types' import useConfig from './use-config' const formatConfigValue = (rawValue: any): string => { @@ -38,9 +41,10 @@ const Node: FC> = ({ data, }) => { const { isAuthenticated } = useConfig(id, data) - const { config = {} } = data + const { config = {}, subscription_id } = data const configKeys = Object.keys(config) + const { t } = useTranslation() // Only show config when authenticated and has config values if (!isAuthenticated || configKeys.length === 0) return null @@ -48,7 +52,8 @@ const Node: FC> = ({ return (
- {configKeys.map((key, index) => ( + {(!subscription_id || subscription_id === INVALID_SUBSCRIPTION_ID) && } + {subscription_id && subscription_id !== INVALID_SUBSCRIPTION_ID && configKeys.map((key, index) => (