mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 08:58:09 +08:00
feat: add install check for tools, triggers and datasources
This commit is contained in:
@ -1,10 +1,36 @@
|
||||
import type { FC } from 'react'
|
||||
import { memo } from 'react'
|
||||
import type { DataSourceNodeType } from './types'
|
||||
import type { NodeProps } from '@/app/components/workflow/types'
|
||||
const Node: FC<NodeProps<DataSourceNodeType>> = () => {
|
||||
import { InstallPluginButton } from '@/app/components/workflow/nodes/_base/components/install-plugin-button'
|
||||
import { useNodePluginInstallation } from '@/app/components/workflow/hooks/use-node-plugin-installation'
|
||||
import type { DataSourceNodeType } from './types'
|
||||
|
||||
const Node: FC<NodeProps<DataSourceNodeType>> = ({
|
||||
data,
|
||||
}) => {
|
||||
const {
|
||||
isChecking,
|
||||
isMissing,
|
||||
uniqueIdentifier,
|
||||
canInstall,
|
||||
onInstallSuccess,
|
||||
} = useNodePluginInstallation(data)
|
||||
|
||||
const showInstallButton = !isChecking && isMissing && canInstall && uniqueIdentifier
|
||||
|
||||
if (!showInstallButton)
|
||||
return null
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className='relative mb-1 px-3 py-1'>
|
||||
<div className='absolute right-3 top-[-32px] z-20'>
|
||||
<InstallPluginButton
|
||||
size='small'
|
||||
className='!font-medium !text-text-accent'
|
||||
uniqueIdentifier={uniqueIdentifier!}
|
||||
onSuccess={onInstallSuccess}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ export type DataSourceNodeType = CommonNodeType & {
|
||||
datasource_label: string
|
||||
datasource_parameters: ToolVarInputs
|
||||
datasource_configurations: Record<string, any>
|
||||
plugin_unique_identifier?: string
|
||||
}
|
||||
|
||||
export type CustomRunFormProps = {
|
||||
|
||||
Reference in New Issue
Block a user