timeout value validation

This commit is contained in:
JzoNg 2025-08-08 09:42:21 +08:00
parent f8a249de03
commit da211d3009
3 changed files with 18 additions and 2 deletions

View File

@ -54,6 +54,13 @@ const EmailConfigureModal = ({
})
return false
}
if (!/{{#url#}}/.test(body.trim())) {
Toast.notify({
type: 'error',
message: `body must contain one ${t('common.promptEditor.requestURL.item.title')}`,
})
return false
}
if (!recipients || (recipients.items.length === 0 && !recipients.whole_workspace)) {
Toast.notify({
type: 'error',

View File

@ -9,6 +9,7 @@ import {
PortalToFollowElemContent,
PortalToFollowElemTrigger,
} from '@/app/components/base/portal-to-follow-elem'
import cn from '@/utils/classnames'
const i18nPrefix = 'workflow.nodes.humanInput'
@ -103,7 +104,7 @@ const EmailInput = ({
return (
<div className='p-1 pt-0'>
<div
className='flex max-h-24 min-h-16 flex-wrap overflow-y-auto rounded-lg border border-transparent bg-components-input-bg-normal p-2'
className={cn('flex max-h-24 min-h-16 flex-wrap overflow-y-auto rounded-lg border border-transparent bg-components-input-bg-normal p-2 hover:border-components-input-border-hover hover:bg-components-input-bg-hover', isFocus && 'border-components-input-border-active bg-components-input-bg-active shadow-xs')}
onClick={setInputFocus}
>
{selectedEmails.map(item => (

View File

@ -18,6 +18,14 @@ const TimeoutInput: FC<Props> = ({
onChange,
}) => {
const { t } = useTranslation()
const handleValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value
if (/^\d*$/.test(value))
onChange({ timeout: Number(value) || 1, unit })
else
onChange({ timeout: 1, unit })
}
return (
<div className='flex items-center gap-1'>
<Input
@ -25,7 +33,7 @@ const TimeoutInput: FC<Props> = ({
type='number'
value={timeout}
min={1}
onChange={e => onChange({ timeout: Number(e.target.value), unit })}
onChange={handleValueChange}
/>
<div className='flex items-center gap-0.5 rounded-[10px] bg-components-segmented-control-bg-normal p-0.5'>
<div