mirror of
https://github.com/langgenius/dify.git
synced 2026-08-02 18:56:34 +08:00
refactor(workflow): remove hook barrel exports (#39588)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
c61d33f91e
commit
119b6532fd
@ -3634,11 +3634,6 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/rag-pipeline/hooks/index.ts": {
|
||||
"no-barrel-files/no-barrel-files": {
|
||||
"count": 9
|
||||
}
|
||||
},
|
||||
"web/app/components/rag-pipeline/hooks/use-DSL.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
@ -3891,11 +3886,6 @@
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow-app/hooks/index.ts": {
|
||||
"no-barrel-files/no-barrel-files": {
|
||||
"count": 13
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow-app/hooks/use-DSL.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
@ -4035,11 +4025,6 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/hooks/index.ts": {
|
||||
"no-barrel-files/no-barrel-files": {
|
||||
"count": 25
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/hooks/use-checklist.ts": {
|
||||
"typescript/no-empty-object-type": {
|
||||
"count": 1
|
||||
@ -4068,11 +4053,6 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/hooks/use-workflow-run-event/index.ts": {
|
||||
"no-barrel-files/no-barrel-files": {
|
||||
"count": 19
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
|
||||
@ -4,7 +4,7 @@ import type { GeneratorType } from './types'
|
||||
import type { ValueSelector, Var } from '@/app/components/workflow/types'
|
||||
import * as React from 'react'
|
||||
import { useCallback } from 'react'
|
||||
import { useWorkflowVariableType } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowVariableType } from '@/app/components/workflow/hooks/use-workflow-variables'
|
||||
import useAvailableVarList from '@/app/components/workflow/nodes/_base/hooks/use-available-var-list'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { VarType } from '@/app/components/workflow/types'
|
||||
|
||||
@ -9,7 +9,7 @@ vi.mock('@/context/dataset-detail', () => ({
|
||||
selector({ dataset: pipelineId ? { pipeline_id: pipelineId } : undefined }),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks', () => ({
|
||||
vi.mock('../hooks/use-pipeline-init', () => ({
|
||||
usePipelineInit: () => pipelineInit,
|
||||
}))
|
||||
|
||||
|
||||
@ -60,11 +60,14 @@ vi.mock('@/app/components/workflow/hooks-store', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-DSL', () => ({
|
||||
useDSL: () => ({
|
||||
exportCheck: mockExportCheck,
|
||||
handleExportDSL: mockHandleExportDSL,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-panel-interactions', () => ({
|
||||
usePanelInteractions: () => ({
|
||||
handlePaneContextmenuCancel: mockHandlePaneContextmenuCancel,
|
||||
}),
|
||||
@ -74,7 +77,7 @@ vi.mock('../../hooks/use-rag-pipeline-search', () => ({
|
||||
useRagPipelineSearch: mockUseRagPipelineSearch,
|
||||
}))
|
||||
|
||||
vi.mock('../../../workflow/plugin-dependency', () => ({
|
||||
vi.mock('@/app/components/workflow/plugin-dependency', () => ({
|
||||
default: () => <div data-testid="plugin-dependency" />,
|
||||
}))
|
||||
|
||||
|
||||
@ -17,19 +17,24 @@ vi.mock('@/context/workspace-state', async () => {
|
||||
}))
|
||||
})
|
||||
|
||||
vi.mock('../../hooks', () => ({
|
||||
vi.mock('../../hooks/use-available-nodes-meta-data', () => ({
|
||||
useAvailableNodesMetaData: () => ({ nodes: [], nodesMap: {} }),
|
||||
useDSL: () => ({
|
||||
exportCheck: vi.fn(),
|
||||
handleExportDSL: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-DSL', () => ({
|
||||
useDSLByCanEdit: () => ({
|
||||
exportCheck: vi.fn(),
|
||||
handleExportDSL: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-get-run-and-trace-url', () => ({
|
||||
useGetRunAndTraceUrl: () => ({
|
||||
getWorkflowRunAndTraceUrl: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => ({
|
||||
doSyncWorkflowDraft: vi.fn(),
|
||||
syncWorkflowDraftWhenPageClose: vi.fn(),
|
||||
@ -38,16 +43,15 @@ vi.mock('../../hooks', () => ({
|
||||
doSyncWorkflowDraft: vi.fn(),
|
||||
syncWorkflowDraftWhenPageClose: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-pipeline-refresh-draft', () => ({
|
||||
usePipelineRefreshDraft: () => ({
|
||||
handleRefreshWorkflowDraft: vi.fn(),
|
||||
}),
|
||||
usePipelineRun: () => ({
|
||||
handleBackupDraft: vi.fn(),
|
||||
handleLoadBackupDraft: vi.fn(),
|
||||
handleRestoreFromPublishedWorkflow: vi.fn(),
|
||||
handleRun: vi.fn(),
|
||||
handleStopRun: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-pipeline-run', () => ({
|
||||
usePipelineRunByCanEdit: () => ({
|
||||
handleBackupDraft: vi.fn(),
|
||||
handleLoadBackupDraft: vi.fn(),
|
||||
@ -55,10 +59,9 @@ vi.mock('../../hooks', () => ({
|
||||
handleRun: vi.fn(),
|
||||
handleStopRun: vi.fn(),
|
||||
}),
|
||||
usePipelineStartRun: () => ({
|
||||
handleStartWorkflowRun: vi.fn(),
|
||||
handleWorkflowStartRunInWorkflow: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-pipeline-start-run', () => ({
|
||||
usePipelineStartRunByCanEdit: () => ({
|
||||
handleStartWorkflowRun: vi.fn(),
|
||||
handleWorkflowStartRunInWorkflow: vi.fn(),
|
||||
|
||||
@ -18,7 +18,7 @@ let mockIsPreviewing = false
|
||||
let mockIsEditing = false
|
||||
let mockCanEdit = true
|
||||
|
||||
vi.mock('@/app/components/rag-pipeline/hooks', () => ({
|
||||
vi.mock('../../../../hooks/use-input-field-panel', () => ({
|
||||
useInputFieldPanel: () => ({
|
||||
closeAllInputFieldPanels: mockCloseAllInputFieldPanels,
|
||||
toggleInputFieldPreviewPanel: mockToggleInputFieldPreviewPanel,
|
||||
@ -61,7 +61,7 @@ vi.mock('@/app/components/workflow/store', () => ({
|
||||
|
||||
const mockHandleSyncWorkflowDraft = vi.fn()
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => ({
|
||||
handleSyncWorkflowDraft: mockHandleSyncWorkflowDraft,
|
||||
}),
|
||||
|
||||
@ -5,7 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { useFieldList } from '../hooks'
|
||||
|
||||
const mockToggleInputFieldEditPanel = vi.fn()
|
||||
vi.mock('@/app/components/rag-pipeline/hooks', () => ({
|
||||
vi.mock('../../../../../hooks/use-input-field-panel', () => ({
|
||||
useInputFieldPanel: () => ({
|
||||
toggleInputFieldEditPanel: mockToggleInputFieldEditPanel,
|
||||
}),
|
||||
|
||||
@ -6,8 +6,8 @@ import { useBoolean } from 'ahooks'
|
||||
import { produce } from 'immer'
|
||||
import { useCallback, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useInputFieldPanel } from '@/app/components/rag-pipeline/hooks'
|
||||
import { ChangeType } from '@/app/components/workflow/types'
|
||||
import { useInputFieldPanel } from '../../../../hooks/use-input-field-panel'
|
||||
import { usePipeline } from '../../../../hooks/use-pipeline'
|
||||
|
||||
const VARIABLE_PREFIX = 'rag'
|
||||
|
||||
@ -9,11 +9,11 @@ import { useTranslation } from 'react-i18next'
|
||||
import { useNodes } from 'reactflow'
|
||||
import Divider from '@/app/components/base/divider'
|
||||
import { Infotip } from '@/app/components/base/infotip'
|
||||
import { useInputFieldPanel } from '@/app/components/rag-pipeline/hooks'
|
||||
import { useNodesSyncDraft } from '@/app/components/workflow/hooks'
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
||||
import { useNodesSyncDraft } from '@/app/components/workflow/hooks/use-nodes-sync-draft'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import { useInputFieldPanel } from '../../../hooks/use-input-field-panel'
|
||||
import FieldList from './field-list'
|
||||
import FooterTip from './footer-tip'
|
||||
import Datasource from './label-right-content/datasource'
|
||||
|
||||
@ -2,7 +2,7 @@ import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-so
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import Datasource from '../datasource'
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-tool-icon', () => ({
|
||||
useToolIcon: () => 'tool-icon',
|
||||
}))
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||
import * as React from 'react'
|
||||
import BlockIcon from '@/app/components/workflow/block-icon'
|
||||
import { useToolIcon } from '@/app/components/workflow/hooks'
|
||||
import { useToolIcon } from '@/app/components/workflow/hooks/use-tool-icon'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
|
||||
type DatasourceProps = {
|
||||
|
||||
@ -27,7 +27,7 @@ vi.mock('@/app/components/base/form/form-scenarios/base/field', () => ({
|
||||
default: mockBaseField,
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/rag-pipeline/hooks/use-input-fields', () => ({
|
||||
vi.mock('../../../../../hooks/use-input-fields', () => ({
|
||||
useInitialData: mockUseInitialData,
|
||||
useConfigurations: mockUseConfigurations,
|
||||
}))
|
||||
|
||||
@ -19,7 +19,7 @@ vi.mock('../../hooks', () => ({
|
||||
}))
|
||||
|
||||
const mockToggleInputFieldPreviewPanel = vi.fn()
|
||||
vi.mock('@/app/components/rag-pipeline/hooks', () => ({
|
||||
vi.mock('../../../../../hooks/use-input-field-panel', () => ({
|
||||
useInputFieldPanel: () => ({
|
||||
toggleInputFieldPreviewPanel: mockToggleInputFieldPreviewPanel,
|
||||
isPreviewing: true,
|
||||
@ -108,7 +108,7 @@ const mapOptionToObject = (option: string) => ({
|
||||
value: option,
|
||||
})
|
||||
|
||||
vi.mock('@/app/components/rag-pipeline/hooks/use-input-fields', () => ({
|
||||
vi.mock('../../../../../hooks/use-input-fields', () => ({
|
||||
useInitialData: (variables: RAGPipelineVariables) => {
|
||||
return React.useMemo(() => {
|
||||
return variables.reduce(
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
import type { RAGPipelineVariables } from '@/models/pipeline'
|
||||
import { useAppForm } from '@/app/components/base/form'
|
||||
import BaseField from '@/app/components/base/form/form-scenarios/base/field'
|
||||
import {
|
||||
useConfigurations,
|
||||
useInitialData,
|
||||
} from '@/app/components/rag-pipeline/hooks/use-input-fields'
|
||||
import { useConfigurations, useInitialData } from '../../../../hooks/use-input-fields'
|
||||
|
||||
type FormProps = {
|
||||
variables: RAGPipelineVariables
|
||||
|
||||
@ -5,7 +5,7 @@ import { useCallback, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Badge from '@/app/components/base/badge'
|
||||
import Divider from '@/app/components/base/divider'
|
||||
import { useInputFieldPanel } from '@/app/components/rag-pipeline/hooks'
|
||||
import { useInputFieldPanel } from '../../../../hooks/use-input-field-panel'
|
||||
import { useFloatingRight } from '../hooks'
|
||||
import DataSource from './data-source'
|
||||
import ProcessDocuments from './process-documents'
|
||||
|
||||
@ -17,7 +17,7 @@ vi.mock('@/app/components/workflow/store', () => ({
|
||||
useWorkflowStore: () => mockWorkflowStore,
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-panel-interactions', () => ({
|
||||
useWorkflowInteractions: () => ({
|
||||
handleCancelDebugAndPreviewPanel: mockHandleCancelDebugAndPreviewPanel,
|
||||
}),
|
||||
|
||||
@ -2,7 +2,7 @@ import { RiCloseLine } from '@remixicon/react'
|
||||
import * as React from 'react'
|
||||
import { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useWorkflowInteractions } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowInteractions } from '@/app/components/workflow/hooks/use-workflow-panel-interactions'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
|
||||
const Header = () => {
|
||||
|
||||
@ -102,10 +102,13 @@ vi.mock('@/app/components/workflow/store', () => ({
|
||||
|
||||
const mockHandleRun = vi.fn()
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-run', () => ({
|
||||
useWorkflowRun: () => ({
|
||||
handleRun: mockHandleRun,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-tool-icon', () => ({
|
||||
useToolIcon: () => ({ type: 'icon', icon: 'test-icon' }),
|
||||
}))
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-so
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import OptionCard from '../option-card'
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-tool-icon', () => ({
|
||||
useToolIcon: () => 'source-icon',
|
||||
}))
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { cn } from '@langgenius/dify-ui/cn'
|
||||
import * as React from 'react'
|
||||
import { useCallback } from 'react'
|
||||
import BlockIcon from '@/app/components/workflow/block-icon'
|
||||
import { useToolIcon } from '@/app/components/workflow/hooks'
|
||||
import { useToolIcon } from '@/app/components/workflow/hooks/use-tool-icon'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
|
||||
type OptionCardProps = {
|
||||
|
||||
@ -48,7 +48,7 @@ vi.mock('@/service/use-pipeline', () => ({
|
||||
const mockUseInitialData = vi.fn()
|
||||
const mockUseConfigurations = vi.fn()
|
||||
|
||||
vi.mock('@/app/components/rag-pipeline/hooks/use-input-fields', () => ({
|
||||
vi.mock('../../../../../../hooks/use-input-fields', () => ({
|
||||
useInitialData: (variables: RAGPipelineVariables) => mockUseInitialData(variables),
|
||||
useConfigurations: (variables: RAGPipelineVariables) => mockUseConfigurations(variables),
|
||||
}))
|
||||
|
||||
@ -2,10 +2,7 @@ import type { CustomActionsProps } from '@/app/components/base/form/components/f
|
||||
import * as React from 'react'
|
||||
import { useCallback } from 'react'
|
||||
import { generateZodSchema } from '@/app/components/base/form/form-scenarios/base/utils'
|
||||
import {
|
||||
useConfigurations,
|
||||
useInitialData,
|
||||
} from '@/app/components/rag-pipeline/hooks/use-input-fields'
|
||||
import { useConfigurations, useInitialData } from '../../../../../hooks/use-input-fields'
|
||||
import Actions from './actions'
|
||||
import { useInputVariables } from './hooks'
|
||||
import Options from './options'
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
useDataSourceStoreWithSelector,
|
||||
} from '@/app/components/datasets/documents/create-from-pipeline/data-source/store'
|
||||
import WebsiteCrawl from '@/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl'
|
||||
import { useWorkflowRun } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowRun } from '@/app/components/workflow/hooks/use-workflow-run'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { DatasourceType } from '@/models/pipeline'
|
||||
import { TransferMethod } from '@/types/app'
|
||||
|
||||
@ -2,11 +2,12 @@ import type { EnvironmentVariable } from '@/app/components/workflow/types'
|
||||
import { memo, useState } from 'react'
|
||||
import { DSL_EXPORT_CHECK } from '@/app/components/workflow/constants'
|
||||
import DSLExportConfirmModal from '@/app/components/workflow/dsl-export-confirm-modal'
|
||||
import { useDSL, usePanelInteractions } from '@/app/components/workflow/hooks'
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
||||
import { useDSL } from '@/app/components/workflow/hooks/use-DSL'
|
||||
import { usePanelInteractions } from '@/app/components/workflow/hooks/use-panel-interactions'
|
||||
import PluginDependency from '@/app/components/workflow/plugin-dependency'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { useEventEmitterContextContext } from '@/context/event-emitter'
|
||||
import PluginDependency from '../../workflow/plugin-dependency'
|
||||
import { useStore } from '../../workflow/store'
|
||||
import { useRagPipelineSearch } from '../hooks/use-rag-pipeline-search'
|
||||
import RagPipelinePanel from './panel'
|
||||
import PublishToast from './publish-toast'
|
||||
|
||||
@ -33,10 +33,13 @@ vi.mock('@tanstack/react-hotkeys', async (importOriginal) => {
|
||||
|
||||
let mockWorkflowRunningData: { task_id: string; result: { status: string } } | undefined
|
||||
let mockIsPreparingDataSource = false
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-run', () => ({
|
||||
useWorkflowRun: () => ({
|
||||
handleStopRun: mockHandleStopRun,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-start-run', () => ({
|
||||
useWorkflowStartRun: () => ({
|
||||
handleWorkflowStartRunInWorkflow: mockHandleWorkflowStartRunInWorkflow,
|
||||
}),
|
||||
|
||||
@ -100,10 +100,13 @@ vi.mock('@/next/link', () => ({
|
||||
|
||||
const mockHandleSyncWorkflowDraft = vi.fn()
|
||||
const mockHandleCheckBeforePublish = vi.fn().mockResolvedValue(true)
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => ({
|
||||
handleSyncWorkflowDraft: mockHandleSyncWorkflowDraft,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-checklist', () => ({
|
||||
useChecklistBeforePublish: () => ({
|
||||
handleCheckBeforePublish: mockHandleCheckBeforePublish,
|
||||
}),
|
||||
|
||||
@ -173,7 +173,7 @@ vi.mock('@/config', async (importOriginal) => ({
|
||||
MARKETPLACE_API_PREFIX: '/marketplace/api',
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-checklist', () => ({
|
||||
useChecklistBeforePublish: () => ({
|
||||
handleCheckBeforePublish: mockHandleCheckBeforePublish,
|
||||
}),
|
||||
|
||||
@ -7,8 +7,8 @@ import { RiArrowDownSLine } from '@remixicon/react'
|
||||
import { useBoolean } from 'ahooks'
|
||||
import { memo, useCallback, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useNodesSyncDraft } from '@/app/components/workflow/hooks'
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
||||
import { useNodesSyncDraft } from '@/app/components/workflow/hooks/use-nodes-sync-draft'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import Link from '@/next/link'
|
||||
|
||||
@ -23,7 +23,7 @@ import { trackEvent } from '@/app/components/base/amplitude'
|
||||
import Divider from '@/app/components/base/divider'
|
||||
import { SparklesSoft } from '@/app/components/base/icons/src/public/common'
|
||||
import PremiumBadge from '@/app/components/base/premium-badge'
|
||||
import { useChecklistBeforePublish } from '@/app/components/workflow/hooks'
|
||||
import { useChecklistBeforePublish } from '@/app/components/workflow/hooks/use-checklist'
|
||||
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { userProfileIdAtom } from '@/context/account-state'
|
||||
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
|
||||
|
||||
@ -5,8 +5,9 @@ import { formatForDisplay, useHotkey } from '@tanstack/react-hotkeys'
|
||||
import { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { StopCircle } from '@/app/components/base/icons/src/vender/line/mediaAndDevices'
|
||||
import { useWorkflowRun, useWorkflowStartRun } from '@/app/components/workflow/hooks'
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
||||
import { useWorkflowRun } from '@/app/components/workflow/hooks/use-workflow-run'
|
||||
import { useWorkflowStartRun } from '@/app/components/workflow/hooks/use-workflow-start-run'
|
||||
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { WorkflowRunningStatus } from '@/app/components/workflow/types'
|
||||
import { EVENT_WORKFLOW_STOP } from '@/app/components/workflow/variable-inspect/types'
|
||||
|
||||
@ -9,17 +9,15 @@ import { userProfileIdAtom } from '@/context/account-state'
|
||||
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
|
||||
import { workspacePermissionKeysAtom } from '@/context/permission-state'
|
||||
import { getDatasetACLCapabilities } from '@/utils/permission'
|
||||
import {
|
||||
useAvailableNodesMetaData,
|
||||
useDSLByCanEdit,
|
||||
useGetRunAndTraceUrl,
|
||||
useNodesSyncDraftByCanEdit,
|
||||
usePipelineRefreshDraft,
|
||||
usePipelineRunByCanEdit,
|
||||
usePipelineStartRunByCanEdit,
|
||||
} from '../hooks'
|
||||
import { useAvailableNodesMetaData } from '../hooks/use-available-nodes-meta-data'
|
||||
import { useConfigsMap } from '../hooks/use-configs-map'
|
||||
import { useDSLByCanEdit } from '../hooks/use-DSL'
|
||||
import { useGetRunAndTraceUrl } from '../hooks/use-get-run-and-trace-url'
|
||||
import { useInspectVarsCrud } from '../hooks/use-inspect-vars-crud'
|
||||
import { useNodesSyncDraftByCanEdit } from '../hooks/use-nodes-sync-draft'
|
||||
import { usePipelineRefreshDraft } from '../hooks/use-pipeline-refresh-draft'
|
||||
import { usePipelineRunByCanEdit } from '../hooks/use-pipeline-run'
|
||||
import { usePipelineStartRunByCanEdit } from '../hooks/use-pipeline-start-run'
|
||||
import RagPipelineChildren from './rag-pipeline-children'
|
||||
|
||||
type RagPipelineMainProps = Pick<WorkflowProps, 'nodes' | 'edges' | 'viewport'>
|
||||
|
||||
@ -1,489 +0,0 @@
|
||||
import type { RAGPipelineVariables, VAR_TYPE_MAP } from '@/models/pipeline'
|
||||
import { act } from 'react'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import { renderHookWithConsoleQuery as renderHook } from '@/test/console/query-data'
|
||||
import { Resolution, TransferMethod } from '@/types/app'
|
||||
import { FlowType } from '@/types/common'
|
||||
import {
|
||||
useAvailableNodesMetaData,
|
||||
useGetRunAndTraceUrl,
|
||||
useInputFieldPanel,
|
||||
useNodesSyncDraft,
|
||||
usePipelineInit,
|
||||
usePipelineRefreshDraft,
|
||||
} from '../index'
|
||||
import { useConfigsMap } from '../use-configs-map'
|
||||
import { useConfigurations, useInitialData } from '../use-input-fields'
|
||||
import { usePipelineTemplate } from '../use-pipeline-template'
|
||||
|
||||
const _mockGetState = vi.fn()
|
||||
const mockUseStore = vi.fn()
|
||||
const mockUseWorkflowStore = vi.fn()
|
||||
const toastMocks = vi.hoisted(() => ({
|
||||
error: vi.fn(),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/store', () => ({
|
||||
useStore: (selector: (state: Record<string, unknown>) => unknown) => mockUseStore(selector),
|
||||
useWorkflowStore: () => mockUseWorkflowStore(),
|
||||
}))
|
||||
|
||||
vi.mock('@langgenius/dify-ui/toast', () => ({
|
||||
toast: {
|
||||
error: toastMocks.error,
|
||||
},
|
||||
}))
|
||||
|
||||
const mockEventEmit = vi.fn()
|
||||
vi.mock('@/context/event-emitter', () => ({
|
||||
useEventEmitterContextContext: () => ({
|
||||
eventEmitter: {
|
||||
emit: mockEventEmit,
|
||||
},
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/constants', () => ({
|
||||
DSL_EXPORT_CHECK: 'DSL_EXPORT_CHECK',
|
||||
WORKFLOW_DATA_UPDATE: 'WORKFLOW_DATA_UPDATE',
|
||||
START_INITIAL_POSITION: { x: 100, y: 100 },
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/constants/node', () => ({
|
||||
WORKFLOW_COMMON_NODES: [
|
||||
{
|
||||
metaData: { type: BlockEnum.Start },
|
||||
defaultValue: { type: BlockEnum.Start },
|
||||
},
|
||||
{
|
||||
metaData: { type: BlockEnum.End },
|
||||
defaultValue: { type: BlockEnum.End },
|
||||
},
|
||||
],
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/nodes/data-source-empty/default', () => ({
|
||||
default: {
|
||||
metaData: { type: BlockEnum.DataSourceEmpty },
|
||||
defaultValue: { type: BlockEnum.DataSourceEmpty },
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/nodes/data-source/default', () => ({
|
||||
default: {
|
||||
metaData: { type: BlockEnum.DataSource },
|
||||
defaultValue: { type: BlockEnum.DataSource },
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/nodes/knowledge-base/default', () => ({
|
||||
default: {
|
||||
metaData: { type: BlockEnum.KnowledgeBase },
|
||||
defaultValue: { type: BlockEnum.KnowledgeBase },
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/utils', async (importOriginal) => {
|
||||
const actual = (await importOriginal()) as Record<string, unknown>
|
||||
return {
|
||||
...actual,
|
||||
generateNewNode: ({
|
||||
id,
|
||||
data,
|
||||
position,
|
||||
}: {
|
||||
id: string
|
||||
data: object
|
||||
position: { x: number; y: number }
|
||||
}) => ({
|
||||
newNode: { id, data, position, type: 'custom' },
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
const mockExportPipelineConfig = vi.fn()
|
||||
vi.mock('@/service/use-pipeline', () => ({
|
||||
useExportPipelineDSL: () => ({
|
||||
mutateAsync: mockExportPipelineConfig,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/service/workflow', () => ({
|
||||
fetchWorkflowDraft: vi.fn().mockResolvedValue({
|
||||
graph: { nodes: [], edges: [], viewport: {} },
|
||||
environment_variables: [],
|
||||
}),
|
||||
}))
|
||||
|
||||
describe('useConfigsMap', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mockUseStore.mockImplementation((selector: (state: Record<string, unknown>) => unknown) => {
|
||||
const state = {
|
||||
pipelineId: 'test-pipeline-id',
|
||||
fileUploadConfig: { max_file_size: 10 },
|
||||
}
|
||||
return selector(state)
|
||||
})
|
||||
})
|
||||
|
||||
it('should return config map with correct flowId', () => {
|
||||
const { result } = renderHook(() => useConfigsMap())
|
||||
|
||||
expect(result.current.flowId).toBe('test-pipeline-id')
|
||||
})
|
||||
|
||||
it('should return config map with correct flowType', () => {
|
||||
const { result } = renderHook(() => useConfigsMap())
|
||||
|
||||
expect(result.current.flowType).toBe(FlowType.ragPipeline)
|
||||
})
|
||||
|
||||
it('should return file settings with image config', () => {
|
||||
const { result } = renderHook(() => useConfigsMap())
|
||||
|
||||
expect(result.current.fileSettings.image).toEqual({
|
||||
enabled: false,
|
||||
detail: Resolution.high,
|
||||
number_limits: 3,
|
||||
transfer_methods: [TransferMethod.local_file, TransferMethod.remote_url],
|
||||
})
|
||||
})
|
||||
|
||||
it('should include fileUploadConfig from store', () => {
|
||||
const { result } = renderHook(() => useConfigsMap())
|
||||
|
||||
expect(result.current.fileSettings.fileUploadConfig).toEqual({ max_file_size: 10 })
|
||||
})
|
||||
})
|
||||
|
||||
describe('useGetRunAndTraceUrl', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mockUseWorkflowStore.mockReturnValue({
|
||||
getState: () => ({
|
||||
pipelineId: 'pipeline-123',
|
||||
}),
|
||||
})
|
||||
})
|
||||
|
||||
it('should return getWorkflowRunAndTraceUrl function', () => {
|
||||
const { result } = renderHook(() => useGetRunAndTraceUrl())
|
||||
|
||||
expect(result.current.getWorkflowRunAndTraceUrl).toBeDefined()
|
||||
expect(typeof result.current.getWorkflowRunAndTraceUrl).toBe('function')
|
||||
})
|
||||
|
||||
it('should generate correct run URL', () => {
|
||||
const { result } = renderHook(() => useGetRunAndTraceUrl())
|
||||
|
||||
const { runUrl } = result.current.getWorkflowRunAndTraceUrl('run-456')
|
||||
|
||||
expect(runUrl).toBe('/rag/pipelines/pipeline-123/workflow-runs/run-456')
|
||||
})
|
||||
|
||||
it('should generate correct trace URL', () => {
|
||||
const { result } = renderHook(() => useGetRunAndTraceUrl())
|
||||
|
||||
const { traceUrl } = result.current.getWorkflowRunAndTraceUrl('run-456')
|
||||
|
||||
expect(traceUrl).toBe('/rag/pipelines/pipeline-123/workflow-runs/run-456/node-executions')
|
||||
})
|
||||
})
|
||||
|
||||
describe('useInputFieldPanel', () => {
|
||||
const mockSetShowInputFieldPanel = vi.fn()
|
||||
const mockSetShowInputFieldPreviewPanel = vi.fn()
|
||||
const mockSetInputFieldEditPanelProps = vi.fn()
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mockUseStore.mockImplementation((selector: (state: Record<string, unknown>) => unknown) => {
|
||||
const state = {
|
||||
showInputFieldPreviewPanel: false,
|
||||
inputFieldEditPanelProps: null,
|
||||
}
|
||||
return selector(state)
|
||||
})
|
||||
mockUseWorkflowStore.mockReturnValue({
|
||||
getState: () => ({
|
||||
showInputFieldPreviewPanel: false,
|
||||
setShowInputFieldPanel: mockSetShowInputFieldPanel,
|
||||
setShowInputFieldPreviewPanel: mockSetShowInputFieldPreviewPanel,
|
||||
setInputFieldEditPanelProps: mockSetInputFieldEditPanelProps,
|
||||
}),
|
||||
})
|
||||
})
|
||||
|
||||
it('should return isPreviewing as false when showInputFieldPreviewPanel is false', () => {
|
||||
const { result } = renderHook(() => useInputFieldPanel())
|
||||
|
||||
expect(result.current.isPreviewing).toBe(false)
|
||||
})
|
||||
|
||||
it('should return isPreviewing as true when showInputFieldPreviewPanel is true', () => {
|
||||
mockUseStore.mockImplementation((selector: (state: Record<string, unknown>) => unknown) => {
|
||||
const state = {
|
||||
showInputFieldPreviewPanel: true,
|
||||
inputFieldEditPanelProps: null,
|
||||
}
|
||||
return selector(state)
|
||||
})
|
||||
|
||||
const { result } = renderHook(() => useInputFieldPanel())
|
||||
|
||||
expect(result.current.isPreviewing).toBe(true)
|
||||
})
|
||||
|
||||
it('should return isEditing as false when inputFieldEditPanelProps is null', () => {
|
||||
const { result } = renderHook(() => useInputFieldPanel())
|
||||
|
||||
expect(result.current.isEditing).toBe(false)
|
||||
})
|
||||
|
||||
it('should return isEditing as true when inputFieldEditPanelProps exists', () => {
|
||||
mockUseStore.mockImplementation((selector: (state: Record<string, unknown>) => unknown) => {
|
||||
const state = {
|
||||
showInputFieldPreviewPanel: false,
|
||||
inputFieldEditPanelProps: { some: 'props' },
|
||||
}
|
||||
return selector(state)
|
||||
})
|
||||
|
||||
const { result } = renderHook(() => useInputFieldPanel())
|
||||
|
||||
expect(result.current.isEditing).toBe(true)
|
||||
})
|
||||
|
||||
it('should call all setters when closeAllInputFieldPanels is called', () => {
|
||||
const { result } = renderHook(() => useInputFieldPanel())
|
||||
|
||||
act(() => {
|
||||
result.current.closeAllInputFieldPanels()
|
||||
})
|
||||
|
||||
expect(mockSetShowInputFieldPanel).toHaveBeenCalledWith(false)
|
||||
expect(mockSetShowInputFieldPreviewPanel).toHaveBeenCalledWith(false)
|
||||
expect(mockSetInputFieldEditPanelProps).toHaveBeenCalledWith(null)
|
||||
})
|
||||
|
||||
it('should toggle preview panel when toggleInputFieldPreviewPanel is called', () => {
|
||||
const { result } = renderHook(() => useInputFieldPanel())
|
||||
|
||||
act(() => {
|
||||
result.current.toggleInputFieldPreviewPanel()
|
||||
})
|
||||
|
||||
expect(mockSetShowInputFieldPreviewPanel).toHaveBeenCalledWith(true)
|
||||
})
|
||||
|
||||
it('should set edit panel props when toggleInputFieldEditPanel is called', () => {
|
||||
const { result } = renderHook(() => useInputFieldPanel())
|
||||
const editContent = { onClose: vi.fn(), onSubmit: vi.fn() }
|
||||
|
||||
act(() => {
|
||||
result.current.toggleInputFieldEditPanel(editContent)
|
||||
})
|
||||
|
||||
expect(mockSetInputFieldEditPanelProps).toHaveBeenCalledWith(editContent)
|
||||
})
|
||||
})
|
||||
|
||||
describe('useInitialData', () => {
|
||||
it('should return empty object for empty variables', () => {
|
||||
const { result } = renderHook(() => useInitialData([], undefined))
|
||||
|
||||
expect(result.current).toEqual({})
|
||||
})
|
||||
|
||||
it('should handle text input type with default value', () => {
|
||||
const variables: RAGPipelineVariables = [
|
||||
{
|
||||
type: 'text-input' as keyof typeof VAR_TYPE_MAP,
|
||||
variable: 'textVar',
|
||||
label: 'Text',
|
||||
required: false,
|
||||
default_value: 'default text',
|
||||
belong_to_node_id: 'node-1',
|
||||
},
|
||||
]
|
||||
|
||||
const { result } = renderHook(() => useInitialData(variables, undefined))
|
||||
|
||||
expect(result.current.textVar).toBe('default text')
|
||||
})
|
||||
|
||||
it('should use lastRunInputData over default value', () => {
|
||||
const variables: RAGPipelineVariables = [
|
||||
{
|
||||
type: 'text-input' as keyof typeof VAR_TYPE_MAP,
|
||||
variable: 'textVar',
|
||||
label: 'Text',
|
||||
required: false,
|
||||
default_value: 'default text',
|
||||
belong_to_node_id: 'node-1',
|
||||
},
|
||||
]
|
||||
|
||||
const { result } = renderHook(() => useInitialData(variables, { textVar: 'last run value' }))
|
||||
|
||||
expect(result.current.textVar).toBe('last run value')
|
||||
})
|
||||
|
||||
it('should handle number input type with default 0', () => {
|
||||
const variables: RAGPipelineVariables = [
|
||||
{
|
||||
type: 'number' as keyof typeof VAR_TYPE_MAP,
|
||||
variable: 'numVar',
|
||||
label: 'Number',
|
||||
required: false,
|
||||
belong_to_node_id: 'node-1',
|
||||
},
|
||||
]
|
||||
|
||||
const { result } = renderHook(() => useInitialData(variables, undefined))
|
||||
|
||||
expect(result.current.numVar).toBe(0)
|
||||
})
|
||||
|
||||
it('should handle file type with default empty array', () => {
|
||||
const variables: RAGPipelineVariables = [
|
||||
{
|
||||
type: 'file' as keyof typeof VAR_TYPE_MAP,
|
||||
variable: 'fileVar',
|
||||
label: 'File',
|
||||
required: false,
|
||||
belong_to_node_id: 'node-1',
|
||||
},
|
||||
]
|
||||
|
||||
const { result } = renderHook(() => useInitialData(variables, undefined))
|
||||
|
||||
expect(result.current.fileVar).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('useConfigurations', () => {
|
||||
it('should return empty array for empty variables', () => {
|
||||
const { result } = renderHook(() => useConfigurations([]))
|
||||
|
||||
expect(result.current).toEqual([])
|
||||
})
|
||||
|
||||
it('should transform variables to configurations', () => {
|
||||
const variables: RAGPipelineVariables = [
|
||||
{
|
||||
type: 'text-input' as keyof typeof VAR_TYPE_MAP,
|
||||
variable: 'textVar',
|
||||
label: 'Text Label',
|
||||
required: true,
|
||||
max_length: 100,
|
||||
placeholder: 'Enter text',
|
||||
tooltips: 'Help text',
|
||||
belong_to_node_id: 'node-1',
|
||||
},
|
||||
]
|
||||
|
||||
const { result } = renderHook(() => useConfigurations(variables))
|
||||
|
||||
expect(result.current.length).toBe(1)
|
||||
expect(result.current[0]!.variable).toBe('textVar')
|
||||
expect(result.current[0]!.label).toBe('Text Label')
|
||||
expect(result.current[0]!.required).toBe(true)
|
||||
expect(result.current[0]!.maxLength).toBe(100)
|
||||
expect(result.current[0]!.placeholder).toBe('Enter text')
|
||||
expect(result.current[0]!.tooltip).toBe('Help text')
|
||||
})
|
||||
|
||||
it('should transform options correctly', () => {
|
||||
const variables: RAGPipelineVariables = [
|
||||
{
|
||||
type: 'select' as keyof typeof VAR_TYPE_MAP,
|
||||
variable: 'selectVar',
|
||||
label: 'Select',
|
||||
required: false,
|
||||
options: ['option1', 'option2', 'option3'],
|
||||
belong_to_node_id: 'node-1',
|
||||
},
|
||||
]
|
||||
|
||||
const { result } = renderHook(() => useConfigurations(variables))
|
||||
|
||||
expect(result.current[0]!.options).toEqual([
|
||||
{ label: 'option1', value: 'option1' },
|
||||
{ label: 'option2', value: 'option2' },
|
||||
{ label: 'option3', value: 'option3' },
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe('useAvailableNodesMetaData', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('should return nodes array', () => {
|
||||
const { result } = renderHook(() => useAvailableNodesMetaData())
|
||||
|
||||
expect(result.current.nodes).toBeDefined()
|
||||
expect(Array.isArray(result.current.nodes)).toBe(true)
|
||||
})
|
||||
|
||||
it('should return nodesMap object', () => {
|
||||
const { result } = renderHook(() => useAvailableNodesMetaData())
|
||||
|
||||
expect(result.current.nodesMap).toBeDefined()
|
||||
expect(typeof result.current.nodesMap).toBe('object')
|
||||
})
|
||||
})
|
||||
|
||||
describe('usePipelineTemplate', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('should return nodes array with knowledge base node', () => {
|
||||
const { result } = renderHook(() => usePipelineTemplate())
|
||||
|
||||
expect(result.current.nodes).toBeDefined()
|
||||
expect(Array.isArray(result.current.nodes)).toBe(true)
|
||||
expect(result.current.nodes.length).toBe(1)
|
||||
})
|
||||
|
||||
it('should return empty edges array', () => {
|
||||
const { result } = renderHook(() => usePipelineTemplate())
|
||||
|
||||
expect(result.current.edges).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('exports', () => {
|
||||
it('should export useAvailableNodesMetaData', () => {
|
||||
expect(useAvailableNodesMetaData).toBeDefined()
|
||||
})
|
||||
|
||||
it('should export useGetRunAndTraceUrl', () => {
|
||||
expect(useGetRunAndTraceUrl).toBeDefined()
|
||||
})
|
||||
|
||||
it('should export useInputFieldPanel', () => {
|
||||
expect(useInputFieldPanel).toBeDefined()
|
||||
})
|
||||
|
||||
it('should export useNodesSyncDraft', () => {
|
||||
expect(useNodesSyncDraft).toBeDefined()
|
||||
})
|
||||
|
||||
it('should export usePipelineInit', () => {
|
||||
expect(usePipelineInit).toBeDefined()
|
||||
})
|
||||
|
||||
it('should export usePipelineRefreshDraft', () => {
|
||||
expect(usePipelineRefreshDraft).toBeDefined()
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
@ -21,7 +21,7 @@ const mockApis = {
|
||||
}
|
||||
|
||||
const mockUseInspectVarsCrudCommon = vi.fn(() => mockApis)
|
||||
vi.mock('../../../workflow/hooks/use-inspect-vars-crud-common', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-inspect-vars-crud-common', () => ({
|
||||
useInspectVarsCrudCommon: (...args: Parameters<typeof mockUseInspectVarsCrudCommon>) =>
|
||||
mockUseInspectVarsCrudCommon(...args),
|
||||
}))
|
||||
|
||||
@ -42,7 +42,7 @@ vi.mock('@/service/workflow', () => ({
|
||||
}))
|
||||
|
||||
const mockHandleRefreshWorkflowDraft = vi.fn()
|
||||
vi.mock('@/app/components/rag-pipeline/hooks', () => ({
|
||||
vi.mock('../use-pipeline-refresh-draft', () => ({
|
||||
usePipelineRefreshDraft: () => ({
|
||||
handleRefreshWorkflowDraft: mockHandleRefreshWorkflowDraft,
|
||||
}),
|
||||
|
||||
@ -11,7 +11,7 @@ vi.mock('@/app/components/workflow/store', () => ({
|
||||
}))
|
||||
|
||||
const mockHandleUpdateWorkflowCanvas = vi.fn()
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-update', () => ({
|
||||
useWorkflowUpdate: () => ({
|
||||
handleUpdateWorkflowCanvas: mockHandleUpdateWorkflowCanvas,
|
||||
}),
|
||||
|
||||
@ -41,7 +41,7 @@ vi.mock('@/app/components/workflow/hooks/use-fetch-workflow-inspect-vars', () =>
|
||||
}))
|
||||
|
||||
const mockHandleUpdateWorkflowCanvas = vi.fn()
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-interactions', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-update', () => ({
|
||||
useWorkflowUpdate: () => ({
|
||||
handleUpdateWorkflowCanvas: mockHandleUpdateWorkflowCanvas,
|
||||
}),
|
||||
|
||||
@ -14,17 +14,20 @@ vi.mock('@/app/components/workflow/store', () => ({
|
||||
}))
|
||||
|
||||
const mockHandleCancelDebugAndPreviewPanel = vi.fn()
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-panel-interactions', () => ({
|
||||
useWorkflowInteractions: () => ({
|
||||
handleCancelDebugAndPreviewPanel: mockHandleCancelDebugAndPreviewPanel,
|
||||
}),
|
||||
}))
|
||||
|
||||
const mockDoSyncWorkflowDraft = vi.fn()
|
||||
vi.mock('@/app/components/rag-pipeline/hooks', () => ({
|
||||
vi.mock('../use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraftByCanEdit: () => ({
|
||||
doSyncWorkflowDraft: mockDoSyncWorkflowDraft,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../use-input-field-panel', () => ({
|
||||
useInputFieldPanel: () => ({
|
||||
closeAllInputFieldPanels: vi.fn(),
|
||||
}),
|
||||
|
||||
@ -26,12 +26,12 @@ vi.mock('reactflow', () => ({
|
||||
|
||||
const mockFindUsedVarNodes = vi.fn()
|
||||
const mockUpdateNodeVars = vi.fn()
|
||||
vi.mock('../../../workflow/nodes/_base/components/variable/utils', () => ({
|
||||
vi.mock('@/app/components/workflow/nodes/_base/components/variable/utils', () => ({
|
||||
findUsedVarNodes: (...args: unknown[]) => mockFindUsedVarNodes(...args),
|
||||
updateNodeVars: (...args: unknown[]) => mockUpdateNodeVars(...args),
|
||||
}))
|
||||
|
||||
vi.mock('../../../workflow/types', () => ({
|
||||
vi.mock('@/app/components/workflow/types', () => ({
|
||||
BlockEnum: {
|
||||
DataSource: 'data-source',
|
||||
},
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
export * from './use-available-nodes-meta-data'
|
||||
export * from './use-DSL'
|
||||
export * from './use-get-run-and-trace-url'
|
||||
export * from './use-input-field-panel'
|
||||
export * from './use-nodes-sync-draft'
|
||||
export * from './use-pipeline-init'
|
||||
export * from './use-pipeline-refresh-draft'
|
||||
export * from './use-pipeline-run'
|
||||
export * from './use-pipeline-start-run'
|
||||
@ -1,4 +1,4 @@
|
||||
import { useInspectVarsCrudCommon } from '../../workflow/hooks/use-inspect-vars-crud-common'
|
||||
import { useInspectVarsCrudCommon } from '@/app/components/workflow/hooks/use-inspect-vars-crud-common'
|
||||
import { useConfigsMap } from './use-configs-map'
|
||||
|
||||
export const useInspectVarsCrud = () => {
|
||||
|
||||
@ -11,7 +11,7 @@ import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { API_PREFIX } from '@/config'
|
||||
import { postWithKeepalive } from '@/service/fetch'
|
||||
import { syncWorkflowDraft } from '@/service/workflow'
|
||||
import { usePipelineRefreshDraft } from '.'
|
||||
import { usePipelineRefreshDraft } from './use-pipeline-refresh-draft'
|
||||
|
||||
const useNodesSyncDraftBase = (getNodesReadOnly: () => boolean) => {
|
||||
const store = useStoreApi()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import type { WorkflowDataUpdater } from '@/app/components/workflow/types'
|
||||
import { useCallback } from 'react'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-update'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { fetchWorkflowDraft } from '@/service/workflow'
|
||||
import { processNodesWithoutDataSource } from '../utils'
|
||||
|
||||
@ -5,8 +5,8 @@ import { produce } from 'immer'
|
||||
import { useCallback, useRef } from 'react'
|
||||
import { useReactFlow, useStoreApi } from 'reactflow'
|
||||
import { useSetWorkflowVarsWithValue } from '@/app/components/workflow/hooks/use-fetch-workflow-inspect-vars'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-interactions'
|
||||
import { useWorkflowRunEvent } from '@/app/components/workflow/hooks/use-workflow-run-event/use-workflow-run-event'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-update'
|
||||
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { WorkflowRunningStatus } from '@/app/components/workflow/types'
|
||||
import { ssePost } from '@/service/base'
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import type { useNodesSyncDraft } from '.'
|
||||
import type { useNodesSyncDraft } from './use-nodes-sync-draft'
|
||||
import { useCallback } from 'react'
|
||||
import { useWorkflowInteractions } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowInteractions } from '@/app/components/workflow/hooks/use-workflow-panel-interactions'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { WorkflowRunningStatus } from '@/app/components/workflow/types'
|
||||
import { useInputFieldPanel, useNodesSyncDraftByCanEdit } from '.'
|
||||
import { useInputFieldPanel } from './use-input-field-panel'
|
||||
import { useNodesSyncDraftByCanEdit } from './use-nodes-sync-draft'
|
||||
|
||||
type DoSyncWorkflowDraft = ReturnType<typeof useNodesSyncDraft>['doSyncWorkflowDraft']
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import type { DataSourceNodeType } from '../../workflow/nodes/data-source/types'
|
||||
import type { Node, ValueSelector } from '../../workflow/types'
|
||||
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||
import type { Node, ValueSelector } from '@/app/components/workflow/types'
|
||||
import { uniqBy } from 'es-toolkit/compat'
|
||||
import { useCallback } from 'react'
|
||||
import { getOutgoers, useStoreApi } from 'reactflow'
|
||||
import {
|
||||
findUsedVarNodes,
|
||||
updateNodeVars,
|
||||
} from '../../workflow/nodes/_base/components/variable/utils'
|
||||
import { BlockEnum } from '../../workflow/types'
|
||||
} from '@/app/components/workflow/nodes/_base/components/variable/utils'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
|
||||
export const usePipeline = () => {
|
||||
const store = useStoreApi()
|
||||
|
||||
@ -7,7 +7,7 @@ import { initialEdges, initialNodes } from '@/app/components/workflow/utils'
|
||||
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
|
||||
import Conversion from './components/conversion'
|
||||
import RagPipelineMain from './components/rag-pipeline-main'
|
||||
import { usePipelineInit } from './hooks'
|
||||
import { usePipelineInit } from './hooks/use-pipeline-init'
|
||||
import { createRagPipelineSliceSlice } from './store'
|
||||
import { processNodesWithoutDataSource } from './utils'
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ vi.mock('@/service/use-snippet-workflows', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/snippets/hooks/use-configs-map', () => ({
|
||||
vi.mock('../../hooks/use-configs-map', () => ({
|
||||
useConfigsMap: () => ({
|
||||
flowId: 'snippet-1',
|
||||
flowType: 'snippet',
|
||||
@ -102,15 +102,15 @@ vi.mock('@/app/components/workflow/hooks/use-checklist', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-available-nodes-meta-data', () => ({
|
||||
useAvailableNodesMetaData: () => mockUseAvailableNodesMetaData(),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/snippets/hooks/use-inspect-vars-crud', () => ({
|
||||
vi.mock('../../hooks/use-inspect-vars-crud', () => ({
|
||||
useInspectVarsCrud: () => mockInspectVarsCrud,
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/snippets/hooks/use-nodes-sync-draft', () => ({
|
||||
vi.mock('../../hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => ({
|
||||
doSyncWorkflowDraft: mockDoSyncWorkflowDraft,
|
||||
syncInputFieldsDraft: mockSyncInputFieldsDraft,
|
||||
@ -118,13 +118,13 @@ vi.mock('@/app/components/snippets/hooks/use-nodes-sync-draft', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/snippets/hooks/use-snippet-refresh-draft', () => ({
|
||||
vi.mock('../../hooks/use-snippet-refresh-draft', () => ({
|
||||
useSnippetRefreshDraft: () => ({
|
||||
handleRefreshWorkflowDraft: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/snippets/hooks/use-snippet-run', () => ({
|
||||
vi.mock('../../hooks/use-snippet-run', () => ({
|
||||
useSnippetRun: () => ({
|
||||
handleBackupDraft: mockHandleBackupDraft,
|
||||
handleLoadBackupDraft: mockHandleLoadBackupDraft,
|
||||
@ -134,7 +134,7 @@ vi.mock('@/app/components/snippets/hooks/use-snippet-run', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/snippets/hooks/use-snippet-start-run', () => ({
|
||||
vi.mock('../../hooks/use-snippet-start-run', () => ({
|
||||
useSnippetStartRun: () => ({
|
||||
handleStartWorkflowRun: mockHandleStartWorkflowRun,
|
||||
handleWorkflowStartRunInWorkflow: mockHandleWorkflowStartRunInWorkflow,
|
||||
|
||||
@ -35,10 +35,13 @@ vi.mock('@/app/components/base/chat/chat/check-input-forms-hooks', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-panel-interactions', () => ({
|
||||
useWorkflowInteractions: () => ({
|
||||
handleCancelDebugAndPreviewPanel: workflowHookMocks.handleCancelDebugAndPreviewPanel,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-run', () => ({
|
||||
useWorkflowRun: () => ({
|
||||
handleRun: workflowHookMocks.handleRun,
|
||||
}),
|
||||
|
||||
@ -21,15 +21,18 @@ const runningResult = {
|
||||
outputs_truncated: false,
|
||||
}
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
useWorkflowStartRun: () => ({
|
||||
handleWorkflowStartRunInWorkflow: workflowHookMocks.handleWorkflowStartRunInWorkflow,
|
||||
}),
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-run', () => ({
|
||||
useWorkflowRun: () => ({
|
||||
handleStopRun: workflowHookMocks.handleStopRun,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-start-run', () => ({
|
||||
useWorkflowStartRun: () => ({
|
||||
handleWorkflowStartRunInWorkflow: workflowHookMocks.handleWorkflowStartRunInWorkflow,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/context/event-emitter', () => ({
|
||||
useEventEmitterContextContext: () => ({
|
||||
eventEmitter: {
|
||||
|
||||
@ -4,7 +4,8 @@ import { cn } from '@langgenius/dify-ui/cn'
|
||||
import * as React from 'react'
|
||||
import { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useWorkflowRun, useWorkflowStartRun } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowRun } from '@/app/components/workflow/hooks/use-workflow-run'
|
||||
import { useWorkflowStartRun } from '@/app/components/workflow/hooks/use-workflow-start-run'
|
||||
import { TEST_RUN_MENU_HOTKEY } from '@/app/components/workflow/hotkeys'
|
||||
import { ShortcutKbd } from '@/app/components/workflow/shortcuts/shortcut-kbd'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
|
||||
@ -10,7 +10,7 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useState } from 'reac
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useShallow } from 'zustand/react/shallow'
|
||||
import { WorkflowWithInnerContext } from '@/app/components/workflow'
|
||||
import { useAvailableNodesMetaData } from '@/app/components/workflow-app/hooks'
|
||||
import { useAvailableNodesMetaData } from '@/app/components/workflow-app/hooks/use-available-nodes-meta-data'
|
||||
import { useSetWorkflowVarsWithValue } from '@/app/components/workflow/hooks/use-fetch-workflow-inspect-vars'
|
||||
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
|
||||
@ -11,7 +11,8 @@ import { useTranslation } from 'react-i18next'
|
||||
import { useCheckInputsForms } from '@/app/components/base/chat/chat/check-input-forms-hooks'
|
||||
import { getProcessedInputs } from '@/app/components/base/chat/chat/utils'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import { useWorkflowInteractions, useWorkflowRun } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowInteractions } from '@/app/components/workflow/hooks/use-workflow-panel-interactions'
|
||||
import { useWorkflowRun } from '@/app/components/workflow/hooks/use-workflow-run'
|
||||
import FormItem from '@/app/components/workflow/nodes/_base/components/before-run-form/form-item'
|
||||
import ResultPanel from '@/app/components/workflow/run/result-panel'
|
||||
import ResultText from '@/app/components/workflow/run/result-text'
|
||||
|
||||
@ -20,7 +20,7 @@ const mockApis = {
|
||||
}
|
||||
|
||||
const mockUseInspectVarsCrudCommon = vi.fn(() => mockApis)
|
||||
vi.mock('../../../workflow/hooks/use-inspect-vars-crud-common', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-inspect-vars-crud-common', () => ({
|
||||
useInspectVarsCrudCommon: (...args: Parameters<typeof mockUseInspectVarsCrudCommon>) =>
|
||||
mockUseInspectVarsCrudCommon(...args),
|
||||
}))
|
||||
|
||||
@ -19,7 +19,7 @@ vi.mock('@/service/use-snippet-workflows', () => ({
|
||||
fetchSnippetDraftWorkflow: (...args: unknown[]) => mockFetchSnippetDraftWorkflow(...args),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-update', () => ({
|
||||
useWorkflowUpdate: () => ({
|
||||
handleUpdateWorkflowCanvas: mockHandleUpdateWorkflowCanvas,
|
||||
}),
|
||||
|
||||
@ -82,7 +82,7 @@ vi.mock('@/app/components/workflow/hooks/use-fetch-workflow-inspect-vars', () =>
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-interactions', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-update', () => ({
|
||||
useWorkflowUpdate: () => ({
|
||||
handleUpdateWorkflowCanvas: mocks.mockHandleUpdateWorkflowCanvas,
|
||||
}),
|
||||
|
||||
@ -15,7 +15,7 @@ vi.mock('@/app/components/workflow/store', () => ({
|
||||
}))
|
||||
|
||||
const mockHandleCancelDebugAndPreviewPanel = vi.fn()
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-panel-interactions', () => ({
|
||||
useWorkflowInteractions: () => ({
|
||||
handleCancelDebugAndPreviewPanel: mockHandleCancelDebugAndPreviewPanel,
|
||||
}),
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useInspectVarsCrudCommon } from '../../workflow/hooks/use-inspect-vars-crud-common'
|
||||
import { useInspectVarsCrudCommon } from '@/app/components/workflow/hooks/use-inspect-vars-crud-common'
|
||||
import { useConfigsMap } from './use-configs-map'
|
||||
|
||||
export const useInspectVarsCrud = (snippetId: string) => {
|
||||
|
||||
@ -2,7 +2,7 @@ import type { WorkflowDataUpdater } from '@/app/components/workflow/types'
|
||||
import type { SnippetInputField } from '@/models/snippet'
|
||||
import type { SnippetWorkflow } from '@/types/snippet'
|
||||
import { useCallback } from 'react'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-update'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { fetchSnippetDraftWorkflow } from '@/service/use-snippet-workflows'
|
||||
import { useSnippetDraftStore } from '../draft-store'
|
||||
|
||||
@ -5,8 +5,8 @@ import { produce } from 'immer'
|
||||
import { useCallback, useRef } from 'react'
|
||||
import { useReactFlow, useStoreApi } from 'reactflow'
|
||||
import { useSetWorkflowVarsWithValue } from '@/app/components/workflow/hooks/use-fetch-workflow-inspect-vars'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-interactions'
|
||||
import { useWorkflowRunEvent } from '@/app/components/workflow/hooks/use-workflow-run-event/use-workflow-run-event'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-update'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { WorkflowRunningStatus } from '@/app/components/workflow/types'
|
||||
import { ssePost } from '@/service/base'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import type { SnippetDraftRunPayload } from '@/types/snippet'
|
||||
import { useCallback } from 'react'
|
||||
import { useWorkflowInteractions } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowInteractions } from '@/app/components/workflow/hooks/use-workflow-panel-interactions'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { WorkflowRunningStatus } from '@/app/components/workflow/types'
|
||||
import { useSnippetDraftStore } from '../draft-store'
|
||||
|
||||
@ -127,11 +127,11 @@ vi.mock('@/service/use-tools', () => ({
|
||||
useAppTriggers: () => appTriggersState,
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-workflow-init', () => ({
|
||||
vi.mock('../hooks/use-workflow-init', () => ({
|
||||
useWorkflowInit: () => workflowInitState,
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-get-run-and-trace-url', () => ({
|
||||
vi.mock('../hooks/use-get-run-and-trace-url', () => ({
|
||||
useGetRunAndTraceUrl: () => ({
|
||||
getWorkflowRunAndTraceUrl: mockGetWorkflowRunAndTraceUrl,
|
||||
}),
|
||||
|
||||
@ -86,23 +86,37 @@ vi.mock('@/context/event-emitter', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-DSL', () => ({
|
||||
useAutoGenerateWebhookUrl: () => mockAutoGenerateWebhookUrl,
|
||||
useDSL: () => ({
|
||||
exportCheck: mockExportCheck,
|
||||
handleExportDSL: mockHandleExportDSL,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-panel-interactions', () => ({
|
||||
usePanelInteractions: () => ({
|
||||
handlePaneContextmenuCancel: mockHandlePaneContextmenuCancel,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-panel-interactions', () => ({
|
||||
usePanelInteractions: () => ({
|
||||
handlePaneContextmenuCancel: mockHandlePaneContextmenuCancel,
|
||||
handlePaneContextMenu: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => ({
|
||||
handleSyncWorkflowDraft: mockHandleSyncWorkflowDraft,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-auto-generate-webhook-url', () => ({
|
||||
useAutoGenerateWebhookUrl: () => mockAutoGenerateWebhookUrl,
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/utils', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('@/app/components/workflow/utils')>()
|
||||
return {
|
||||
@ -120,7 +134,7 @@ vi.mock('@/app/components/workflow/utils', async (importOriginal) => {
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
vi.mock('../../hooks/use-available-nodes-meta-data', () => ({
|
||||
useAvailableNodesMetaData: () => ({
|
||||
nodesMap: {
|
||||
[BlockEnum.Start]: {
|
||||
@ -145,7 +159,7 @@ vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-auto-onboarding', () => ({
|
||||
vi.mock('../../hooks/use-auto-onboarding', () => ({
|
||||
useAutoOnboarding: () => ({
|
||||
handleOnboardingClose: mockHandleOnboardingClose,
|
||||
}),
|
||||
|
||||
@ -141,7 +141,7 @@ vi.mock('@/app/components/workflow/collaboration/hooks/use-collaboration', () =>
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-interactions', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-update', () => ({
|
||||
useWorkflowUpdate: () => ({
|
||||
handleUpdateWorkflowCanvas: mockHandleUpdateWorkflowCanvas,
|
||||
}),
|
||||
@ -274,18 +274,30 @@ vi.mock('@/app/components/workflow', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
vi.mock('../../hooks/use-available-nodes-meta-data', () => ({
|
||||
useAvailableNodesMetaData: () => ({
|
||||
nodes: [{ id: 'start' }],
|
||||
nodesMap: { start: { id: 'start' } },
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-configs-map', () => ({
|
||||
useConfigsMap: () => ({ flowId: 'app-1', flowType: 'app-flow', fileSettings: { enabled: true } }),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-DSL', () => ({
|
||||
useDSL: () => ({ exportCheck: hookFns.exportCheck, handleExportDSL: hookFns.handleExportDSL }),
|
||||
useDSLByCanEdit: () => ({
|
||||
exportCheck: hookFns.exportCheck,
|
||||
handleExportDSL: hookFns.handleExportDSL,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-get-run-and-trace-url', () => ({
|
||||
useGetRunAndTraceUrl: () => ({ getWorkflowRunAndTraceUrl: hookFns.getWorkflowRunAndTraceUrl }),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-inspect-vars-crud', () => ({
|
||||
useInspectVarsCrud: () => ({
|
||||
hasNodeInspectVars: hookFns.hasNodeInspectVars,
|
||||
hasSetInspectVar: hookFns.hasSetInspectVar,
|
||||
@ -302,6 +314,9 @@ vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
resetConversationVar: hookFns.resetConversationVar,
|
||||
invalidateConversationVarValues: hookFns.invalidateConversationVarValues,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => ({
|
||||
doSyncWorkflowDraft: hookFns.doSyncWorkflowDraft,
|
||||
syncWorkflowDraftWhenPageClose: hookFns.syncWorkflowDraftWhenPageClose,
|
||||
@ -310,12 +325,15 @@ vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
doSyncWorkflowDraft: hookFns.doSyncWorkflowDraft,
|
||||
syncWorkflowDraftWhenPageClose: hookFns.syncWorkflowDraftWhenPageClose,
|
||||
}),
|
||||
useSetWorkflowVarsWithValue: () => ({
|
||||
fetchInspectVars: hookFns.fetchInspectVars,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-workflow-refresh-draft', () => ({
|
||||
useWorkflowRefreshDraft: () => ({
|
||||
handleRefreshWorkflowDraft: hookFns.handleRefreshWorkflowDraft,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-workflow-run', () => ({
|
||||
useWorkflowRun: () => ({
|
||||
handleBackupDraft: hookFns.handleBackupDraft,
|
||||
handleLoadBackupDraft: hookFns.handleLoadBackupDraft,
|
||||
@ -330,6 +348,9 @@ vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
handleRun: hookFns.handleRun,
|
||||
handleStopRun: hookFns.handleStopRun,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-workflow-start-run', () => ({
|
||||
useWorkflowStartRun: () => ({
|
||||
handleStartWorkflowRun: hookFns.handleStartWorkflowRun,
|
||||
handleWorkflowStartRunInChatflow: hookFns.handleWorkflowStartRunInChatflow,
|
||||
@ -350,7 +371,13 @@ vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-workflow-draft-graph-for-canvas', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-fetch-workflow-inspect-vars', () => ({
|
||||
useSetWorkflowVarsWithValue: () => ({
|
||||
fetchInspectVars: hookFns.fetchInspectVars,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../hooks/use-workflow-draft-graph-for-canvas', () => ({
|
||||
useWorkflowDraftGraphForCanvas: () => ({
|
||||
getWorkflowDraftGraphForCanvas: (graph?: {
|
||||
nodes?: unknown[]
|
||||
@ -366,7 +393,7 @@ vi.mock('@/app/components/workflow-app/hooks/use-workflow-draft-graph-for-canvas
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-workflow-draft-graph-for-canvas', () => ({
|
||||
vi.mock('../../hooks/use-workflow-draft-graph-for-canvas', () => ({
|
||||
useWorkflowDraftGraphForCanvas: () => ({
|
||||
getWorkflowDraftGraphForCanvas: (graph?: {
|
||||
nodes?: unknown[]
|
||||
|
||||
@ -130,7 +130,7 @@ vi.mock('@/app/components/workflow/panel/global-variable-panel', () => ({
|
||||
default: () => <div data-testid="global-variable-panel">global-variable</div>,
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
vi.mock('../../hooks/use-is-chat-mode', () => ({
|
||||
useIsChatMode: () => mockUseIsChatMode(),
|
||||
}))
|
||||
|
||||
|
||||
@ -6,21 +6,19 @@ import type { EnvironmentVariable } from '@/app/components/workflow/types'
|
||||
import { memo, useCallback, useState } from 'react'
|
||||
import { useStoreApi } from 'reactflow'
|
||||
import { DSL_EXPORT_CHECK, START_INITIAL_POSITION } from '@/app/components/workflow/constants'
|
||||
import {
|
||||
useAutoGenerateWebhookUrl,
|
||||
useDSL,
|
||||
usePanelInteractions,
|
||||
} from '@/app/components/workflow/hooks'
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
||||
import { useAutoGenerateWebhookUrl } from '@/app/components/workflow/hooks/use-auto-generate-webhook-url'
|
||||
import { useDSL } from '@/app/components/workflow/hooks/use-DSL'
|
||||
import { useNodesSyncDraft } from '@/app/components/workflow/hooks/use-nodes-sync-draft'
|
||||
import { usePanelInteractions } from '@/app/components/workflow/hooks/use-panel-interactions'
|
||||
import PluginDependency from '@/app/components/workflow/plugin-dependency'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import { generateNewNode } from '@/app/components/workflow/utils'
|
||||
import { useEventEmitterContextContext } from '@/context/event-emitter'
|
||||
import dynamic from '@/next/dynamic'
|
||||
import PluginDependency from '../../workflow/plugin-dependency'
|
||||
import { useAvailableNodesMetaData } from '../hooks'
|
||||
import { useAutoOnboarding } from '../hooks/use-auto-onboarding'
|
||||
import { useAvailableNodesMetaData } from '../hooks/use-available-nodes-meta-data'
|
||||
import WorkflowHeader from './workflow-header'
|
||||
import WorkflowPanel from './workflow-panel'
|
||||
|
||||
|
||||
@ -4,11 +4,11 @@ import ChatVariableTrigger from '../chat-variable-trigger'
|
||||
const mockUseNodesReadOnly = vi.fn()
|
||||
const mockUseIsChatMode = vi.fn()
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow', () => ({
|
||||
useNodesReadOnly: () => mockUseNodesReadOnly(),
|
||||
}))
|
||||
|
||||
vi.mock('../../../hooks', () => ({
|
||||
vi.mock('../../../hooks/use-is-chat-mode', () => ({
|
||||
useIsChatMode: () => mockUseIsChatMode(),
|
||||
}))
|
||||
|
||||
|
||||
@ -75,12 +75,18 @@ const mockWorkflowStore = {
|
||||
setState: mockWorkflowStoreSetState,
|
||||
}
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow', () => ({
|
||||
useNodesReadOnly: () => mockUseNodesReadOnly(),
|
||||
useIsChatMode: () => mockUseIsChatMode(),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-checklist', () => ({
|
||||
useChecklist: (...args: unknown[]) => mockUseChecklist(...args),
|
||||
useChecklistBeforePublish: () => mockUseChecklistBeforePublish(),
|
||||
useNodesReadOnly: () => mockUseNodesReadOnly(),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => mockUseNodesSyncDraft(),
|
||||
useIsChatMode: () => mockUseIsChatMode(),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/store', () => ({
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { memo } from 'react'
|
||||
import ChatVariableButton from '@/app/components/workflow/header/chat-variable-button'
|
||||
import { useNodesReadOnly } from '@/app/components/workflow/hooks'
|
||||
import { useIsChatMode } from '../../hooks'
|
||||
import { useNodesReadOnly } from '@/app/components/workflow/hooks/use-workflow'
|
||||
import { useIsChatMode } from '../../hooks/use-is-chat-mode'
|
||||
|
||||
const ChatVariableTrigger = () => {
|
||||
const { nodesReadOnly } = useNodesReadOnly()
|
||||
|
||||
@ -13,15 +13,14 @@ import { AppPublisher } from '@/app/components/app/app-publisher'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
import { useFeatures } from '@/app/components/base/features/hooks'
|
||||
import { Plan } from '@/app/components/billing/type'
|
||||
// useWorkflowRunValidation,
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
||||
import {
|
||||
useChecklist,
|
||||
useChecklistBeforePublish,
|
||||
useIsChatMode,
|
||||
useNodesReadOnly,
|
||||
useNodesSyncDraft,
|
||||
// useWorkflowRunValidation,
|
||||
} from '@/app/components/workflow/hooks'
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
||||
} from '@/app/components/workflow/hooks/use-checklist'
|
||||
import { useNodesSyncDraft } from '@/app/components/workflow/hooks/use-nodes-sync-draft'
|
||||
import { useIsChatMode, useNodesReadOnly } from '@/app/components/workflow/hooks/use-workflow'
|
||||
import { isAgentV2NodeData } from '@/app/components/workflow/nodes/agent-v2/types'
|
||||
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
|
||||
|
||||
@ -4,7 +4,7 @@ import { useShallow } from 'zustand/react/shallow'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
import Header from '@/app/components/workflow/header'
|
||||
import { useResetWorkflowVersionHistory } from '@/service/use-workflow'
|
||||
import { useIsChatMode } from '../../hooks'
|
||||
import { useIsChatMode } from '../../hooks/use-is-chat-mode'
|
||||
import ChatVariableTrigger from './chat-variable-trigger'
|
||||
import FeaturesTrigger from './features-trigger'
|
||||
|
||||
|
||||
@ -12,28 +12,26 @@ import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
import { useFeaturesStore } from '@/app/components/base/features/hooks'
|
||||
import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'
|
||||
import { WorkflowWithInnerContext } from '@/app/components/workflow'
|
||||
import { useWorkflowDraftGraphForCanvas } from '@/app/components/workflow-app/hooks/use-workflow-draft-graph-for-canvas'
|
||||
import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager'
|
||||
import { useCollaboration } from '@/app/components/workflow/collaboration/hooks/use-collaboration'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-interactions'
|
||||
import { useSetWorkflowVarsWithValue } from '@/app/components/workflow/hooks/use-fetch-workflow-inspect-vars'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-update'
|
||||
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { SupportUploadFileTypes } from '@/app/components/workflow/types'
|
||||
import { userProfileIdAtom } from '@/context/account-state'
|
||||
import { workspacePermissionKeysAtom } from '@/context/permission-state'
|
||||
import { fetchWorkflowDraft } from '@/service/workflow'
|
||||
import { getAppACLCapabilities } from '@/utils/permission'
|
||||
import {
|
||||
useAvailableNodesMetaData,
|
||||
useConfigsMap,
|
||||
useDSLByCanEdit,
|
||||
useGetRunAndTraceUrl,
|
||||
useInspectVarsCrud,
|
||||
useNodesSyncDraftByCanEdit,
|
||||
useSetWorkflowVarsWithValue,
|
||||
useWorkflowRefreshDraft,
|
||||
useWorkflowRunByCanEdit,
|
||||
useWorkflowStartRunByCanEdit,
|
||||
} from '../hooks'
|
||||
import { useAvailableNodesMetaData } from '../hooks/use-available-nodes-meta-data'
|
||||
import { useConfigsMap } from '../hooks/use-configs-map'
|
||||
import { useDSLByCanEdit } from '../hooks/use-DSL'
|
||||
import { useGetRunAndTraceUrl } from '../hooks/use-get-run-and-trace-url'
|
||||
import { useInspectVarsCrud } from '../hooks/use-inspect-vars-crud'
|
||||
import { useNodesSyncDraftByCanEdit } from '../hooks/use-nodes-sync-draft'
|
||||
import { useWorkflowDraftGraphForCanvas } from '../hooks/use-workflow-draft-graph-for-canvas'
|
||||
import { useWorkflowRefreshDraft } from '../hooks/use-workflow-refresh-draft'
|
||||
import { useWorkflowRunByCanEdit } from '../hooks/use-workflow-run'
|
||||
import { useWorkflowStartRunByCanEdit } from '../hooks/use-workflow-start-run'
|
||||
import WorkflowChildren from './workflow-children'
|
||||
|
||||
type WorkflowMainProps = Pick<WorkflowProps, 'nodes' | 'edges' | 'viewport'>
|
||||
|
||||
@ -6,7 +6,7 @@ import Panel from '@/app/components/workflow/panel'
|
||||
import CommentsPanel from '@/app/components/workflow/panel/comments-panel'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import dynamic from '@/next/dynamic'
|
||||
import { useIsChatMode } from '../hooks'
|
||||
import { useIsChatMode } from '../hooks/use-is-chat-mode'
|
||||
|
||||
const MessageLogModal = dynamic(() => import('@/app/components/base/message-log-modal'), {
|
||||
ssr: false,
|
||||
|
||||
@ -5,7 +5,7 @@ import { useAvailableNodesMetaData } from '../use-available-nodes-meta-data'
|
||||
const mockUseIsChatMode = vi.fn()
|
||||
const mockIsAgentV2Enabled = vi.hoisted(() => vi.fn(() => true))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-is-chat-mode', () => ({
|
||||
vi.mock('../use-is-chat-mode', () => ({
|
||||
useIsChatMode: () => mockUseIsChatMode(),
|
||||
}))
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ vi.mock('@/config', async (importOriginal) => {
|
||||
})
|
||||
|
||||
const mockHandleRefreshWorkflowDraft = vi.fn()
|
||||
vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
vi.mock('../use-workflow-refresh-draft', () => ({
|
||||
useWorkflowRefreshDraft: () => ({ handleRefreshWorkflowDraft: mockHandleRefreshWorkflowDraft }),
|
||||
}))
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ vi.mock('@/app/components/app/store', () => ({
|
||||
useStore: <T>(selector: (state: typeof appStoreState) => T): T => selector(appStoreState),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-update', () => ({
|
||||
useWorkflowUpdate: () => ({ handleUpdateWorkflowCanvas: mockHandleUpdateWorkflowCanvas }),
|
||||
}))
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ vi.mock('@/app/components/base/features/hooks', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-interactions', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-update', () => ({
|
||||
useWorkflowUpdate: () => ({
|
||||
handleUpdateWorkflowCanvas: mocks.mockHandleUpdateWorkflowCanvas,
|
||||
}),
|
||||
|
||||
@ -37,7 +37,7 @@ vi.mock('@/app/components/base/features/hooks', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow-panel-interactions', () => ({
|
||||
useWorkflowInteractions: () => ({
|
||||
handleCancelDebugAndPreviewPanel: mockHandleCancelDebugAndPreviewPanel,
|
||||
}),
|
||||
@ -49,11 +49,17 @@ vi.mock('@/app/components/workflow/store', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow/hooks/use-workflow', () => ({
|
||||
useIsChatMode: () => mockUseIsChatMode(),
|
||||
}))
|
||||
|
||||
vi.mock('../use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraftByCanEdit: () => ({
|
||||
doSyncWorkflowDraft: mockDoSyncWorkflowDraft,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../use-workflow-run', () => ({
|
||||
useWorkflowRunByCanEdit: () => ({
|
||||
handleRun: mockHandleRun,
|
||||
}),
|
||||
|
||||
@ -10,7 +10,7 @@ let appStoreState: {
|
||||
}
|
||||
}
|
||||
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-is-chat-mode', () => ({
|
||||
vi.mock('../use-is-chat-mode', () => ({
|
||||
useIsChatMode: () => mockUseIsChatMode(),
|
||||
}))
|
||||
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
export * from '../../workflow/hooks/use-fetch-workflow-inspect-vars'
|
||||
export * from './use-available-nodes-meta-data'
|
||||
export * from './use-configs-map'
|
||||
export * from './use-DSL'
|
||||
export * from './use-get-run-and-trace-url'
|
||||
export * from './use-inspect-vars-crud'
|
||||
export * from './use-is-chat-mode'
|
||||
export * from './use-nodes-sync-draft'
|
||||
export * from './use-workflow-init'
|
||||
export * from './use-workflow-refresh-draft'
|
||||
export * from './use-workflow-run'
|
||||
export * from './use-workflow-start-run'
|
||||
export * from './use-workflow-template'
|
||||
@ -1,4 +1,4 @@
|
||||
import { useInspectVarsCrudCommon } from '../../workflow/hooks/use-inspect-vars-crud-common'
|
||||
import { useInspectVarsCrudCommon } from '@/app/components/workflow/hooks/use-inspect-vars-crud-common'
|
||||
import { useConfigsMap } from './use-configs-map'
|
||||
|
||||
export const useInspectVarsCrud = () => {
|
||||
|
||||
@ -25,7 +25,7 @@ import { API_PREFIX } from '@/config'
|
||||
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
|
||||
import { postWithKeepalive } from '@/service/fetch'
|
||||
import { syncWorkflowDraft } from '@/service/workflow'
|
||||
import { useWorkflowRefreshDraft } from '.'
|
||||
import { useWorkflowRefreshDraft } from './use-workflow-refresh-draft'
|
||||
|
||||
const useNodesSyncDraftBase = (getNodesReadOnly: () => boolean) => {
|
||||
const store = useStoreApi()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useCallback, useRef } from 'react'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-update'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { fetchWorkflowDraft } from '@/service/workflow'
|
||||
import { useWorkflowDraftGraphForCanvas } from './use-workflow-draft-graph-for-canvas'
|
||||
|
||||
@ -13,15 +13,15 @@ import { trackEvent } from '@/app/components/base/amplitude'
|
||||
import { AudioPlayerManager } from '@/app/components/base/audio-btn/audio.player.manager'
|
||||
import { useFeaturesStore } from '@/app/components/base/features/hooks'
|
||||
import { TriggerType } from '@/app/components/workflow/header/test-run-menu'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-interactions'
|
||||
import { useSetWorkflowVarsWithValue } from '@/app/components/workflow/hooks/use-fetch-workflow-inspect-vars'
|
||||
import { useWorkflowRunEvent } from '@/app/components/workflow/hooks/use-workflow-run-event/use-workflow-run-event'
|
||||
import { useWorkflowUpdate } from '@/app/components/workflow/hooks/use-workflow-update'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { usePathname } from '@/next/navigation'
|
||||
import { ssePost } from '@/service/base'
|
||||
import { useInvalidAllLastRun, useInvalidateWorkflowRunHistory } from '@/service/use-workflow'
|
||||
import { stopWorkflowRun } from '@/service/workflow'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
import { useSetWorkflowVarsWithValue } from '../../workflow/hooks/use-fetch-workflow-inspect-vars'
|
||||
import { useConfigsMap } from './use-configs-map'
|
||||
import { useNodesSyncDraft, useNodesSyncDraftByCanEdit } from './use-nodes-sync-draft'
|
||||
import {
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
import type { useNodesSyncDraft, useWorkflowRun } from '.'
|
||||
import type { useNodesSyncDraft } from './use-nodes-sync-draft'
|
||||
import type { useWorkflowRun } from './use-workflow-run'
|
||||
import { useCallback } from 'react'
|
||||
import { useStoreApi } from 'reactflow'
|
||||
import { useFeaturesStore } from '@/app/components/base/features/hooks'
|
||||
import { TriggerType } from '@/app/components/workflow/header/test-run-menu'
|
||||
import { useWorkflowInteractions } from '@/app/components/workflow/hooks'
|
||||
import { useIsChatMode } from '@/app/components/workflow/hooks/use-workflow'
|
||||
import { useWorkflowInteractions } from '@/app/components/workflow/hooks/use-workflow-panel-interactions'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { BlockEnum, WorkflowRunningStatus } from '@/app/components/workflow/types'
|
||||
import { useIsChatMode, useNodesSyncDraftByCanEdit, useWorkflowRunByCanEdit } from '.'
|
||||
import { useNodesSyncDraftByCanEdit } from './use-nodes-sync-draft'
|
||||
import { useWorkflowRunByCanEdit } from './use-workflow-run'
|
||||
|
||||
type HandleRun = ReturnType<typeof useWorkflowRun>['handleRun']
|
||||
type DoSyncWorkflowDraft = ReturnType<typeof useNodesSyncDraft>['doSyncWorkflowDraft']
|
||||
|
||||
@ -47,11 +47,20 @@ vi.mock('@/app/components/workflow/store', () => ({
|
||||
useWorkflowStore: () => mockUseWorkflowStore(),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
useNodesInteractions: () => mockUseHooks().useNodesInteractions(),
|
||||
useNodesSyncDraft: () => mockUseHooks().useNodesSyncDraft(),
|
||||
useWorkflowHistory: () => mockUseHooks().useWorkflowHistory(),
|
||||
vi.mock('../hooks/use-auto-generate-webhook-url', () => ({
|
||||
useAutoGenerateWebhookUrl: () => mockUseHooks().useAutoGenerateWebhookUrl(),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-nodes-interactions', () => ({
|
||||
useNodesInteractions: () => mockUseHooks().useNodesInteractions(),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => mockUseHooks().useNodesSyncDraft(),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-workflow-history', () => ({
|
||||
useWorkflowHistory: () => mockUseHooks().useWorkflowHistory(),
|
||||
WorkflowHistoryEvent: {
|
||||
NodeAdd: 'NodeAdd',
|
||||
NoteAdd: 'NoteAdd',
|
||||
|
||||
@ -41,10 +41,23 @@ vi.mock('reactflow', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
useAvailableBlocks: (...args: unknown[]) => mockUseAvailableBlocks(...args),
|
||||
useNodesInteractions: () => mockUseNodesInteractions(),
|
||||
}))
|
||||
vi.mock('../hooks/use-available-blocks', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-available-blocks')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useAvailableBlocks: (...args: unknown[]) => mockUseAvailableBlocks(...args),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks/use-nodes-interactions', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-nodes-interactions')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useNodesInteractions: () => mockUseNodesInteractions(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('@/app/components/workflow/block-selector', () => ({
|
||||
__esModule: true,
|
||||
|
||||
@ -35,16 +35,6 @@ vi.mock('../utils', async (importOriginal) => {
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks', async () => {
|
||||
const { useEdgesInteractions } = await import('../hooks/use-edges-interactions')
|
||||
const { usePanelInteractions } = await import('../hooks/use-panel-interactions')
|
||||
|
||||
return {
|
||||
useEdgesInteractions,
|
||||
usePanelInteractions,
|
||||
}
|
||||
})
|
||||
|
||||
type EdgeRuntimeState = {
|
||||
_hovering?: boolean
|
||||
_isBundled?: boolean
|
||||
|
||||
@ -31,8 +31,8 @@ const mockFeaturesStore = {
|
||||
let mockIsChatMode = true
|
||||
let mockNodesReadOnly = false
|
||||
|
||||
vi.mock('../hooks', async () => {
|
||||
const actual = await vi.importActual<typeof import('../hooks')>('../hooks')
|
||||
vi.mock('../hooks/use-workflow', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-workflow')>()
|
||||
return {
|
||||
...actual,
|
||||
useIsChatMode: () => mockIsChatMode,
|
||||
|
||||
@ -24,17 +24,78 @@ vi.mock('react-i18next', () => ({
|
||||
useTranslation: () => mockUseTranslation(),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/workflow/hooks', () => ({
|
||||
useAvailableBlocks: () => mockUseAvailableBlocks(),
|
||||
useDSL: () => mockUseDSL(),
|
||||
useIsChatMode: () => mockUseIsChatMode(),
|
||||
useNodesInteractions: () => mockUseNodesInteractions(),
|
||||
useNodesMetaData: () => mockUseNodesMetaData(),
|
||||
useNodesReadOnly: () => mockUseNodesReadOnly(),
|
||||
usePanelInteractions: () => mockUsePanelInteractions(),
|
||||
useWorkflowMoveMode: () => mockUseWorkflowMoveMode(),
|
||||
useWorkflowStartRun: () => mockUseWorkflowStartRun(),
|
||||
}))
|
||||
vi.mock('../hooks/use-DSL', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-DSL')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useDSL: () => mockUseDSL(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks/use-available-blocks', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-available-blocks')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useAvailableBlocks: () => mockUseAvailableBlocks(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks/use-nodes-interactions', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-nodes-interactions')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useNodesInteractions: () => mockUseNodesInteractions(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks/use-nodes-meta-data', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-nodes-meta-data')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useNodesMetaData: () => mockUseNodesMetaData(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks/use-panel-interactions', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-panel-interactions')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
usePanelInteractions: () => mockUsePanelInteractions(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks/use-workflow', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-workflow')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useIsChatMode: () => mockUseIsChatMode(),
|
||||
useNodesReadOnly: () => mockUseNodesReadOnly(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks/use-workflow-panel-interactions', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-workflow-panel-interactions')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useWorkflowMoveMode: () => mockUseWorkflowMoveMode(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks/use-workflow-start-run', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-workflow-start-run')>()
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useWorkflowStartRun: () => mockUseWorkflowStartRun(),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('@/app/components/workflow/operator/hooks', () => ({
|
||||
useOperator: () => mockUseOperator(),
|
||||
|
||||
@ -65,13 +65,20 @@ vi.mock('@/app/components/snippets/create-snippet-dialog', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('../hooks', async () => {
|
||||
const actual = await vi.importActual<typeof import('../hooks')>('../hooks')
|
||||
vi.mock('../hooks/use-workflow', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-workflow')>()
|
||||
return {
|
||||
...actual,
|
||||
useNodesReadOnly: () => ({
|
||||
getNodesReadOnly: mockGetNodesReadOnly,
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('../hooks/use-nodes-interactions', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../hooks/use-nodes-interactions')>()
|
||||
return {
|
||||
...actual,
|
||||
useNodesInteractions: () => ({
|
||||
handleNodesCopy: mockHandleNodesCopy,
|
||||
handleNodesDuplicate: mockHandleNodesDuplicate,
|
||||
|
||||
@ -374,13 +374,16 @@ vi.mock('../shortcuts/use-workflow-hotkeys', () => ({
|
||||
useWorkflowHotkeys: workflowHookMocks.useShortcuts,
|
||||
}))
|
||||
|
||||
vi.mock('../hooks', () => ({
|
||||
vi.mock('../hooks/use-edges-interactions', () => ({
|
||||
useEdgesInteractions: () => ({
|
||||
handleEdgeEnter: workflowHookMocks.handleEdgeEnter,
|
||||
handleEdgeLeave: workflowHookMocks.handleEdgeLeave,
|
||||
handleEdgesChange: workflowHookMocks.handleEdgesChange,
|
||||
handleEdgeContextMenu: workflowHookMocks.handleEdgeContextMenu,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-nodes-interactions', () => ({
|
||||
useNodesInteractions: () => ({
|
||||
handleNodesCopy: vi.fn(),
|
||||
handleNodesDelete: vi.fn(),
|
||||
@ -399,43 +402,69 @@ vi.mock('../hooks', () => ({
|
||||
handleHistoryBack: workflowHookMocks.handleHistoryBack,
|
||||
handleHistoryForward: workflowHookMocks.handleHistoryForward,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-workflow', () => ({
|
||||
useNodesReadOnly: () => ({
|
||||
nodesReadOnly: false,
|
||||
getNodesReadOnly: () => false,
|
||||
}),
|
||||
useNodesSyncDraft: () => ({
|
||||
handleSyncWorkflowDraft: workflowHookMocks.handleSyncWorkflowDraft,
|
||||
syncWorkflowDraftWhenPageClose: vi.fn(),
|
||||
}),
|
||||
usePanelInteractions: () => ({
|
||||
handlePaneContextMenu: workflowHookMocks.handlePaneContextMenu,
|
||||
}),
|
||||
useDSL: () => ({
|
||||
exportCheck: vi.fn(),
|
||||
}),
|
||||
useIsChatMode: () => false,
|
||||
useSelectionInteractions: () => ({
|
||||
handleSelectionStart: workflowHookMocks.handleSelectionStart,
|
||||
handleSelectionChange: workflowHookMocks.handleSelectionChange,
|
||||
handleSelectionDrag: workflowHookMocks.handleSelectionDrag,
|
||||
handleSelectionContextMenu: workflowHookMocks.handleSelectionContextMenu,
|
||||
}),
|
||||
useSetWorkflowVarsWithValue: () => ({
|
||||
fetchInspectVars: workflowHookMocks.fetchInspectVars,
|
||||
}),
|
||||
useShortcuts: workflowHookMocks.useShortcuts,
|
||||
useWorkflow: () => ({
|
||||
isValidConnection: workflowHookMocks.isValidConnection,
|
||||
}),
|
||||
useWorkflowReadOnly: () => ({
|
||||
workflowReadOnly: false,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => ({
|
||||
handleSyncWorkflowDraft: workflowHookMocks.handleSyncWorkflowDraft,
|
||||
syncWorkflowDraftWhenPageClose: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-panel-interactions', () => ({
|
||||
usePanelInteractions: () => ({
|
||||
handlePaneContextMenu: workflowHookMocks.handlePaneContextMenu,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-DSL', () => ({
|
||||
useDSL: () => ({
|
||||
exportCheck: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-selection-interactions', () => ({
|
||||
useSelectionInteractions: () => ({
|
||||
handleSelectionStart: workflowHookMocks.handleSelectionStart,
|
||||
handleSelectionChange: workflowHookMocks.handleSelectionChange,
|
||||
handleSelectionDrag: workflowHookMocks.handleSelectionDrag,
|
||||
handleSelectionContextMenu: workflowHookMocks.handleSelectionContextMenu,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-set-workflow-vars-with-value', () => ({
|
||||
useSetWorkflowVarsWithValue: () => ({
|
||||
fetchInspectVars: workflowHookMocks.fetchInspectVars,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-workflow-panel-interactions', () => ({
|
||||
useWorkflowMoveMode: () => ({
|
||||
isCommentModeAvailable: false,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-workflow-refresh-draft', () => ({
|
||||
useWorkflowRefreshDraft: () => ({
|
||||
handleRefreshWorkflowDraft: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../hooks/use-workflow-start-run', () => ({
|
||||
useWorkflowStartRun: () => ({
|
||||
handleStartWorkflowRun: vi.fn(),
|
||||
handleWorkflowStartRunInChatflow: vi.fn(),
|
||||
|
||||
@ -5,13 +5,13 @@ import userEvent from '@testing-library/user-event'
|
||||
import { useMarketplacePlugins } from '@/app/components/plugins/marketplace/query'
|
||||
import { PluginCategoryEnum } from '@/app/components/plugins/types'
|
||||
import { CollectionType } from '@/app/components/tools/types'
|
||||
import { useAvailableNodesMetaData } from '@/app/components/workflow-app/hooks/use-available-nodes-meta-data'
|
||||
import { useGetLanguage, useLocale } from '@/context/i18n'
|
||||
import useTheme from '@/hooks/use-theme'
|
||||
import { useFeaturedTriggersRecommendations } from '@/service/use-plugins'
|
||||
import { useAllTriggerPlugins, useInvalidateAllTriggerPlugins } from '@/service/use-triggers'
|
||||
import { renderWithConsoleQuery } from '@/test/console/query-data'
|
||||
import { Theme } from '@/types/app'
|
||||
import { useAvailableNodesMetaData } from '../../../workflow-app/hooks'
|
||||
import useNodes from '../../store/workflow/use-nodes'
|
||||
import { BlockEnum } from '../../types'
|
||||
import AllStartBlocks from '../all-start-blocks'
|
||||
@ -43,7 +43,7 @@ vi.mock('../../store/workflow/use-nodes', () => ({
|
||||
default: vi.fn(),
|
||||
}))
|
||||
|
||||
vi.mock('../../../workflow-app/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-available-nodes-meta-data', () => ({
|
||||
useAvailableNodesMetaData: vi.fn(),
|
||||
}))
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import type { CommonNodeType } from '../../types'
|
||||
import { render, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { useAvailableNodesMetaData } from '@/app/components/workflow-app/hooks/use-available-nodes-meta-data'
|
||||
import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
|
||||
import { useAvailableNodesMetaData } from '../../../workflow-app/hooks'
|
||||
import { BlockEnum } from '../../types'
|
||||
import StartBlocks from '../start-blocks'
|
||||
|
||||
@ -10,7 +10,7 @@ vi.mock('@/app/components/workflow/store/workflow/use-nodes', () => ({
|
||||
default: vi.fn(),
|
||||
}))
|
||||
|
||||
vi.mock('../../../workflow-app/hooks', () => ({
|
||||
vi.mock('@/app/components/workflow-app/hooks/use-available-nodes-meta-data', () => ({
|
||||
useAvailableNodesMetaData: vi.fn(),
|
||||
}))
|
||||
|
||||
|
||||
@ -59,10 +59,13 @@ vi.mock('reactflow', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../../hooks', () => ({
|
||||
vi.mock('../../../hooks/use-nodes-sync-draft', () => ({
|
||||
useNodesSyncDraft: () => ({
|
||||
handleSyncWorkflowDraft: mockHandleSyncWorkflowDraft,
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../../hooks/use-workflow-history', () => ({
|
||||
useWorkflowHistory: () => ({
|
||||
saveStateToHistory: mockSaveStateToHistory,
|
||||
}),
|
||||
|
||||
@ -7,7 +7,8 @@ import { useStoreApi } from 'reactflow'
|
||||
import { consoleQuery } from '@/service/client'
|
||||
import { useIncrementSnippetUseCountMutation } from '@/service/use-snippets'
|
||||
import { CUSTOM_EDGE, NESTED_ELEMENT_Z_INDEX, NODE_WIDTH_X_OFFSET, X_OFFSET } from '../../constants'
|
||||
import { useNodesSyncDraft, useWorkflowHistory, WorkflowHistoryEvent } from '../../hooks'
|
||||
import { useNodesSyncDraft } from '../../hooks/use-nodes-sync-draft'
|
||||
import { useWorkflowHistory, WorkflowHistoryEvent } from '../../hooks/use-workflow-history'
|
||||
import { BlockEnum } from '../../types'
|
||||
import { getNodesConnectedSourceOrTargetHandleIdsMap } from '../../utils'
|
||||
|
||||
|
||||
@ -4,15 +4,12 @@ import { useEventListener } from 'ahooks'
|
||||
import { produce } from 'immer'
|
||||
import { memo } from 'react'
|
||||
import { useReactFlow, useViewport } from 'reactflow'
|
||||
import { useCollaborativeWorkflow } from '@/app/components/workflow/hooks/use-collaborative-workflow'
|
||||
import { CUSTOM_NODE } from './constants'
|
||||
import {
|
||||
useAutoGenerateWebhookUrl,
|
||||
useNodesInteractions,
|
||||
useNodesSyncDraft,
|
||||
useWorkflowHistory,
|
||||
WorkflowHistoryEvent,
|
||||
} from './hooks'
|
||||
import { useAutoGenerateWebhookUrl } from './hooks/use-auto-generate-webhook-url'
|
||||
import { useCollaborativeWorkflow } from './hooks/use-collaborative-workflow'
|
||||
import { useNodesInteractions } from './hooks/use-nodes-interactions'
|
||||
import { useNodesSyncDraft } from './hooks/use-nodes-sync-draft'
|
||||
import { useWorkflowHistory, WorkflowHistoryEvent } from './hooks/use-workflow-history'
|
||||
import CustomNode from './nodes'
|
||||
import { useCreateInlineAgentBinding } from './nodes/agent-v2/hooks'
|
||||
import { isAgentV2NodeData, needsInlineAgentBindingCreation } from './nodes/agent-v2/types'
|
||||
|
||||
@ -7,7 +7,8 @@ import { ErrorHandleTypeEnum } from '@/app/components/workflow/nodes/_base/compo
|
||||
import BlockSelector from './block-selector'
|
||||
import { NESTED_ELEMENT_Z_INDEX } from './constants'
|
||||
import CustomEdgeLinearGradientRender from './custom-edge-linear-gradient-render'
|
||||
import { useAvailableBlocks, useNodesInteractions } from './hooks'
|
||||
import { useAvailableBlocks } from './hooks/use-available-blocks'
|
||||
import { useNodesInteractions } from './hooks/use-nodes-interactions'
|
||||
import { NodeRunningStatus } from './types'
|
||||
import { getEdgeColor } from './utils'
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ContextMenuContent, ContextMenuItem } from '@langgenius/dify-ui/context-menu'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useEdges } from 'reactflow'
|
||||
import { useEdgesInteractions } from './hooks'
|
||||
import { useEdgesInteractions } from './hooks/use-edges-interactions'
|
||||
import { ShortcutKbd } from './shortcuts/shortcut-kbd'
|
||||
import { useStore } from './store'
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ import { useFeaturesStore } from '@/app/components/base/features/hooks'
|
||||
import NewFeaturePanel from '@/app/components/base/features/new-feature-panel'
|
||||
import { webSocketClient } from '@/app/components/workflow/collaboration/core/websocket-manager'
|
||||
import { updateFeatures } from '@/service/workflow'
|
||||
import { useIsChatMode, useNodesReadOnly } from './hooks'
|
||||
import { useIsChatMode, useNodesReadOnly } from './hooks/use-workflow'
|
||||
import useConfig from './nodes/start/use-config'
|
||||
import { useStore } from './store'
|
||||
import { InputVarType } from './types'
|
||||
|
||||
@ -11,7 +11,7 @@ vi.mock('@/hooks/use-theme', () => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/rag-pipeline/hooks', () => ({
|
||||
vi.mock('@/app/components/rag-pipeline/hooks/use-input-field-panel', () => ({
|
||||
useInputFieldPanel: () => ({
|
||||
closeAllInputFieldPanels: mockCloseAllInputFieldPanels,
|
||||
}),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user