Skip to content

Commit 441104a

Browse files
committed
fix: lnit error
1 parent 8897633 commit 441104a

File tree

7 files changed

+33
-57
lines changed

7 files changed

+33
-57
lines changed

web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22
import type { FC } from 'react'
3+
import type { Recipient } from '@/app/components/workflow/nodes/human-input/types'
34
import type { Member } from '@/models/common'
4-
import * as React from 'react'
55
import { useMemo } from 'react'
66
import { useTranslation } from 'react-i18next'
77
import Avatar from '@/app/components/base/avatar'
@@ -11,11 +11,11 @@ import { cn } from '@/utils/classnames'
1111
const i18nPrefix = 'nodes.humanInput'
1212

1313
type Props = {
14-
value: any[]
14+
value: Recipient[]
1515
searchValue: string
1616
onSearchChange: (value: string) => void
1717
list: Member[]
18-
onSelect: (value: any) => void
18+
onSelect: (value: string) => void
1919
email: string
2020
hideSearch?: boolean
2121
}
@@ -57,27 +57,27 @@ const MemberList: FC<Props> = ({ searchValue, list, value, onSearchChange, onSel
5757
key={account.id}
5858
className={cn(
5959
'group flex cursor-pointer items-center gap-2 rounded-lg py-1 pl-2 pr-3 hover:bg-state-base-hover',
60-
value.some((item: { user_id: string }) => item.user_id === account.id) && 'bg-transparent hover:bg-transparent',
60+
value.some(item => item.user_id === account.id) && 'bg-transparent hover:bg-transparent',
6161
)}
6262
onClick={() => {
63-
if (value.some((item: { user_id: string }) => item.user_id === account.id))
63+
if (value.some(item => item.user_id === account.id))
6464
return
6565
onSelect(account.id)
6666
}}
6767
>
68-
<Avatar className={cn(value.some((item: { user_id: string }) => item.user_id === account.id) && 'opacity-50')} avatar={account.avatar_url} size={24} name={account.name} />
69-
<div className={cn('grow', value.some((item: { user_id: string }) => item.user_id === account.id) && 'opacity-50')}>
68+
<Avatar className={cn(value.some(item => item.user_id === account.id) && 'opacity-50')} avatar={account.avatar_url} size={24} name={account.name} />
69+
<div className={cn('grow', value.some(item => item.user_id === account.id) && 'opacity-50')}>
7070
<div className="system-sm-medium text-text-secondary">
7171
{account.name}
7272
{account.status === 'pending' && <span className="system-xs-medium ml-1 text-text-warning">{t('members.pending', { ns: 'common' })}</span>}
7373
{email === account.email && <span className="system-xs-regular text-text-tertiary">{t('members.you', { ns: 'common' })}</span>}
7474
</div>
7575
<div className="system-xs-regular text-text-tertiary">{account.email}</div>
7676
</div>
77-
{!value.some((item: { user_id: string }) => item.user_id === account.id) && (
77+
{!value.some(item => item.user_id === account.id) && (
7878
<div className="system-xs-medium hidden text-text-accent group-hover:block">{t(`${i18nPrefix}.deliveryMethod.emailConfigure.memberSelector.add`, { ns: 'workflow' })}</div>
7979
)}
80-
{value.some((item: { user_id: string }) => item.user_id === account.id) && (
80+
{value.some(item => item.user_id === account.id) && (
8181
<div className="system-xs-regular text-text-tertiary">{t(`${i18nPrefix}.deliveryMethod.emailConfigure.memberSelector.added`, { ns: 'workflow' })}</div>
8282
)}
8383
</div>

web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use client'
22
import type { FC } from 'react'
3+
import type { Recipient } from '@/app/components/workflow/nodes/human-input/types'
34
import type { Member } from '@/models/common'
45
import {
56
RiContactsBookLine,
67
} from '@remixicon/react'
7-
import * as React from 'react'
88
import { useState } from 'react'
99
import { useTranslation } from 'react-i18next'
1010
import Button from '@/app/components/base/button'
@@ -15,9 +15,9 @@ import MemberList from './member-list'
1515
const i18nPrefix = 'nodes.humanInput'
1616

1717
type Props = {
18-
value: any[]
18+
value: Recipient[]
1919
email: string
20-
onSelect: (value: any) => void
20+
onSelect: (value: string) => void
2121
list: Member[]
2222
}
2323

web/app/components/workflow/nodes/human-input/components/single-run-form.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
'use client'
2+
import type { ButtonProps } from '@/app/components/base/button'
3+
import type { UserAction } from '@/app/components/workflow/nodes/human-input/types'
24
import type { HumanInputFormData } from '@/types/workflow'
35
import { RiArrowLeftLine } from '@remixicon/react'
46
import * as React from 'react'
@@ -14,7 +16,7 @@ type Props = {
1416
data: HumanInputFormData
1517
showBackButton?: boolean
1618
handleBack?: () => void
17-
onSubmit?: (data: any) => Promise<void>
19+
onSubmit?: ({ inputs, action }: { inputs: Record<string, string>, action: string }) => Promise<void>
1820
}
1921

2022
const FormContent = ({
@@ -30,7 +32,7 @@ const FormContent = ({
3032
const [inputs, setInputs] = useState(defaultInputs)
3133
const [isSubmitting, setIsSubmitting] = useState(false)
3234

33-
const handleInputsChange = (name: string, value: any) => {
35+
const handleInputsChange = (name: string, value: string) => {
3436
setInputs(prev => ({
3537
...prev,
3638
[name]: value,
@@ -66,11 +68,11 @@ const FormContent = ({
6668
/>
6769
))}
6870
<div className="flex flex-wrap gap-1 py-1">
69-
{data.actions.map((action: any) => (
71+
{data.actions.map((action: UserAction) => (
7072
<Button
7173
key={action.id}
7274
disabled={isSubmitting}
73-
variant={getButtonStyle(action.button_style) as any}
75+
variant={getButtonStyle(action.button_style) as ButtonProps['variant']}
7476
onClick={() => submit(action.id)}
7577
>
7678
{action.title}

web/app/components/workflow/nodes/human-input/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const nodeDefault: NodeDefault<HumanInputNodeType> = {
3131
timeout: 3,
3232
timeout_unit: 'day',
3333
},
34-
checkValid(payload: HumanInputNodeType, t: any) {
34+
checkValid(payload: HumanInputNodeType, t: (str: string, options: Record<string, unknown>) => string) {
3535
let errorMessages = ''
3636
if (!errorMessages && !payload.delivery_methods.length)
3737
errorMessages = t(`${i18nPrefix}.noDeliveryMethod`, { ns: 'workflow' })

web/app/components/workflow/nodes/human-input/hooks/use-single-run-form-params.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const i18nPrefix = 'nodes.humanInput'
1515
type Params = {
1616
id: string
1717
payload: HumanInputNodeType
18-
runInputData: Record<string, any>
18+
runInputData: Record<string, string>
1919
getInputVars: (textList: string[]) => InputVar[]
20-
setRunInputData: (data: Record<string, any>) => void
20+
setRunInputData: (data: Record<string, string>) => void
2121
}
2222
const useSingleRunFormParams = ({
2323
id,
@@ -30,7 +30,7 @@ const useSingleRunFormParams = ({
3030
const { inputs } = useNodeCrud<HumanInputNodeType>(id, payload)
3131
const [showGeneratedForm, setShowGeneratedForm] = useState(false)
3232
const [formData, setFormData] = useState<HumanInputFormData | null>(null)
33-
const [requiredInputs, setRequiredInputs] = useState<Record<string, any>>({})
33+
const [requiredInputs, setRequiredInputs] = useState<Record<string, string>>({})
3434
const generatedInputs = useMemo(() => {
3535
const defaultInputs = inputs.inputs.reduce((acc, input) => {
3636
if (input.default.type === 'variable') {
@@ -76,10 +76,10 @@ const useSingleRunFormParams = ({
7676
}
7777
}, [appId, id, isWorkflowMode])
7878

79-
const handleFetchFormContent = useCallback(async (inputs: Record<string, any>) => {
79+
const handleFetchFormContent = useCallback(async (inputs: Record<string, string>) => {
8080
if (!fetchURL)
8181
return null
82-
let requestParamsObj: Record<string, any> = {}
82+
let requestParamsObj: Record<string, string> = {}
8383
Object.keys(inputs).forEach((key) => {
8484
if (inputs[key] === undefined) {
8585
delete inputs[key]
@@ -92,15 +92,19 @@ const useSingleRunFormParams = ({
9292
return data
9393
}, [fetchURL])
9494

95-
const handleSubmitHumanInputForm = useCallback(async (formData: any) => {
95+
const handleSubmitHumanInputForm = useCallback(async (formData: {
96+
inputs: Record<string, string> | undefined
97+
form_inputs: Record<string, string> | undefined
98+
action: string
99+
}) => {
96100
await submitHumanInputNodeStepRunForm(fetchURL, {
97101
inputs: requiredInputs,
98102
form_inputs: formData.inputs,
99103
action: formData.action,
100104
})
101105
}, [fetchURL, requiredInputs])
102106

103-
const handleShowGeneratedForm = async (formValue: Record<string, any>) => {
107+
const handleShowGeneratedForm = async (formValue: Record<string, string>) => {
104108
setShowGeneratedForm(true)
105109
await handleFetchFormContent(formValue)
106110
}

web/eslint-suppressions.json

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3304,16 +3304,6 @@
33043304
"count": 5
33053305
}
33063306
},
3307-
"app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx": {
3308-
"ts/no-explicit-any": {
3309-
"count": 2
3310-
}
3311-
},
3312-
"app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx": {
3313-
"ts/no-explicit-any": {
3314-
"count": 2
3315-
}
3316-
},
33173307
"app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx": {
33183308
"ts/no-explicit-any": {
33193309
"count": 2
@@ -3330,26 +3320,11 @@
33303320
"count": 3
33313321
}
33323322
},
3333-
"app/components/workflow/nodes/human-input/components/single-run-form.tsx": {
3334-
"ts/no-explicit-any": {
3335-
"count": 4
3336-
}
3337-
},
33383323
"app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx": {
33393324
"ts/no-explicit-any": {
33403325
"count": 8
33413326
}
33423327
},
3343-
"app/components/workflow/nodes/human-input/default.ts": {
3344-
"ts/no-explicit-any": {
3345-
"count": 1
3346-
}
3347-
},
3348-
"app/components/workflow/nodes/human-input/hooks/use-single-run-form-params.ts": {
3349-
"ts/no-explicit-any": {
3350-
"count": 7
3351-
}
3352-
},
33533328
"app/components/workflow/nodes/if-else/components/condition-list/condition-input.tsx": {
33543329
"ts/no-explicit-any": {
33553330
"count": 1
@@ -4422,11 +4397,6 @@
44224397
"count": 10
44234398
}
44244399
},
4425-
"service/workflow.ts": {
4426-
"ts/no-explicit-any": {
4427-
"count": 3
4428-
}
4429-
},
44304400
"testing/testing.md": {
44314401
"ts/no-explicit-any": {
44324402
"count": 2

web/service/workflow.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const submitHumanInputForm = (token: string, data: {
108108
export const fetchHumanInputNodeStepRunForm = (
109109
url: string,
110110
data: {
111-
inputs: Record<string, any>
111+
inputs: Record<string, string>
112112
},
113113
) => {
114114
return post<HumanInputFormData>(`${url}/preview`, { body: data })
@@ -117,8 +117,8 @@ export const fetchHumanInputNodeStepRunForm = (
117117
export const submitHumanInputNodeStepRunForm = (
118118
url: string,
119119
data: {
120-
inputs: Record<string, any> | undefined
121-
form_inputs: Record<string, any> | undefined
120+
inputs: Record<string, string> | undefined
121+
form_inputs: Record<string, string> | undefined
122122
action: string
123123
},
124124
) => {

0 commit comments

Comments
 (0)