diff --git a/web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx index 6888a88533..235593d7f3 100644 --- a/web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx +++ b/web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx @@ -280,7 +280,7 @@ const GenericTable: FC = ({ return (
-

{title}

+

{title}

{showPlaceholder ? ( diff --git a/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx index ee1a663cb4..21b7c5bead 100644 --- a/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx +++ b/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx @@ -14,8 +14,6 @@ type ParameterTableProps = { onChange: (params: WebhookParameter[]) => void readonly?: boolean placeholder?: string - showType?: boolean - isRequestBody?: boolean // Special handling for request body parameters contentType?: string } @@ -25,37 +23,33 @@ const ParameterTable: FC = ({ onChange, readonly, placeholder, - showType = true, - isRequestBody = false, contentType, }) => { const { t } = useTranslation() // Memoize typeOptions to prevent unnecessary re-renders that cause SimpleSelect state resets const typeOptions = useMemo(() => - createParameterTypeOptions(contentType, isRequestBody), - [contentType, isRequestBody], + createParameterTypeOptions(contentType), + [contentType], ) // Define columns based on component type - matching prototype design const columns: ColumnConfig[] = [ { key: 'key', - title: isRequestBody ? 'Name' : 'Variable Name', + title: 'Variable Name', type: 'input', width: 'flex-1', - placeholder: isRequestBody ? 'Name' : 'Variable Name', + placeholder: 'Variable Name', + }, + { + key: 'type', + title: 'Type', + type: 'select', + width: 'w-[120px]', + placeholder: 'Type', + options: typeOptions, }, - ...(showType - ? [{ - key: 'type', - title: 'Type', - type: (isRequestBody ? 'select' : 'input') as ColumnConfig['type'], - width: 'w-[120px]', - placeholder: 'Type', - options: isRequestBody ? typeOptions : undefined, - }] - : []), { key: 'required', title: 'Required', @@ -70,7 +64,7 @@ const ParameterTable: FC = ({ // Empty row template for new rows const emptyRowData: GenericTableRow = { key: '', - type: isRequestBody ? defaultTypeValue : '', + type: defaultTypeValue, required: false, } @@ -83,8 +77,8 @@ const ParameterTable: FC = ({ const handleDataChange = (data: GenericTableRow[]) => { // For text/plain, enforce single text body semantics: keep only first non-empty row and force string type // For application/octet-stream, enforce single file body semantics: keep only first non-empty row and force file type - const isTextPlain = isRequestBody && (contentType || '').toLowerCase() === 'text/plain' - const isOctetStream = isRequestBody && (contentType || '').toLowerCase() === 'application/octet-stream' + const isTextPlain = (contentType || '').toLowerCase() === 'text/plain' + const isOctetStream = (contentType || '').toLowerCase() === 'application/octet-stream' const normalized = data .filter(row => typeof row.key === 'string' && (row.key as string).trim() !== '') diff --git a/web/app/components/workflow/nodes/trigger-webhook/panel.tsx b/web/app/components/workflow/nodes/trigger-webhook/panel.tsx index 581a0514b1..52b0066adf 100644 --- a/web/app/components/workflow/nodes/trigger-webhook/panel.tsx +++ b/web/app/components/workflow/nodes/trigger-webhook/panel.tsx @@ -158,7 +158,6 @@ const Panel: FC> = ({ parameters={inputs.params} onChange={handleParamsChange} placeholder={t(`${i18nPrefix}.noQueryParameters`)} - showType={false} /> {/* Header Parameters */} @@ -175,8 +174,6 @@ const Panel: FC> = ({ parameters={inputs.body} onChange={handleBodyChange} placeholder={t(`${i18nPrefix}.noBodyParameters`)} - showType={true} - isRequestBody={true} contentType={inputs.content_type} /> diff --git a/web/app/components/workflow/nodes/trigger-webhook/utils/parameter-type-utils.ts b/web/app/components/workflow/nodes/trigger-webhook/utils/parameter-type-utils.ts index 14b41b1349..10f61a5e22 100644 --- a/web/app/components/workflow/nodes/trigger-webhook/utils/parameter-type-utils.ts +++ b/web/app/components/workflow/nodes/trigger-webhook/utils/parameter-type-utils.ts @@ -26,6 +26,7 @@ const TYPE_DISPLAY_NAMES: Record = { 'array[file]': 'Array[File]', [VarType.any]: 'Any', 'array[any]': 'Array[Any]', + [VarType.integer]: 'Integer', } as const // Content type configurations @@ -98,11 +99,9 @@ export const getParameterTypeDisplayName = (type: VarType): string => { * Gets available parameter types based on content type * Provides context-aware type filtering for different webhook content types */ -export const getAvailableParameterTypes = (contentType?: string, isRequestBody = false): VarType[] => { - if (!isRequestBody) { - // Query parameters and headers are always strings - return [VarType.string] - } +export const getAvailableParameterTypes = (contentType?: string): VarType[] => { + if (!contentType) + return [VarType.string, VarType.number, VarType.boolean] const normalizedContentType = (contentType || '').toLowerCase() const configKey = normalizedContentType in CONTENT_TYPE_CONFIGS @@ -116,8 +115,8 @@ export const getAvailableParameterTypes = (contentType?: string, isRequestBody = /** * Creates type options for UI select components */ -export const createParameterTypeOptions = (contentType?: string, isRequestBody = false) => { - const availableTypes = getAvailableParameterTypes(contentType, isRequestBody) +export const createParameterTypeOptions = (contentType?: string) => { + const availableTypes = getAvailableParameterTypes(contentType) return availableTypes.map(type => ({ name: getParameterTypeDisplayName(type),