|
|
|
@ -36,7 +36,7 @@ type Props = {
|
|
|
|
detail: ToolWithProvider
|
|
|
|
detail: ToolWithProvider
|
|
|
|
onUpdate: (isDelete?: boolean) => void
|
|
|
|
onUpdate: (isDelete?: boolean) => void
|
|
|
|
onHide: () => void
|
|
|
|
onHide: () => void
|
|
|
|
isCreation: boolean
|
|
|
|
isTriggerAuthorize: boolean
|
|
|
|
onFirstCreate: () => void
|
|
|
|
onFirstCreate: () => void
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -44,7 +44,7 @@ const MCPDetailContent: FC<Props> = ({
|
|
|
|
detail,
|
|
|
|
detail,
|
|
|
|
onUpdate,
|
|
|
|
onUpdate,
|
|
|
|
onHide,
|
|
|
|
onHide,
|
|
|
|
isCreation,
|
|
|
|
isTriggerAuthorize,
|
|
|
|
onFirstCreate,
|
|
|
|
onFirstCreate,
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { t } = useTranslation()
|
|
|
|
@ -70,12 +70,8 @@ const MCPDetailContent: FC<Props> = ({
|
|
|
|
onUpdate()
|
|
|
|
onUpdate()
|
|
|
|
}, [detail, hideUpdateConfirm, invalidateMCPTools, onUpdate, updateTools])
|
|
|
|
}, [detail, hideUpdateConfirm, invalidateMCPTools, onUpdate, updateTools])
|
|
|
|
|
|
|
|
|
|
|
|
const { mutate: updateMCP } = useUpdateMCP({
|
|
|
|
const { mutateAsync: updateMCP } = useUpdateMCP({})
|
|
|
|
onSuccess: onUpdate,
|
|
|
|
const { mutateAsync: deleteMCP } = useDeleteMCP({})
|
|
|
|
})
|
|
|
|
|
|
|
|
const { mutate: deleteMCP } = useDeleteMCP({
|
|
|
|
|
|
|
|
onSuccess: onUpdate,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [isShowUpdateModal, {
|
|
|
|
const [isShowUpdateModal, {
|
|
|
|
setTrue: showUpdateModal,
|
|
|
|
setTrue: showUpdateModal,
|
|
|
|
@ -126,8 +122,9 @@ const MCPDetailContent: FC<Props> = ({
|
|
|
|
if ((res as any)?.result === 'success') {
|
|
|
|
if ((res as any)?.result === 'success') {
|
|
|
|
hideUpdateModal()
|
|
|
|
hideUpdateModal()
|
|
|
|
onUpdate()
|
|
|
|
onUpdate()
|
|
|
|
|
|
|
|
handleAuthorize()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [detail, updateMCP, hideUpdateModal, onUpdate])
|
|
|
|
}, [detail, updateMCP, hideUpdateModal, onUpdate, handleAuthorize])
|
|
|
|
|
|
|
|
|
|
|
|
const handleDelete = useCallback(async () => {
|
|
|
|
const handleDelete = useCallback(async () => {
|
|
|
|
if (!detail)
|
|
|
|
if (!detail)
|
|
|
|
@ -142,7 +139,7 @@ const MCPDetailContent: FC<Props> = ({
|
|
|
|
}, [detail, showDeleting, deleteMCP, hideDeleting, hideDeleteConfirm, onUpdate])
|
|
|
|
}, [detail, showDeleting, deleteMCP, hideDeleting, hideDeleteConfirm, onUpdate])
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
if (isCreation)
|
|
|
|
if (isTriggerAuthorize)
|
|
|
|
handleAuthorize()
|
|
|
|
handleAuthorize()
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, [])
|
|
|
|
}, [])
|
|
|
|
|