mirror of
https://github.com/langgenius/dify.git
synced 2026-03-27 09:09:54 +08:00
Merge remote-tracking branch 'origin/main' into feat/support-agent-sandbox
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import type { WebhookTriggerNodeType } from '../types'
|
||||
import { renderHook } from '@testing-library/react'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import { toast } from '@/app/components/base/ui/toast'
|
||||
import { BlockEnum, VarType } from '@/app/components/workflow/types'
|
||||
import { fetchWebhookUrl } from '@/service/apps'
|
||||
import { createNodeCrudModuleMock } from '../../__tests__/use-config-test-utils'
|
||||
@ -18,10 +18,10 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/base/toast', () => ({
|
||||
vi.mock('@/app/components/base/ui/toast', () => ({
|
||||
__esModule: true,
|
||||
default: {
|
||||
notify: vi.fn(),
|
||||
toast: {
|
||||
error: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
@ -42,7 +42,7 @@ vi.mock('@/service/apps', () => ({
|
||||
}))
|
||||
|
||||
const mockedFetchWebhookUrl = vi.mocked(fetchWebhookUrl)
|
||||
const mockedToastNotify = vi.mocked(Toast.notify)
|
||||
const mockedToastError = vi.mocked(toast.error)
|
||||
|
||||
const createPayload = (overrides: Partial<WebhookTriggerNodeType> = {}): WebhookTriggerNodeType => ({
|
||||
title: 'Webhook',
|
||||
@ -148,7 +148,7 @@ describe('useConfig', () => {
|
||||
}),
|
||||
]),
|
||||
}))
|
||||
expect(mockedToastNotify).toHaveBeenCalledTimes(1)
|
||||
expect(mockedToastError).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('should generate webhook urls once and fall back to empty url on request failure', async () => {
|
||||
|
||||
@ -8,7 +8,6 @@ import { useEffect, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import InputWithCopy from '@/app/components/base/input-with-copy'
|
||||
import { SimpleSelect } from '@/app/components/base/select'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import {
|
||||
NumberField,
|
||||
@ -18,6 +17,7 @@ import {
|
||||
NumberFieldIncrement,
|
||||
NumberFieldInput,
|
||||
} from '@/app/components/base/ui/number-field'
|
||||
import { toast } from '@/app/components/base/ui/toast'
|
||||
import Field from '@/app/components/workflow/nodes/_base/components/field'
|
||||
import OutputVars from '@/app/components/workflow/nodes/_base/components/output-vars'
|
||||
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
||||
@ -103,10 +103,7 @@ const Panel: FC<NodePanelProps<WebhookTriggerNodeType>> = ({
|
||||
placeholder={t(`${i18nPrefix}.webhookUrlPlaceholder`, { ns: 'workflow' })}
|
||||
readOnly
|
||||
onCopy={() => {
|
||||
Toast.notify({
|
||||
type: 'success',
|
||||
message: t(`${i18nPrefix}.urlCopied`, { ns: 'workflow' }),
|
||||
})
|
||||
toast.success(t(`${i18nPrefix}.urlCopied`, { ns: 'workflow' }))
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -2,7 +2,7 @@ import type { HttpMethod, WebhookHeader, WebhookParameter, WebhookTriggerNodeTyp
|
||||
import { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import { toast } from '@/app/components/base/ui/toast'
|
||||
import { useNodesReadOnly, useWorkflow } from '@/app/components/workflow/hooks'
|
||||
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
|
||||
import { fetchWebhookUrl } from '@/service/apps'
|
||||
@ -33,10 +33,7 @@ export const useConfig = (id: string, payload: WebhookTriggerNodeType) => {
|
||||
? t(key as never, { ns: 'appDebug', key: fieldLabel })
|
||||
: t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: fieldLabel })
|
||||
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message,
|
||||
})
|
||||
toast.error(message)
|
||||
}, [t])
|
||||
|
||||
const handleMethodChange = useCallback((method: HttpMethod) => {
|
||||
|
||||
Reference in New Issue
Block a user