diff --git a/web/app/components/workflow/nodes/http/components/api-input.tsx b/web/app/components/workflow/nodes/http/components/api-input.tsx index 9f1136527f..70a750db5b 100644 --- a/web/app/components/workflow/nodes/http/components/api-input.tsx +++ b/web/app/components/workflow/nodes/http/components/api-input.tsx @@ -1,6 +1,6 @@ 'use client' import type { FC } from 'react' -import React, { useEffect, useRef, useState } from 'react' +import React, { useState } from 'react' import cn from 'classnames' import { useTranslation } from 'react-i18next' import { Method } from '../types' @@ -38,7 +38,6 @@ const ApiInput: FC = ({ }) => { const { t } = useTranslation() - const inputRef = useRef(null) const [isFocus, setIsFocus] = useState(false) const availableVarList = useAvailableVarList(nodeId, { onlyLeafNodeVar: false, @@ -47,10 +46,6 @@ const ApiInput: FC = ({ }, }) - useEffect(() => { - if (isFocus) - inputRef.current?.focus() - }, [isFocus]) return (
void onAdd: () => void - isKeyValueEdit: boolean - toggleKeyValueEdit: () => void + // toggleKeyValueEdit: () => void } const KeyValueList: FC = ({ @@ -19,47 +17,40 @@ const KeyValueList: FC = ({ list, onChange, onAdd, - isKeyValueEdit, - toggleKeyValueEdit, + // toggleKeyValueEdit, }) => { - const handleBulkValueChange = useCallback((value: string) => { - const newList = value.split('\n').map((item) => { - const [key, value] = item.split(':') - return { - key: key ? key.trim() : '', - value: value ? value.trim() : '', - } - }) - onChange(newList) - }, [onChange]) + // const handleBulkValueChange = useCallback((value: string) => { + // const newList = value.split('\n').map((item) => { + // const [key, value] = item.split(':') + // return { + // key: key ? key.trim() : '', + // value: value ? value.trim() : '', + // } + // }) + // onChange(newList) + // }, [onChange]) - const bulkList = (() => { - const res = list.map((item) => { - if (!item.key && !item.value) - return '' - if (!item.value) - return item.key - return `${item.key}:${item.value}` - }).join('\n') - return res - })() - return ( - <> - {isKeyValueEdit - ? - : - } - - ) + // const bulkList = (() => { + // const res = list.map((item) => { + // if (!item.key && !item.value) + // return '' + // if (!item.value) + // return item.key + // return `${item.key}:${item.value}` + // }).join('\n') + // return res + // })() + return + // : } export default React.memo(KeyValueList) diff --git a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx index 528579f3d2..53c70b0c6a 100644 --- a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx +++ b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx @@ -5,8 +5,8 @@ import produce from 'immer' import { useTranslation } from 'react-i18next' import type { KeyValue } from '../../../types' import KeyValueItem from './item' -import TooltipPlus from '@/app/components/base/tooltip-plus' -import { EditList } from '@/app/components/base/icons/src/vender/solid/communication' +// import TooltipPlus from '@/app/components/base/tooltip-plus' +// import { EditList } from '@/app/components/base/icons/src/vender/solid/communication' const i18nPrefix = 'workflow.nodes.http' @@ -15,7 +15,7 @@ type Props = { list: KeyValue[] onChange: (newList: KeyValue[]) => void onAdd: () => void - onSwitchToBulkEdit: () => void + // onSwitchToBulkEdit: () => void } const KeyValueList: FC = ({ @@ -23,7 +23,7 @@ const KeyValueList: FC = ({ list, onChange, onAdd, - onSwitchToBulkEdit, + // onSwitchToBulkEdit, }) => { const { t } = useTranslation() @@ -51,7 +51,7 @@ const KeyValueList: FC = ({
{t(`${i18nPrefix}.key`)}
{t(`${i18nPrefix}.value`)}
- {!readonly && ( + {/* {!readonly && ( @@ -61,7 +61,7 @@ const KeyValueList: FC = ({ >
- )} + )} */}
{ diff --git a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx index 6c30a6e284..239b5ff5c3 100644 --- a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx +++ b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx @@ -1,10 +1,10 @@ 'use client' import type { FC } from 'react' -import React, { useCallback } from 'react' -import { useBoolean } from 'ahooks' +import React, { useCallback, useState } from 'react' import cn from 'classnames' +import { useTranslation } from 'react-i18next' import RemoveButton from '@/app/components/workflow/nodes/_base/components/remove-button' -import SupportVarInput from '@/app/components/workflow/nodes/_base/components/support-var-input' +import Input from '@/app/components/workflow/nodes/_base/components/input-support-select-var' type Props = { className?: string @@ -25,15 +25,11 @@ const InputItem: FC = ({ placeholder, readOnly, }) => { - const hasValue = !!value - const [isEdit, { - setTrue: setIsEditTrue, - setFalse: setIsEditFalse, - }] = useBoolean(false) + const { t } = useTranslation() - const handleChange = useCallback((e: React.ChangeEvent) => { - onChange(e.target.value) - }, [onChange]) + const hasValue = !!value + + const [isFocus, setIsFocus] = useState(false) const handleRemove = useCallback((e: React.MouseEvent) => { e.stopPropagation() @@ -41,34 +37,47 @@ const InputItem: FC = ({ }, [onRemove]) return ( -
- {(isEdit && !readOnly) +
+ {(!readOnly) ? ( - + ) :
{!hasValue &&
{placeholder}
} {hasValue && ( - )} - {hasRemove && !isEdit && ( + {hasRemove && !isFocus && ( = ({ return ( // group class name is for hover row show remove button -
+
= ({
> = ({ headers, setHeaders, addHeader, - isHeaderKeyValueEdit, - toggleIsHeaderKeyValueEdit, params, setParams, addParam, - isParamKeyValueEdit, - toggleIsParamKeyValueEdit, setBody, isShowAuthorization, showAuthorization, @@ -110,8 +106,6 @@ const Panel: FC> = ({ onChange={setHeaders} onAdd={addHeader} readonly={readOnly} - isKeyValueEdit={isHeaderKeyValueEdit} - toggleKeyValueEdit={toggleIsHeaderKeyValueEdit} /> > = ({ onChange={setParams} onAdd={addParam} readonly={readOnly} - isKeyValueEdit={isParamKeyValueEdit} - toggleKeyValueEdit={toggleIsParamKeyValueEdit} />