From 2c7aff7ba1758257b119ee81a7c754fd3ebc8d97 Mon Sep 17 00:00:00 2001 From: dengqichen Date: Wed, 8 Jan 2025 15:36:22 +0800 Subject: [PATCH] 1 --- .../pages/Deploy/GitManager/List/index.tsx | 48 ++++--------------- .../pages/Deploy/GitManager/List/service.ts | 8 ++-- 2 files changed, 12 insertions(+), 44 deletions(-) diff --git a/frontend/src/pages/Deploy/GitManager/List/index.tsx b/frontend/src/pages/Deploy/GitManager/List/index.tsx index 070a7966..dd5fb0e8 100644 --- a/frontend/src/pages/Deploy/GitManager/List/index.tsx +++ b/frontend/src/pages/Deploy/GitManager/List/index.tsx @@ -104,10 +104,10 @@ const GitManager: React.FC = () => { }; // 同步项目 - const handleSyncProjects = async (groupId: number) => { + const handleSyncProjects = async () => { if (!selectedInstance) return; try { - await syncGitProjects(selectedInstance, groupId); + await syncGitProjects(selectedInstance); message.success('项目同步任务已启动'); loadInstanceInfo(); } catch (error) { @@ -116,10 +116,10 @@ const GitManager: React.FC = () => { }; // 同步分支 - const handleSyncBranches = async (projectId: number) => { + const handleSyncBranches = async () => { if (!selectedInstance) return; try { - await syncGitBranches(selectedInstance, projectId); + await syncGitBranches(selectedInstance); message.success('分支同步任务已启动'); loadInstanceInfo(); } catch (error) { @@ -127,38 +127,6 @@ const GitManager: React.FC = () => { } }; - // 批量同步项目 - const handleSyncAllProjects = async () => { - if (!selectedInstance || !instanceInfo?.repositoryGroupList) return; - try { - await Promise.all( - instanceInfo.repositoryGroupList.map(group => - syncGitProjects(selectedInstance, group.groupId) - ) - ); - message.success('所有项目同步任务已启动'); - loadInstanceInfo(); - } catch (error) { - message.error('同步失败'); - } - }; - - // 批量同步分支 - const handleSyncAllBranches = async () => { - if (!selectedInstance || !instanceInfo?.repositoryProjectList) return; - try { - await Promise.all( - instanceInfo.repositoryProjectList.map(project => - syncGitBranches(selectedInstance, project.projectId) - ) - ); - message.success('所有分支同步任务已启动'); - loadInstanceInfo(); - } catch (error) { - message.error('同步失败'); - } - }; - useEffect(() => { loadInstances(); }, []); @@ -238,7 +206,7 @@ const GitManager: React.FC = () => {
项目
- @@ -258,7 +226,7 @@ const GitManager: React.FC = () => {
分支
- @@ -301,7 +269,7 @@ const GitManager: React.FC = () => { {group.description} - @@ -336,7 +304,7 @@ const GitManager: React.FC = () => { {new Date(project.lastActivityAt).toLocaleString()}
- diff --git a/frontend/src/pages/Deploy/GitManager/List/service.ts b/frontend/src/pages/Deploy/GitManager/List/service.ts index a42f61ec..83e9fff2 100644 --- a/frontend/src/pages/Deploy/GitManager/List/service.ts +++ b/frontend/src/pages/Deploy/GitManager/List/service.ts @@ -25,9 +25,9 @@ export const syncGitGroups = (externalSystemId: number) => request.post(`${BASE_URL}/${externalSystemId}/sync-groups`); // 同步 Git 项目 -export const syncGitProjects = (externalSystemId: number, groupId: number) => - request.post(`${BASE_URL}/${externalSystemId}/groups/${groupId}/sync-projects`); +export const syncGitProjects = (externalSystemId: number) => + request.post(`${BASE_URL}/${externalSystemId}/groups/sync-projects`); // 同步 Git 分支 -export const syncGitBranches = (externalSystemId: number, projectId: number) => - request.post(`${BASE_URL}/${externalSystemId}/projects/${projectId}/sync-branches`); +export const syncGitBranches = (externalSystemId: number) => + request.post(`${BASE_URL}/${externalSystemId}/projects/sync-branches`);