mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 08:58:09 +08:00
datasource panel
This commit is contained in:
@ -3,6 +3,8 @@ import {
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDataSourceList } from '@/service/use-pipeline'
|
||||
import { useStore } from '../store'
|
||||
import {
|
||||
TabsEnum,
|
||||
ToolTypeEnum,
|
||||
@ -75,3 +77,10 @@ export const useToolTabs = () => {
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
export const useDataSources = () => {
|
||||
const pipelineId = useStore(s => s.pipelineId)
|
||||
const { data: dataSourceList } = useDataSourceList(!!pipelineId)
|
||||
|
||||
return dataSourceList || []
|
||||
}
|
||||
|
||||
@ -5,8 +5,7 @@ import type { NodeSelectorProps } from './main'
|
||||
import NodeSelector from './main'
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store/store'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { useDataSourceList } from '@/service/use-pipeline'
|
||||
import { useDataSources } from './hooks'
|
||||
|
||||
const NodeSelectorWrapper = (props: NodeSelectorProps) => {
|
||||
const availableNodesMetaData = useHooksStore(s => s.availableNodesMetaData)
|
||||
@ -34,8 +33,7 @@ const NodeSelectorWrapper = (props: NodeSelectorProps) => {
|
||||
})
|
||||
}, [availableNodesMetaData?.nodes])
|
||||
|
||||
const pipelineId = useStore(s => s.pipelineId)
|
||||
const { data: dataSourceList } = useDataSourceList(!!pipelineId)
|
||||
const dataSourceList = useDataSources()
|
||||
|
||||
return (
|
||||
<NodeSelector
|
||||
|
||||
Reference in New Issue
Block a user