From 18e3fbf41dab95d1f26d54072dace6e70f39738c Mon Sep 17 00:00:00 2001 From: erge Date: Mon, 20 Feb 2023 16:24:45 +0800 Subject: [PATCH] =?UTF-8?q?[Optimize]=20=E5=81=A5=E5=BA=B7=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E9=A1=B9=E6=97=B6=E9=97=B4=E5=92=8C=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E6=98=BE=E7=A4=BA(didi#930)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/CardBar/index.tsx | 24 ++++++++------- .../src/pages/SingleClusterDetail/config.tsx | 30 +++++++++++-------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/km-console/packages/layout-clusters-fe/src/components/CardBar/index.tsx b/km-console/packages/layout-clusters-fe/src/components/CardBar/index.tsx index ea683e07..4fb4121e 100644 --- a/km-console/packages/layout-clusters-fe/src/components/CardBar/index.tsx +++ b/km-console/packages/layout-clusters-fe/src/components/CardBar/index.tsx @@ -165,17 +165,21 @@ const CardBar = (props: CardBarProps) => { dataIndex: 'passed', width: '30%', render(value: boolean, record: any) { - const icon = value ? : ; - const txt = value ? '已通过' : '未通过'; - const notPassedResNameList = record.notPassedResNameList || []; - return ( -
-
- {icon} {txt} + if (record?.updateTime) { + const icon = value ? : ; + const txt = value ? '已通过' : '未通过'; + const notPassedResNameList = record.notPassedResNameList || []; + return ( +
+
+ {icon} {txt} +
+ {}
- {} -
- ); + ); + } else { + return '-'; + } }, }, ]; diff --git a/km-console/packages/layout-clusters-fe/src/pages/SingleClusterDetail/config.tsx b/km-console/packages/layout-clusters-fe/src/pages/SingleClusterDetail/config.tsx index e7d4f2ba..e72bae1d 100644 --- a/km-console/packages/layout-clusters-fe/src/pages/SingleClusterDetail/config.tsx +++ b/km-console/packages/layout-clusters-fe/src/pages/SingleClusterDetail/config.tsx @@ -215,7 +215,7 @@ export const getDetailColumn = (clusterId: number) => [ width: 190, dataIndex: 'updateTime', render: (text: string) => { - return moment(text).format(timeFormat); + return text ? moment(text).format(timeFormat) : '-'; }, }, { @@ -224,21 +224,25 @@ export const getDetailColumn = (clusterId: number) => [ width: 280, // eslint-disable-next-line react/display-name render: (passed: boolean, record: any) => { - if (passed) { + if (record?.updateTime) { + if (passed) { + return ( + <> + + 通过 + + ); + } return ( - <> - - 通过 - +
+ +
未通过
+ +
); + } else { + return '-'; } - return ( -
- -
未通过
- -
- ); }, }, ];