From 81353538e57c02f712e5ca65f57128e492ff6e1a Mon Sep 17 00:00:00 2001 From: zhaoying Date: Mon, 2 Mar 2026 17:26:24 +0800 Subject: [PATCH] feat(web): http node config support editor --- .../Workflow/components/Editor/index.tsx | 21 ++++++----- .../Properties/HttpRequest/EditableTable.tsx | 35 +++++++++++-------- .../Properties/HttpRequest/index.tsx | 11 +++--- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/web/src/views/Workflow/components/Editor/index.tsx b/web/src/views/Workflow/components/Editor/index.tsx index 60da03a7..5e376cc8 100644 --- a/web/src/views/Workflow/components/Editor/index.tsx +++ b/web/src/views/Workflow/components/Editor/index.tsx @@ -30,7 +30,8 @@ export interface LexicalEditorProps { lineHeight?: number; size?: 'default' | 'small'; type?: 'input' | 'textarea', - language?: 'string' | 'jinja2' + language?: 'string' | 'jinja2'; + className?: string; } const theme = { @@ -58,7 +59,9 @@ const Editor: FC =({ variant = 'borderless', size = 'default', type = 'textarea', - language = 'string' + language = 'string', + height, + className }) => { const [_count, setCount] = useState(0); const [enableJinja2, setEnableJinja2] = useState(false) @@ -156,23 +159,23 @@ const Editor: FC =({ }; const minheight = useMemo(() => { if (type === 'input') { - return `${size === 'small' ? 26 : 30}px` + return `${height ? height : size === 'small' ? 28 : 30}px` } - return `${size === 'small' ? 60 : 120}px` - }, [type, size]) + return `${height ? height : size === 'small' ? 60 : 120}px` + }, [type, size, height]) const fontSize = useMemo(() => { return `${size === 'small' ? 12 : 14}px` }, [size]) const lineHeight = useMemo(() => { - return `${size === 'small' ? 16 : 20}px` + return `${height ? height : size === 'small' ? 16 : 20}px` }, [size]) const placeHolderMinheight = useMemo(() => { - return `${size === 'small' ? 16 : 30}px` - }, [type, size]) + return `${height ? height : size === 'small' ? 16 : 30}px` + }, [type, size, height]) return ( -
+
= ({ +const EditableTable: FC = ({ parentName, title, options = [], @@ -37,6 +39,13 @@ const EditableTable: React.FC = ({ ...(typeOptions.length > 0 && { type: typeOptions[0].value }) }); + // Filter options based on boolean type if needed + const booleanFilterOptions = useMemo(() => { + return filterBooleanType + ? options.filter(option => option.dataType !== 'boolean') + : options + }, [options, filterBooleanType]) + const getColumns = (remove: (index: number) => void): TableProps['columns'] => { const hasType = typeOptions.length > 0; const cellClassName="rb:p-1!" @@ -49,14 +58,12 @@ const EditableTable: React.FC = ({ className: cellClassName, render: (_: any, __: TableRow, index: number) => ( - ) @@ -101,19 +108,17 @@ const EditableTable: React.FC = ({ {(form) => { const currentType = form.getFieldValue([...Array.isArray(parentName) ? parentName : [parentName], index, 'type']); const filteredOptions = currentType === 'file' - ? options.filter(option => option.dataType === 'file') - : options; + ? booleanFilterOptions.filter(option => option.dataType.includes('file')) + : booleanFilterOptions; return ( - ); diff --git a/web/src/views/Workflow/components/Properties/HttpRequest/index.tsx b/web/src/views/Workflow/components/Properties/HttpRequest/index.tsx index ae5aab01..840bff9a 100644 --- a/web/src/views/Workflow/components/Properties/HttpRequest/index.tsx +++ b/web/src/views/Workflow/components/Properties/HttpRequest/index.tsx @@ -1,8 +1,8 @@ /* * @Author: ZhaoYing * @Date: 2026-02-09 18:35:43 - * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-02-09 18:35:43 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-03-02 17:24:51 */ import { type FC, useRef, useState } from "react"; import { useTranslation } from 'react-i18next' @@ -13,7 +13,6 @@ import Editor from '../../Editor' import type { Suggestion } from '../../Editor/plugin/AutocompletePlugin' import AuthConfigModal from './AuthConfigModal' import type { AuthConfigModalRef, HttpRequestConfigForm } from './types' -import VariableSelect from "../VariableSelect"; import MessageEditor from '../MessageEditor' import EditableTable from './EditableTable' import { portTextAttrs } from '../../../constant' @@ -159,7 +158,7 @@ const HttpRequest: FC<{ options: Suggestion[]; selectedNode?: any; graphRef?: an vo.dataType === 'string' || vo.dataType === 'number')} + options={options.filter(vo => vo.dataType === 'string' || vo.dataType === 'number' || vo.dataType.includes('file'))} typeOptions={[ { label: 'text', value: 'text' }, { label: 'file', value: 'file' } @@ -201,10 +200,10 @@ const HttpRequest: FC<{ options: Suggestion[]; selectedNode?: any; graphRef?: an } {values?.body?.content_type === 'binary' && - vo.dataType.includes('file'))} - filterBooleanType={true} + type="input" size="small" />