From 0fea760143eb1b78835db6c7d42c7c048eee3547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=9E=E6=B3=95=E6=93=8D=E4=BD=9C?= Date: Thu, 16 Apr 2026 14:06:57 +0800 Subject: [PATCH] fix: http node key value type dropdown (#35304) --- .../nodes/http/__tests__/integration.spec.tsx | 33 ++++++++++++- .../key-value/key-value-edit/item.tsx | 46 +++++++++++++------ web/eslint-suppressions.json | 3 -- 3 files changed, 63 insertions(+), 19 deletions(-) diff --git a/web/app/components/workflow/nodes/http/__tests__/integration.spec.tsx b/web/app/components/workflow/nodes/http/__tests__/integration.spec.tsx index 99d240c6d6..93a4d08c3d 100644 --- a/web/app/components/workflow/nodes/http/__tests__/integration.spec.tsx +++ b/web/app/components/workflow/nodes/http/__tests__/integration.spec.tsx @@ -495,8 +495,8 @@ describe('http path', () => { ) fireEvent.change(screen.getAllByDisplayValue('alice')[0], { target: { value: 'bob' } }) - await user.click(screen.getByText('text')) - await user.click(screen.getByText('file')) + await user.click(screen.getAllByRole('combobox', { name: 'workflow.nodes.http.type' })[0]!) + await user.click(screen.getByRole('option', { name: /file/i })) expect(onChange).toHaveBeenCalled() }) @@ -558,6 +558,35 @@ describe('http path', () => { expect(onRemove).toHaveBeenCalled() }) + it('should show the full file-type menu and update the row type selection', async () => { + const user = userEvent.setup() + const onChange = vi.fn() + render( + , + ) + + await user.click(screen.getByRole('combobox', { name: 'workflow.nodes.http.type' })) + + const fileOption = screen.getByRole('option', { name: /file/i }) + expect(screen.getByRole('option', { name: /text/i })).toBeInTheDocument() + expect(fileOption.closest('.h-7')).toBeNull() + + await user.click(fileOption) + + expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ type: 'file' })) + }) + it('should update the raw-text body payload', () => { const onChange = vi.fn() render( 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 f2fc2e9e1c..36e0fccbff 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 @@ -7,7 +7,15 @@ import { produce } from 'immer' import * as React from 'react' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { PortalSelect } from '@/app/components/base/select' +import { + Select, + SelectContent, + SelectItem, + SelectItemIndicator, + SelectItemText, + SelectTrigger, + SelectValue, +} from '@/app/components/base/ui/select' import { VarType } from '@/app/components/workflow/types' import VarReferencePicker from '../../../../_base/components/variable/var-reference-picker' import InputItem from './input-item' @@ -80,7 +88,7 @@ const KeyValueItem: FC = ({ return ( // group class name is for hover row show remove button -
+
{!keyNotSupportVar ? ( @@ -105,18 +113,28 @@ const KeyValueItem: FC = ({
{isSupportFile && (
- handleChange('type')(item.value as string)} - items={[ - { name: 'text', value: 'text' }, - { name: 'file', value: 'file' }, - ]} - readonly={readonly} - triggerClassName="rounded-none h-7 text-text-primary" - triggerClassNameFn={isOpen => isOpen ? 'bg-state-base-hover' : 'bg-transparent'} - popupClassName="w-[80px] h-7" - /> +
)}