diff --git a/frontend/src/pages/Deploy/Environment/List/components/EnvironmentModal.tsx b/frontend/src/pages/Deploy/Environment/List/components/EnvironmentModal.tsx index 0716466f..90efd6fd 100644 --- a/frontend/src/pages/Deploy/Environment/List/components/EnvironmentModal.tsx +++ b/frontend/src/pages/Deploy/Environment/List/components/EnvironmentModal.tsx @@ -104,9 +104,13 @@ const EnvironmentModal: React.FC = ({ const typeInfo = getBuildTypeInfo(type); return ( -
- {typeInfo.icon} - {typeInfo.label} +
+ {typeInfo.icon} + {typeInfo.label}
); @@ -124,9 +128,13 @@ const EnvironmentModal: React.FC = ({ const typeInfo = getDeployTypeInfo(type); return ( -
- {typeInfo.icon} - {typeInfo.label} +
+ {typeInfo.icon} + {typeInfo.label}
); diff --git a/frontend/src/pages/Deploy/Environment/List/index.tsx b/frontend/src/pages/Deploy/Environment/List/index.tsx index 63fe3698..6f21f275 100644 --- a/frontend/src/pages/Deploy/Environment/List/index.tsx +++ b/frontend/src/pages/Deploy/Environment/List/index.tsx @@ -1,6 +1,6 @@ import React, {useState} from 'react'; import {PageContainer} from '@ant-design/pro-layout'; -import {Button, message, Popconfirm, Space, Tag} from 'antd'; +import {Button, message, Popconfirm, Tag} from 'antd'; import {PlusOutlined, EditOutlined, DeleteOutlined} from '@ant-design/icons'; import {getEnvironmentPage, deleteEnvironment} from './service'; import type {Environment, EnvironmentQueryParams} from './types'; @@ -35,6 +35,25 @@ const EnvironmentList: React.FC = () => { setModalVisible(true); }; + const renderTag = (icon: React.ReactNode, label: string, color: string) => ( +
+ {icon} + {label} +
+ ); + const columns: ProColumns[] = [ { title: '环境编码', @@ -63,12 +82,7 @@ const EnvironmentList: React.FC = () => { render: (buildType) => { if (!buildType) return '-'; const typeInfo = getBuildTypeInfo(buildType as BuildTypeEnum); - return ( - - {typeInfo.icon} - {typeInfo.label} - - ); + return renderTag(typeInfo.icon, typeInfo.label, typeInfo.color); }, filters: [ {text: 'Jenkins构建', value: BuildTypeEnum.JENKINS}, @@ -85,12 +99,7 @@ const EnvironmentList: React.FC = () => { render: (deployType) => { if (!deployType) return '-'; const typeInfo = getDeployTypeInfo(deployType as DeployTypeEnum); - return ( - - {typeInfo.icon} - {typeInfo.label} - - ); + return renderTag(typeInfo.icon, typeInfo.label, typeInfo.color); }, filters: [ {text: 'Kubernetes集群部署', value: DeployTypeEnum.K8S}, @@ -114,30 +123,32 @@ const EnvironmentList: React.FC = () => { valueType: 'option', fixed: 'right', align: 'center', - render: (_, record) => [ - , - handleDelete(record.id)} - > + render: (_, record) => ( +
- - ], + handleDelete(record.id)} + > + + +
+ ), }, ];