From 307cbf1d9fc92aa3a1f47ecc10646c8264bd8341 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 23 Feb 2024 16:15:45 +0800 Subject: [PATCH] feat: input no var tip --- .../workflow/nodes/start/components/var-list.tsx | 12 ++++++++++++ web/i18n/en-US/workflow.ts | 1 + web/i18n/zh-Hans/workflow.ts | 1 + 3 files changed, 14 insertions(+) diff --git a/web/app/components/workflow/nodes/start/components/var-list.tsx b/web/app/components/workflow/nodes/start/components/var-list.tsx index 033da3da35..f5cf044a70 100644 --- a/web/app/components/workflow/nodes/start/components/var-list.tsx +++ b/web/app/components/workflow/nodes/start/components/var-list.tsx @@ -2,8 +2,10 @@ import type { FC } from 'react' import React, { useCallback } from 'react' import produce from 'immer' +import { useTranslation } from 'react-i18next' import VarItem from './var-item' import type { InputVar } from '@/app/components/workflow/types' + type Props = { readonly: boolean list: InputVar[] @@ -15,6 +17,8 @@ const VarList: FC = ({ list, onChange, }) => { + const { t } = useTranslation() + const handleVarNameChange = useCallback((index: number) => { return (payload: InputVar) => { const newList = produce(list, (draft) => { @@ -33,6 +37,14 @@ const VarList: FC = ({ } }, [list, onChange]) + if (list.length === 0) { + return ( +
+ {t('workflow.nodes.start.noVarTip')} +
+ ) + } + return (
{list.map((item, index) => ( diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index ca8118b1a3..bfb678238c 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -17,6 +17,7 @@ const translation = { }, files: 'File list', }, + noVarTip: 'Set inputs that can be used in the Workflow', }, end: { outputs: 'Outputs', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 5ecd764db7..abc3afa7d3 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -16,6 +16,7 @@ const translation = { }, files: '文件列表', }, + noVarTip: '设置的输入可在工作流程中使用', }, end: { outputs: '输出',