fix: add input instance id

This commit is contained in:
Joel 2024-04-03 16:46:24 +08:00
parent 088842dcdb
commit add7bdc877
5 changed files with 12 additions and 0 deletions

View File

@ -64,6 +64,7 @@ const ApiInput: FC<Props> = ({
/>
<Input
instanceId='http-api-url'
className={cn(isFocus ? 'shadow-xs bg-gray-50 border-gray-300' : 'bg-gray-100 border-gray-100', 'w-0 grow rounded-lg px-3 py-[6px] border')}
value={url}
onChange={onUrlChange}

View File

@ -127,6 +127,7 @@ const EditBody: FC<Props> = ({
{type === BodyType.rawText && (
<InputWithVar
instanceId={'http-body-raw'}
title={<div className='uppercase'>Raw text</div>}
onChange={handleBodyValueChange}
value={payload.data}
@ -138,6 +139,7 @@ const EditBody: FC<Props> = ({
{type === BodyType.json && (
<InputWithVar
instanceId={'http-body-json'}
title='JSON'
value={payload.data}
onChange={handleBodyValueChange}

View File

@ -70,6 +70,7 @@ const KeyValueList: FC<Props> = ({
list.map((item, index) => (
<KeyValueItem
key={item.id}
instanceId={item.id!}
nodeId={nodeId}
payload={item}
onChange={handleChange(index)}

View File

@ -10,6 +10,7 @@ import type { Var } from '@/app/components/workflow/types'
import { VarType } from '@/app/components/workflow/types'
type Props = {
className?: string
instanceId?: string
nodeId: string
value: string
onChange: (newValue: string) => void
@ -21,6 +22,7 @@ type Props = {
const InputItem: FC<Props> = ({
className,
instanceId,
nodeId,
value,
onChange,
@ -51,6 +53,7 @@ const InputItem: FC<Props> = ({
{(!readOnly)
? (
<Input
instanceId={instanceId}
className={cn(isFocus ? 'bg-gray-100' : 'bg-width', 'w-0 grow px-3 py-1')}
value={value}
onChange={onChange}
@ -67,6 +70,7 @@ const InputItem: FC<Props> = ({
{!hasValue && <div className='text-gray-300 text-xs font-normal'>{placeholder}</div>}
{hasValue && (
<Input
instanceId={instanceId}
className={cn(isFocus ? 'shadow-xs bg-gray-50 border-gray-300' : 'bg-gray-100 border-gray-100', 'w-0 grow rounded-lg px-3 py-[6px] border')}
value={value}
onChange={onChange}

View File

@ -10,6 +10,7 @@ import InputItem from './input-item'
const i18nPrefix = 'workflow.nodes.http'
type Props = {
instanceId: string
className?: string
nodeId: string
readonly: boolean
@ -22,6 +23,7 @@ type Props = {
}
const KeyValueItem: FC<Props> = ({
instanceId,
className,
nodeId,
readonly,
@ -50,6 +52,7 @@ const KeyValueItem: FC<Props> = ({
<div className={cn(className, 'group flex items-start h-min-7 border-t border-gray-200')}>
<div className='w-1/2 h-full border-r border-gray-200'>
<InputItem
instanceId={`http-key-${instanceId}`}
nodeId={nodeId}
value={payload.key}
onChange={handleChange('key')}
@ -60,6 +63,7 @@ const KeyValueItem: FC<Props> = ({
</div>
<div className='w-1/2 h-full'>
<InputItem
instanceId={`http-value-${instanceId}`}
nodeId={nodeId}
value={payload.value}
onChange={handleChange('value')}