-
key
-
value
+
{t(`${i18nPrefix}.key`)}
+
+
{t(`${i18nPrefix}.value`)}
+
+
+
+
+
+
{
list.map((item, index) => (
diff --git a/web/app/components/workflow/nodes/http/components/key-value/input-item.tsx b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx
similarity index 84%
rename from web/app/components/workflow/nodes/http/components/key-value/input-item.tsx
rename to web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx
index e5c5e9316f..bb3d987a31 100644
--- a/web/app/components/workflow/nodes/http/components/key-value/input-item.tsx
+++ b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx
@@ -10,6 +10,7 @@ type Props = {
onChange: (newValue: string) => void
hasRemove: boolean
onRemove?: () => void
+ placeholder?: string
}
const InputItem: FC
= ({
@@ -18,7 +19,9 @@ const InputItem: FC = ({
onChange,
hasRemove,
onRemove,
+ placeholder,
}) => {
+ const hasValue = !!value
const [isEdit, {
setTrue: setIsEditTrue,
setFalse: setIsEditFalse,
@@ -39,18 +42,19 @@ const InputItem: FC = ({
? (
)
:
-
{value}
+
{hasValue ? value : placeholder}
{hasRemove && !isEdit && (
= ({
isLastItem,
onAdd,
}) => {
+ const { t } = useTranslation()
+
const handleChange = useCallback((key: string) => {
return (value: string) => {
const newPayload = produce(payload, (draft: any) => {
@@ -46,7 +51,9 @@ const KeyValueItem: FC = ({
className='pr-2.5'
value={payload.key}
onChange={handleChange('key')}
- hasRemove={false} />
+ hasRemove={false}
+ placeholder={t(`${i18nPrefix}.key`)!}
+ />
= ({
onChange={handleChange('value')}
hasRemove={!readonly && canRemove}
onRemove={onRemove}
+ placeholder={t(`${i18nPrefix}.value`)!}
/>
diff --git a/web/app/components/workflow/nodes/http/hooks/use-key-value-list.ts b/web/app/components/workflow/nodes/http/hooks/use-key-value-list.ts
index 334b1040b8..767fe7667e 100644
--- a/web/app/components/workflow/nodes/http/hooks/use-key-value-list.ts
+++ b/web/app/components/workflow/nodes/http/hooks/use-key-value-list.ts
@@ -16,7 +16,7 @@ const useKeyValueList = (value: string) => {
}, [])
const [isKeyValueEdit, {
toggle: toggleIsKeyValueEdit,
- }] = useBoolean(true)
+ }] = useBoolean(false)
return {
list: list.length === 0 ? [{ key: '', value: '' }] : list, // no item can not add new item
setList,
diff --git a/web/app/components/workflow/nodes/http/panel.tsx b/web/app/components/workflow/nodes/http/panel.tsx
index 56dbb3d561..cd5dc139a7 100644
--- a/web/app/components/workflow/nodes/http/panel.tsx
+++ b/web/app/components/workflow/nodes/http/panel.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import useConfig from './use-config'
import { mockData } from './mock'
import ApiInput from './components/api-input'
-import KeyValueList from './components/key-value/list'
+import KeyValue from './components/key-value'
import VarList from '@/app/components/workflow/nodes/_base/components/variable/var-list'
import Field from '@/app/components/workflow/nodes/_base/components/field'
import AddButton from '@/app/components/base/button/add-button'
@@ -25,6 +25,8 @@ const Panel: FC = () => {
headers,
setHeaders,
addHeader,
+ isHeaderKeyValueEdit,
+ toggleIsHeaderKeyValueEdit,
} = useConfig(mockData)
return (
@@ -56,11 +58,13 @@ const Panel: FC = () => {