From 4de16c250c1f1d1d18f29dd3017bad381e2c5e95 Mon Sep 17 00:00:00 2001 From: ch-liuzhide Date: Tue, 26 Nov 2024 18:53:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(deploy):=20=E6=94=AF=E6=8C=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=83=A8=E7=BD=B2issue=E5=9C=B0=E5=9D=80=20&=20?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AE=A1=E6=89=B9=E6=83=85=E5=86=B5=E6=97=B6?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=20issue=20=E7=8A=B6=E6=80=81=E5=B9=B6?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=95=B0=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edit/components/DeployBotModal/index.tsx | 41 ++++++++++++++++--- client/app/hooks/useBot.ts | 4 +- client/app/market/page.tsx | 2 - server/bot/router.py | 21 +++++++++- server/core/dao/botApprovalDAO.py | 19 ++++++++- server/github_app/router.py | 3 +- server/github_app/utils.py | 13 ++++++ server/requirements.txt | 2 +- 8 files changed, 91 insertions(+), 14 deletions(-) diff --git a/client/app/factory/edit/components/DeployBotModal/index.tsx b/client/app/factory/edit/components/DeployBotModal/index.tsx index d69ae244..249498b4 100644 --- a/client/app/factory/edit/components/DeployBotModal/index.tsx +++ b/client/app/factory/edit/components/DeployBotModal/index.tsx @@ -41,6 +41,7 @@ const MyBotDeployModal: React.FC = ({ isOpen, onClose }) => { } = useBindBotToRepo(); const { publicBot, + data: publicBotResult, isLoading: isPublicBotLoading, isSuccess: isPublicBotSuccess, } = usePublicBot(); @@ -51,6 +52,7 @@ const MyBotDeployModal: React.FC = ({ isOpen, onClose }) => { } = useUnPublicBot(); const { deployWebsite, + data: deployWebsiteResult, isLoading: isDeployWebsiteLoading, isSuccess: isDeployWebsiteSuccess, } = useDeployWebsite(); @@ -75,10 +77,11 @@ const MyBotDeployModal: React.FC = ({ isOpen, onClose }) => { checked: !!botProfile.domain_whitelist[0], targetUrl: botProfile.domain_whitelist[0], }, - appInstalledRepo: peterCatBotRepos?.map((item: any) => ({ - repo_id: item.repo_id, - checked: item.robot_id === botProfile.id, - }))??[], + appInstalledRepo: + peterCatBotRepos?.map((item: any) => ({ + repo_id: item.repo_id, + checked: item.robot_id === botProfile.id, + })) ?? [], }; }, [botProfile, peterCatBotRepos]); @@ -148,6 +151,24 @@ const MyBotDeployModal: React.FC = ({ isOpen, onClose }) => { isDeployWebsiteSuccess || isBindBotSuccess; + const renderResultPath = (result: { approval_path: any }, text: string) => { + return ( + <> + {result?.approval_path ? ( +
+ + {text} + {I18N.DeployBotModal.DeployContent.shenHeZhong} + + + {result.approval_path} + +
+ ) : null} + + ); + }; + return ( <> = ({ isOpen, onClose }) => { {I18N.DeployBotModal.index.buShuChengGong} + + {renderResultPath( + publicBotResult, + I18N.DeployBotModal.DeployContent.gongKaiDaoPE, + )} + {renderResultPath( + deployWebsiteResult, + I18N.DeployBotModal.DeployContent.buShuDaoWoDe, + )} +