diff --git a/web/app/components/workflow/nodes/list-filter/components/sub-variable-picker.tsx b/web/app/components/workflow/nodes/list-filter/components/sub-variable-picker.tsx index 5481992455..d9065c4928 100644 --- a/web/app/components/workflow/nodes/list-filter/components/sub-variable-picker.tsx +++ b/web/app/components/workflow/nodes/list-filter/components/sub-variable-picker.tsx @@ -1,6 +1,7 @@ 'use client' import type { FC } from 'react' import React, { useCallback } from 'react' +import { useTranslation } from 'react-i18next' import { SUB_VARIABLES } from '../../if-else/default' import type { Item } from '@/app/components/base/select' import { SimpleSelect as Select } from '@/app/components/base/select' @@ -18,6 +19,7 @@ const SubVariablePicker: FC = ({ onChange, className, }) => { + const { t } = useTranslation() const subVarOptions = SUB_VARIABLES.map(item => ({ value: item, name: item, @@ -46,7 +48,7 @@ const SubVariablePicker: FC = ({ defaultValue={value} onSelect={handleChange} className='!text-[13px]' - placeholder='Select sub variable key' + placeholder={t('workflow.nodes.listFilter.selectVariableKeyPlaceholder')!} optionClassName='pl-4 pr-5 py-0' renderOption={renderOption} /> diff --git a/web/app/components/workflow/nodes/list-filter/panel.tsx b/web/app/components/workflow/nodes/list-filter/panel.tsx index 1e8eb3eab6..cca58dc0af 100644 --- a/web/app/components/workflow/nodes/list-filter/panel.tsx +++ b/web/app/components/workflow/nodes/list-filter/panel.tsx @@ -32,6 +32,7 @@ const Panel: FC> = ({ handleFilterChange, handleLimitChange, handleOrderByEnabledChange, + handleOrderByKeyChange, handleOrderByTypeChange, } = useConfig(id, data) @@ -81,7 +82,7 @@ const Panel: FC> = ({
{ }} + onChange={handleOrderByKeyChange} />
)} diff --git a/web/app/components/workflow/nodes/list-filter/use-config.ts b/web/app/components/workflow/nodes/list-filter/use-config.ts index fa9dd9c028..3642b4235a 100644 --- a/web/app/components/workflow/nodes/list-filter/use-config.ts +++ b/web/app/components/workflow/nodes/list-filter/use-config.ts @@ -106,6 +106,13 @@ const useConfig = (id: string, payload: ListFilterNodeType) => { setInputs(newInputs) }, [inputs, setInputs]) + const handleOrderByKeyChange = useCallback((key: string) => { + const newInputs = produce(inputs, (draft) => { + draft.order_by.key = key + }) + setInputs(newInputs) + }, [inputs, setInputs]) + const handleOrderByTypeChange = useCallback((type: OrderBy) => { return () => { const newInputs = produce(inputs, (draft) => { @@ -126,6 +133,7 @@ const useConfig = (id: string, payload: ListFilterNodeType) => { handleFilterChange, handleLimitChange, handleOrderByEnabledChange, + handleOrderByKeyChange, handleOrderByTypeChange, } } diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index 4ff7bf452f..3ca5f1fbcb 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -562,6 +562,7 @@ const translation = { listFilter: { inputVar: 'Input Variable', filterCondition: 'Filter Condition', + selectVariableKeyPlaceholder: 'Select sub variable key', limit: 'Limit', orderBy: 'Order by', asc: 'ASC', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 03c43d0fda..38278d55f2 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -562,6 +562,7 @@ const translation = { listFilter: { inputVar: '输入变量', filterCondition: '过滤条件', + selectVariableKeyPlaceholder: '选择子变量的 Key', limit: '限制', orderBy: '排序', asc: '升序',