diff --git a/web/app/components/workflow/nodes/http/components/key-value/index.tsx b/web/app/components/workflow/nodes/http/components/key-value/index.tsx index a400de521b..65fab16cac 100644 --- a/web/app/components/workflow/nodes/http/components/key-value/index.tsx +++ b/web/app/components/workflow/nodes/http/components/key-value/index.tsx @@ -6,6 +6,7 @@ import KeyValueEdit from './key-value-edit' type Props = { readonly: boolean + nodeId: string list: KeyValue[] onChange: (newList: KeyValue[]) => void onAdd: () => void @@ -14,6 +15,7 @@ type Props = { const KeyValueList: FC = ({ readonly, + nodeId, list, onChange, onAdd, @@ -42,6 +44,7 @@ const KeyValueList: FC = ({ // })() return void onAdd: () => void @@ -20,6 +21,7 @@ type Props = { const KeyValueList: FC = ({ readonly, + nodeId, list, onChange, onAdd, @@ -68,6 +70,7 @@ const KeyValueList: FC = ({ list.map((item, index) => ( void hasRemove: boolean @@ -18,6 +21,7 @@ type Props = { const InputItem: FC = ({ className, + nodeId, value, onChange, hasRemove, @@ -30,6 +34,12 @@ const InputItem: FC = ({ const hasValue = !!value const [isFocus, setIsFocus] = useState(false) + const availableVarList = useAvailableVarList(nodeId, { + onlyLeafNodeVar: false, + filterVar: (varPayload: Var) => { + return [VarType.string, VarType.number].includes(varPayload.type) + }, + }) const handleRemove = useCallback((e: React.MouseEvent) => { e.stopPropagation() @@ -55,9 +65,9 @@ const InputItem: FC = ({ value={value} onChange={onChange} readOnly={readOnly} - nodesOutputVars={[]} + nodesOutputVars={availableVarList} onFocusChange={setIsFocus} - placeholder={t('workflow.nodes.http.apiPlaceholder')!} + placeholder={t('workflow.nodes.http.insertVarPlaceholder')!} placeholderClassName='!leading-[21px]' /> ) @@ -71,9 +81,9 @@ const InputItem: FC = ({ value={value} onChange={onChange} readOnly={readOnly} - nodesOutputVars={[]} + nodesOutputVars={availableVarList} onFocusChange={setIsFocus} - placeholder={t('workflow.nodes.http.apiPlaceholder')!} + placeholder={t('workflow.nodes.http.insertVarPlaceholder')!} placeholderClassName='!leading-[21px]' /> )} diff --git a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/item.tsx b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/item.tsx index 5469cc6c12..27abed7f33 100644 --- a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/item.tsx +++ b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/item.tsx @@ -11,6 +11,7 @@ const i18nPrefix = 'workflow.nodes.http' type Props = { className?: string + nodeId: string readonly: boolean canRemove: boolean payload: KeyValue @@ -22,6 +23,7 @@ type Props = { const KeyValueItem: FC = ({ className, + nodeId, readonly, canRemove, payload, @@ -45,9 +47,10 @@ const KeyValueItem: FC = ({ return ( // group class name is for hover row show remove button -
+
= ({
> = ({ title={t(`${i18nPrefix}.headers`)} > > = ({ title={t(`${i18nPrefix}.params`)} >