From 7d4bb45f94dbea5bf2038bb4780592172296d9a0 Mon Sep 17 00:00:00 2001 From: lyzno1 Date: Thu, 30 Oct 2025 16:55:07 +0800 Subject: [PATCH] fix(workflow): align plugin lock overlay with install availability --- web/app/components/workflow/nodes/_base/node.tsx | 13 ++++++++++++- .../components/workflow/nodes/data-source/node.tsx | 8 +++++--- web/app/components/workflow/nodes/tool/node.tsx | 10 ++++++---- .../workflow/nodes/trigger-plugin/node.tsx | 10 ++++++---- web/app/components/workflow/types.ts | 1 + 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/node.tsx b/web/app/components/workflow/nodes/_base/node.tsx index d97a6a5118..1d3cd920ef 100644 --- a/web/app/components/workflow/nodes/_base/node.tsx +++ b/web/app/components/workflow/nodes/_base/node.tsx @@ -150,7 +150,7 @@ const BaseNode: FC = ({ 'relative flex rounded-2xl border', showSelectedBorder ? 'border-components-option-card-option-selected-border' : 'border-transparent', data._waitingRun && 'opacity-70', - data._dimmed && 'opacity-30', + data._pluginInstallLocked && 'cursor-not-allowed', )} ref={nodeRef} style={{ @@ -158,6 +158,17 @@ const BaseNode: FC = ({ height: (data.type === BlockEnum.Iteration || data.type === BlockEnum.Loop) ? data.height : 'auto', }} > + {(data._dimmed || data._pluginInstallLocked) && ( +
+ )} { data.type === BlockEnum.DataSource && (
diff --git a/web/app/components/workflow/nodes/data-source/node.tsx b/web/app/components/workflow/nodes/data-source/node.tsx index 354758074b..b490aea2a9 100644 --- a/web/app/components/workflow/nodes/data-source/node.tsx +++ b/web/app/components/workflow/nodes/data-source/node.tsx @@ -19,17 +19,19 @@ const Node: FC> = ({ shouldDim, } = useNodePluginInstallation(data) const { handleNodeDataUpdate } = useNodeDataUpdate() + const shouldLock = !isChecking && isMissing && canInstall && Boolean(uniqueIdentifier) useEffect(() => { - if (data._dimmed === shouldDim) + if (data._pluginInstallLocked === shouldLock && data._dimmed === shouldDim) return handleNodeDataUpdate({ id, data: { + _pluginInstallLocked: shouldLock, _dimmed: shouldDim, }, }) - }, [data._dimmed, handleNodeDataUpdate, id, shouldDim]) + }, [data._pluginInstallLocked, data._dimmed, handleNodeDataUpdate, id, shouldDim, shouldLock]) const showInstallButton = !isChecking && isMissing && canInstall && uniqueIdentifier @@ -38,7 +40,7 @@ const Node: FC> = ({ return (
-
+
> = ({ } = useNodePluginInstallation(data) const showInstallButton = !isChecking && isMissing && canInstall && uniqueIdentifier const { handleNodeDataUpdate } = useNodeDataUpdate() + const shouldLock = !isChecking && isMissing && canInstall && Boolean(uniqueIdentifier) useEffect(() => { - if (data._dimmed === shouldDim) + if (data._pluginInstallLocked === shouldLock && data._dimmed === shouldDim) return handleNodeDataUpdate({ id, data: { + _pluginInstallLocked: shouldLock, _dimmed: shouldDim, }, }) - }, [data._dimmed, handleNodeDataUpdate, id, shouldDim]) + }, [data._pluginInstallLocked, data._dimmed, handleNodeDataUpdate, id, shouldDim, shouldLock]) const hasConfigs = toolConfigs.length > 0 @@ -43,7 +45,7 @@ const Node: FC> = ({ return (
{showInstallButton && ( -
+
> = ({
)} {hasConfigs && ( -
+
{toolConfigs.map((key, index) => (
diff --git a/web/app/components/workflow/nodes/trigger-plugin/node.tsx b/web/app/components/workflow/nodes/trigger-plugin/node.tsx index 0aa7f656e2..0eee4cb8b4 100644 --- a/web/app/components/workflow/nodes/trigger-plugin/node.tsx +++ b/web/app/components/workflow/nodes/trigger-plugin/node.tsx @@ -55,17 +55,19 @@ const Node: FC> = ({ } = useNodePluginInstallation(data) const { handleNodeDataUpdate } = useNodeDataUpdate() const showInstallButton = !isChecking && isMissing && canInstall && uniqueIdentifier + const shouldLock = !isChecking && isMissing && canInstall && Boolean(uniqueIdentifier) useEffect(() => { - if (data._dimmed === shouldDim) + if (data._pluginInstallLocked === shouldLock && data._dimmed === shouldDim) return handleNodeDataUpdate({ id, data: { + _pluginInstallLocked: shouldLock, _dimmed: shouldDim, }, }) - }, [data._dimmed, handleNodeDataUpdate, id, shouldDim]) + }, [data._pluginInstallLocked, data._dimmed, handleNodeDataUpdate, id, shouldDim, shouldLock]) const { t } = useTranslation() @@ -76,7 +78,7 @@ const Node: FC> = ({ return (
{showInstallButton && ( -
+
> = ({ />
)} -
+
{!isValidSubscription && } {isValidSubscription && configKeys.map((key, index) => (
= { subscription_id?: string provider_id?: string _dimmed?: boolean + _pluginInstallLocked?: boolean } & T & Partial export type CommonEdgeType = {