mirror of
https://github.com/langgenius/dify.git
synced 2025-06-27 05:30:04 +00:00
add confirm of tool list update
This commit is contained in:
parent
d2ac384458
commit
5781f45840
@ -54,13 +54,19 @@ const MCPDetailContent: FC<Props> = ({
|
|||||||
const { mutateAsync: authorizeMcp, isPending: isAuthorizing } = useAuthorizeMCP()
|
const { mutateAsync: authorizeMcp, isPending: isAuthorizing } = useAuthorizeMCP()
|
||||||
const toolList = data?.tools || []
|
const toolList = data?.tools || []
|
||||||
|
|
||||||
|
const [isShowUpdateConfirm, {
|
||||||
|
setTrue: showUpdateConfirm,
|
||||||
|
setFalse: hideUpdateConfirm,
|
||||||
|
}] = useBoolean(false)
|
||||||
|
|
||||||
const handleUpdateTools = useCallback(async () => {
|
const handleUpdateTools = useCallback(async () => {
|
||||||
|
hideUpdateConfirm()
|
||||||
if (!detail)
|
if (!detail)
|
||||||
return
|
return
|
||||||
await updateTools(detail.id)
|
await updateTools(detail.id)
|
||||||
invalidateMCPTools(detail.id)
|
invalidateMCPTools(detail.id)
|
||||||
onUpdate()
|
onUpdate()
|
||||||
}, [detail, invalidateMCPTools, onUpdate, updateTools])
|
}, [detail, hideUpdateConfirm, invalidateMCPTools, onUpdate, updateTools])
|
||||||
|
|
||||||
const { mutate: updateMCP } = useUpdateMCP({
|
const { mutate: updateMCP } = useUpdateMCP({
|
||||||
onSuccess: onUpdate,
|
onSuccess: onUpdate,
|
||||||
@ -231,7 +237,7 @@ const MCPDetailContent: FC<Props> = ({
|
|||||||
{toolList.length === 1 && <div className='system-sm-semibold-uppercase text-text-secondary'>{t('tools.mcp.onlyTool')}</div>}
|
{toolList.length === 1 && <div className='system-sm-semibold-uppercase text-text-secondary'>{t('tools.mcp.onlyTool')}</div>}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button size='small' onClick={handleUpdateTools}>
|
<Button size='small' onClick={showUpdateConfirm}>
|
||||||
<RiLoopLeftLine className='mr-1 h-3.5 w-3.5' />
|
<RiLoopLeftLine className='mr-1 h-3.5 w-3.5' />
|
||||||
{t('tools.mcp.update')}
|
{t('tools.mcp.update')}
|
||||||
</Button>
|
</Button>
|
||||||
@ -279,6 +285,14 @@ const MCPDetailContent: FC<Props> = ({
|
|||||||
isDisabled={deleting}
|
isDisabled={deleting}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{isShowUpdateConfirm && (
|
||||||
|
<Confirm
|
||||||
|
isShow
|
||||||
|
title={t('tools.mcp.update')}
|
||||||
|
onCancel={hideUpdateConfirm}
|
||||||
|
onConfirm={handleUpdateTools}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user