mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 08:58:09 +08:00
use plugin detail for builtin tool
This commit is contained in:
@ -6,26 +6,23 @@ import EndpointList from './endpoint-list'
|
||||
import ActionList from './action-list'
|
||||
import ModelList from './model-list'
|
||||
import Drawer from '@/app/components/base/drawer'
|
||||
import { usePluginPageContext } from '@/app/components/plugins/plugin-page/context'
|
||||
import type { PluginDetail } from '@/app/components/plugins/types'
|
||||
import cn from '@/utils/classnames'
|
||||
|
||||
type Props = {
|
||||
detail?: PluginDetail
|
||||
onUpdate: () => void
|
||||
onHide: () => void
|
||||
}
|
||||
|
||||
const PluginDetailPanel: FC<Props> = ({
|
||||
detail,
|
||||
onUpdate,
|
||||
onHide,
|
||||
}) => {
|
||||
const setCurrentPluginID = usePluginPageContext(v => v.setCurrentPluginID)
|
||||
|
||||
const handleHide = () => setCurrentPluginID(undefined)
|
||||
|
||||
const handleUpdate = (isDelete = false) => {
|
||||
if (isDelete)
|
||||
handleHide()
|
||||
onHide()
|
||||
onUpdate()
|
||||
}
|
||||
|
||||
@ -36,7 +33,7 @@ const PluginDetailPanel: FC<Props> = ({
|
||||
<Drawer
|
||||
isOpen={!!detail}
|
||||
clickOutsideNotOpen={false}
|
||||
onClose={handleHide}
|
||||
onClose={onHide}
|
||||
footer={null}
|
||||
mask={false}
|
||||
positionCenter={false}
|
||||
@ -46,7 +43,7 @@ const PluginDetailPanel: FC<Props> = ({
|
||||
<>
|
||||
<DetailHeader
|
||||
detail={detail}
|
||||
onHide={handleHide}
|
||||
onHide={onHide}
|
||||
onUpdate={handleUpdate}
|
||||
/>
|
||||
<div className='grow overflow-y-auto'>
|
||||
|
||||
@ -15,6 +15,7 @@ const PluginsPanel = () => {
|
||||
const { data: pluginList, isLoading: isPluginListLoading } = useInstalledPluginList()
|
||||
const invalidateInstalledPluginList = useInvalidateInstalledPluginList()
|
||||
const currentPluginID = usePluginPageContext(v => v.currentPluginID)
|
||||
const setCurrentPluginID = usePluginPageContext(v => v.setCurrentPluginID)
|
||||
|
||||
const { run: handleFilterChange } = useDebounceFn((filters: FilterState) => {
|
||||
setFilters(filters)
|
||||
@ -37,6 +38,8 @@ const PluginsPanel = () => {
|
||||
return detail
|
||||
}, [currentPluginID, pluginList?.plugins])
|
||||
|
||||
const handleHide = () => setCurrentPluginID(undefined)
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className='flex flex-col pt-1 pb-3 px-12 justify-center items-start gap-3 self-stretch'>
|
||||
@ -54,7 +57,11 @@ const PluginsPanel = () => {
|
||||
) : (
|
||||
<Empty />
|
||||
)}
|
||||
<PluginDetailPanel detail={currentPluginDetail} onUpdate={() => invalidateInstalledPluginList()}/>
|
||||
<PluginDetailPanel
|
||||
detail={currentPluginDetail}
|
||||
onUpdate={() => invalidateInstalledPluginList()}
|
||||
onHide={handleHide}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user