From 7ad20a0cbd7da045e0ca67375eb631ffc37512f5 Mon Sep 17 00:00:00 2001 From: dengqichen Date: Tue, 24 Dec 2024 10:36:37 +0800 Subject: [PATCH] 1 --- .../List/components/EnvironmentModal.tsx | 12 --- .../pages/Deploy/Environment/List/index.tsx | 22 ----- .../List/components/ProjectGroupModal.tsx | 25 ++++++ .../pages/Deploy/ProjectGroup/List/index.tsx | 89 +++++++++++-------- .../pages/Deploy/ProjectGroup/List/types.ts | 15 +++- 5 files changed, 90 insertions(+), 73 deletions(-) diff --git a/frontend/src/pages/Deploy/Environment/List/components/EnvironmentModal.tsx b/frontend/src/pages/Deploy/Environment/List/components/EnvironmentModal.tsx index 11e43a0a..a1b8b1a1 100644 --- a/frontend/src/pages/Deploy/Environment/List/components/EnvironmentModal.tsx +++ b/frontend/src/pages/Deploy/Environment/List/components/EnvironmentModal.tsx @@ -117,18 +117,6 @@ const EnvironmentModal: React.FC = ({ /> - - + = ({ 禁用 + + + ); diff --git a/frontend/src/pages/Deploy/ProjectGroup/List/index.tsx b/frontend/src/pages/Deploy/ProjectGroup/List/index.tsx index 280773b5..79ccf469 100644 --- a/frontend/src/pages/Deploy/ProjectGroup/List/index.tsx +++ b/frontend/src/pages/Deploy/ProjectGroup/List/index.tsx @@ -61,32 +61,33 @@ const ProjectList: React.FC = () => { setModalVisible(true); }; - const getProjectTypeInfo = (code: string) => { - if (code.toUpperCase().includes('DEMO')) { - return { - type: 'DEMO', - label: '示例项目组', - color: '#1890ff', - icon: , - description: '用于演示和测试的项目组' - }; + const getProjectTypeInfo = (type: string) => { + switch (type) { + case 'PRODUCT': + return { + type: 'PRODUCT', + label: '产品项目组', + color: '#1890ff', + icon: , + description: '产品相关的项目组' + }; + case 'PLATFORM': + return { + type: 'PLATFORM', + label: '平台项目组', + color: '#52c41a', + icon: , + description: '平台相关的项目组' + }; + default: + return { + type: 'BUSINESS', + label: '业务项目组', + color: '#722ed1', + icon: , + description: '业务相关的项目组' + }; } - if (code.toUpperCase().includes('PLATFORM')) { - return { - type: 'PLATFORM', - label: '平台项目组', - color: '#52c41a', - icon: , - description: '平台相关的核心项目组' - }; - } - return { - type: 'BUSINESS', - label: '业务项目组', - color: '#722ed1', - icon: , - description: '具体业务相关的项目组' - }; }; const filteredProjects = projects.filter(project => { @@ -97,13 +98,13 @@ const ProjectList: React.FC = () => { ) : true; const matchesType = projectType === 'ALL' ? true : - getProjectTypeInfo(project.projectGroupCode).type === projectType; + getProjectTypeInfo(project.type).type === projectType; return matchesSearch && matchesType; }); - const ProjectCard = ({project}: { project: ProjectGroup }) => { - const typeInfo = getProjectTypeInfo(project.projectGroupCode); + const ProjectCard = ({projectGroup}: { projectGroup: ProjectGroup }) => { + const typeInfo = getProjectTypeInfo(projectGroup.type); const Icon = typeInfo.icon; return ( @@ -146,7 +147,7 @@ const ProjectList: React.FC = () => { alignItems: 'center', gap: '8px' }}> - {project.projectGroupName} + {projectGroup.projectGroupName} { display: '-webkit-box', }} > - {project.projectGroupDesc || '暂无描述'} + {projectGroup.projectGroupDesc || '暂无描述'}
{ borderRadius: '6px', letterSpacing: '0.5px', }}> - {project.projectGroupCode} + {projectGroup.projectGroupCode}
@@ -213,7 +214,7 @@ const ProjectList: React.FC = () => { 环境数量} - value={2} + value={projectGroup.environments.length} prefix={} valueStyle={{fontSize: '16px', color: typeInfo.color}} /> @@ -221,7 +222,7 @@ const ProjectList: React.FC = () => { 项目个数} - value={5} + value={projectGroup.applications.length} prefix={} valueStyle={{fontSize: '16px', color: typeInfo.color}} /> @@ -229,7 +230,6 @@ const ProjectList: React.FC = () => { 成员数量} - value={5} prefix={} valueStyle={{fontSize: '16px', color: typeInfo.color}} /> @@ -242,7 +242,7 @@ const ProjectList: React.FC = () => {