From 08d6df051b206bff8ffab4b5773617ee5044ec52 Mon Sep 17 00:00:00 2001 From: zhu-mingye <934230207@qq.com> Date: Mon, 6 Nov 2023 16:23:14 +0800 Subject: [PATCH] fix table enum bug --- .../components/ProjectProTable/index.tsx | 7 ++-- .../pages/RegCenter/GitProject/constans.tsx | 41 +++++++++++++++---- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx b/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx index 0bf1accde7..2616954936 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx @@ -29,8 +29,7 @@ import ClassList from '@/pages/RegCenter/GitProject/components/BuildSteps/JarSho import { CodeTree } from '@/pages/RegCenter/GitProject/components/CodeTree'; import ProjectModal from '@/pages/RegCenter/GitProject/components/ProjectModal'; import { - GIT_PROJECT_BUILD_STEP, - GIT_PROJECT_BUILD_STEP_ENUM, + GIT_PROJECT_BUILD_STEP_JAVA_ENUM, GIT_PROJECT_BUILD_STEP_PYTHON_ENUM, GIT_PROJECT_CODE_TYPE, GIT_PROJECT_CODE_TYPE_ENUM, GIT_PROJECT_STATUS, @@ -227,8 +226,8 @@ const ProjectProTable: React.FC = () => { title: l('rc.gp.buildStep'), dataIndex: 'buildStep', hideInSearch: true, - filters: GIT_PROJECT_BUILD_STEP, - valueEnum: GIT_PROJECT_BUILD_STEP_ENUM + // filters: GIT_PROJECT_BUILD_STEP, + valueEnum: (row) => row.codeType === 1 ? GIT_PROJECT_BUILD_STEP_JAVA_ENUM : GIT_PROJECT_BUILD_STEP_PYTHON_ENUM, }, { title: l('rc.gp.buildState'), diff --git a/dinky-web/src/pages/RegCenter/GitProject/constans.tsx b/dinky-web/src/pages/RegCenter/GitProject/constans.tsx index 81f901ea18..e8865267d6 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/constans.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/constans.tsx @@ -131,7 +131,7 @@ export const CLONE_TYPES = [ * @param item */ export const renderBranchesTagColor = (item: string) => { - let colorTag = item.includes('dev') + return item.includes('dev') ? 'processing' : item.includes('test') ? 'warning' @@ -142,13 +142,9 @@ export const renderBranchesTagColor = (item: string) => { : item.includes('main') ? 'success' : 'default'; - return colorTag; }; -/** - * git project build step enum - */ -export const GIT_PROJECT_BUILD_STEP_ENUM = { +const GIT_PROJECT_BUILD_STEP_BASE = { 0: { title: l('rc.gp.build.step.0'), text: l('rc.gp.build.step.0'), @@ -159,6 +155,12 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = { text: l('rc.gp.build.step.1'), status: 'default' }, +} +/** + * git project build step enum + */ +export const GIT_PROJECT_BUILD_STEP_JAVA_ENUM = { + ...GIT_PROJECT_BUILD_STEP_BASE, 2: { title: l('rc.gp.build.step.2'), text: l('rc.gp.build.step.2'), @@ -185,6 +187,32 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = { status: 'success' } }; + +export const GIT_PROJECT_BUILD_STEP_PYTHON_ENUM = { + ...GIT_PROJECT_BUILD_STEP_BASE, + 2: { + title: l('rc.gp.build.step.2'), + text: l('rc.gp.build.step.2'), + status: 'processing' + }, + 3: { + title: l('rc.gp.build.step.4'), + text: l('rc.gp.build.step.4'), + status: 'success' + }, + 4: { + title: l('rc.gp.build.step.5'), + text: l('rc.gp.build.step.5'), + status: 'success' + }, + 5: { + title: l('rc.gp.build.step.6'), + text: l('rc.gp.build.step.6'), + status: 'success' + } +}; + + /** * git project build step filter */ @@ -228,7 +256,6 @@ export const GIT_PROJECT_BUILD_STEP = [ /** * git project build step enum - * @type {{"100%": string, "0%": string, "20%": string, "40%": string, "60%": string, "80%": string}} */ export const processColor = { '0%': '#8ac1ea',