diff --git a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeHttp/index.tsx b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeHttp/index.tsx index 2c50d3c3e462..1f8dd32c8285 100644 --- a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeHttp/index.tsx +++ b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeHttp/index.tsx @@ -81,6 +81,9 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({ const { t } = useTranslation(); const { toast } = useToast(); const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode); + const nodeList = useContextSelector(WorkflowContext, (v) => v.nodeList); + const edges = useContextSelector(WorkflowContext, (v) => v.edges); + const { appDetail } = useContextSelector(AppContext, (v) => v); const { isOpen: isOpenCurl, onOpen: onOpenCurl, onClose: onCloseCurl } = useDisclosure(); @@ -91,19 +94,18 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({ (item) => item.key === NodeInputKeyEnum.httpReqUrl ) as FlowNodeInputItemType; - const onChangeUrl = (e: React.ChangeEvent) => { + const onChangeUrl = (value: string) => { onChangeNode({ nodeId, type: 'updateInput', key: NodeInputKeyEnum.httpReqUrl, value: { ...requestUrl, - value: e.target.value + value } }); }; - const onBlurUrl = (e: React.ChangeEvent) => { - const val = e.target.value; + const onBlurUrl = (val: string) => { // 拆分params和url const url = val.split('?')[0]; const params = val.split('?')[1]; @@ -154,6 +156,16 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({ } }; + const variables = useCreation(() => { + return getEditorVariables({ + nodeId, + nodeList, + edges, + appDetail, + t + }); + }, [nodeId, nodeList, edges, appDetail, t]); + return ( @@ -166,7 +178,7 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({ - + ml={2} + > + + {isOpenCurl && }