refactor(web): migrate webhook table input (#41612)

This commit is contained in:
yyh 2026-09-02 01:44:52 +00:00 committed by GitHub
parent 18ac946e2b
commit ea98d38c3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 10 deletions

View File

@ -4335,11 +4335,6 @@
"count": 4
}
},
"web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx": {
"no-restricted-imports": {
"count": 1
}
},
"web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx": {
"typescript/no-non-null-asserted-optional-chain": {
"count": 1

View File

@ -82,7 +82,9 @@ describe('GenericTable', () => {
/>,
)
fireEvent.change(screen.getByRole('textbox'), { target: { value: 'my key' } })
fireEvent.change(screen.getByRole('textbox', { name: 'Name' }), {
target: { value: 'my key' },
})
expect(onChange).toHaveBeenLastCalledWith([{ name: 'my_key', enabled: false }])
})
@ -102,7 +104,7 @@ describe('GenericTable', () => {
/>,
)
const inputs = screen.getAllByRole('textbox')
const inputs = screen.getAllByRole('textbox', { name: 'Name' })
expect(inputs).toHaveLength(3)
expect(screen.getAllByRole('button', { name: 'Delete row' })).toHaveLength(2)

View File

@ -2,6 +2,7 @@
import type { FC, ReactNode } from 'react'
import { Checkbox } from '@langgenius/dify-ui/checkbox'
import { cn } from '@langgenius/dify-ui/cn'
import { Input } from '@langgenius/dify-ui/input'
import {
Select,
SelectItem,
@ -16,7 +17,6 @@ import {
import { RiDeleteBinLine } from '@remixicon/react'
import * as React from 'react'
import { useCallback, useMemo } from 'react'
import Input from '@/app/components/base/input'
import { replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'
// Tiny utility to judge whether a cell value is effectively present
@ -110,6 +110,7 @@ const renderInputCell = (
) => {
return (
<Input
aria-label={column.title}
value={(value as string) || ''}
onChange={(e) => {
if (column.key === 'key' || column.key === 'name')
@ -124,9 +125,8 @@ const renderInputCell = (
}}
placeholder={column.placeholder}
disabled={readonly}
wrapperClassName="w-full min-w-0"
className={cn(
'h-6 rounded-none border-0 bg-transparent p-0 shadow-none',
'h-6 min-w-0 rounded-none border-0 bg-transparent p-0 shadow-none',
'hover:border-transparent hover:bg-transparent focus:border-transparent focus:bg-transparent',
'system-sm-regular text-text-secondary placeholder:text-text-quaternary',
)}