From 83f6c037ea08efda124f67797191a0540ca2a68c Mon Sep 17 00:00:00 2001 From: erge Date: Mon, 20 Feb 2023 15:26:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[Bugfix]zookeeper=E9=A1=B5=E9=9D=A2leader?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8(#873)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/CardBar/ZookeeperCard.tsx | 19 ++++++++++++-- .../src/components/CardBar/index.less | 25 ++++++++++--------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/km-console/packages/layout-clusters-fe/src/components/CardBar/ZookeeperCard.tsx b/km-console/packages/layout-clusters-fe/src/components/CardBar/ZookeeperCard.tsx index 8f6c65ed3..cc8373499 100644 --- a/km-console/packages/layout-clusters-fe/src/components/CardBar/ZookeeperCard.tsx +++ b/km-console/packages/layout-clusters-fe/src/components/CardBar/ZookeeperCard.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; import CardBar, { healthDataProps } from './index'; -import { Utils } from 'knowdesign'; +import { Tooltip, Utils } from 'knowdesign'; import api from '@src/api'; import { HealthStateEnum } from '../HealthState'; @@ -81,7 +81,22 @@ const ZookeeperCard = () => { { title: 'Leader', value() { - return {leaderNode || '-'}; + return ( + + + {leaderNode || '-'} + + + ); }, }, { diff --git a/km-console/packages/layout-clusters-fe/src/components/CardBar/index.less b/km-console/packages/layout-clusters-fe/src/components/CardBar/index.less index 472cafa6b..e53023383 100644 --- a/km-console/packages/layout-clusters-fe/src/components/CardBar/index.less +++ b/km-console/packages/layout-clusters-fe/src/components/CardBar/index.less @@ -64,21 +64,21 @@ margin-left: 12px; padding: 12px 20px; .card-bar-colunms-header { + font-size: 14px; + color: #74788d; + letter-spacing: 0; + text-align: justify; + line-height: 20px; + .anticon-question-circle { + padding: 3px 3px 2px 3px; + margin-left: -3px; font-size: 14px; - color: #74788d; - letter-spacing: 0; - text-align: justify; - line-height: 20px; - .anticon-question-circle { - padding: 3px 3px 2px 3px; - margin-left: -3px; - font-size: 14px; - border-radius: 50%; - &:hover { - background: rgba(33, 37, 41, 0.04); - } + border-radius: 50%; + &:hover { + background: rgba(33, 37, 41, 0.04); } } + } .card-bar-colunms-body { font-size: 40px; color: #212529; @@ -89,6 +89,7 @@ margin-top: 5px; .num { font-family: DIDIFD-Medium; + overflow: hidden; } .sub-title { font-family: @font-family; From 78b9aa4580b717ed58ba6bb28be629d3d5642b0f Mon Sep 17 00:00:00 2001 From: erge Date: Mon, 20 Feb 2023 15:43:02 +0800 Subject: [PATCH 2/2] =?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(#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 ea683e07c..4fb4121ea 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 e7d4f2ba9..e72bae1df 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 ( -
- -
未通过
- -
- ); }, }, ];