11import React from 'react'
2- import { Button , Popconfirm } from 'antd'
2+ import { Button , Popconfirm , Tag } from 'antd'
33import { useSelector } from 'react-redux'
44import { useTranslation } from 'react-i18next'
55import { utcDateToLocalDate } from '@/utils/tools'
66import k8sPng from '@/assets/kubernetes.png'
77import EditPopForm from '../editPopForm'
8+ import { useClusterLatency } from '@/hooks/useClusterLatency'
9+ import { LoadingOutlined } from '@ant-design/icons'
810
911import styles from './styles.module.less'
1012
@@ -30,6 +32,11 @@ const ClusterCard = (props: IProps) => {
3032 handleSubmit,
3133 customStyle,
3234 } = props
35+
36+ const { latency, loading : latencyLoading } = useClusterLatency (
37+ item ?. metadata ?. name ,
38+ )
39+
3340 return (
3441 < div className = { styles . card } style = { customStyle } >
3542 < div className = { styles . left } onClick = { ( ) => goDetailPage ( item ) } >
@@ -43,13 +50,36 @@ const ClusterCard = (props: IProps) => {
4350 < >
4451 { item ?. spec ?. displayName }
4552 < span style = { { color : '#808080' } } >
46- ( { item ?. metadata ?. name } )
53+ ( { item ?. metadata ?. name } )
4754 </ span >
4855 </ >
4956 ) : (
5057 < span > { item ?. metadata ?. name } </ span >
5158 ) }
5259 </ div >
60+ < div className = { styles . latency } >
61+ { latencyLoading ? (
62+ < LoadingOutlined
63+ style = { { fontSize : '14px' , color : '#1890ff' } }
64+ spin
65+ />
66+ ) : (
67+ < span >
68+ < Tag
69+ className = "ml-2"
70+ color = {
71+ latency . current < 100
72+ ? 'success'
73+ : latency . current < 300
74+ ? 'warning'
75+ : 'error'
76+ }
77+ >
78+ { latency . current } ms
79+ </ Tag >
80+ </ span >
81+ ) }
82+ </ div >
5383 </ div >
5484 < div className = { styles . desc } > { item ?. spec ?. description || '--' } </ div >
5585 < div className = { styles . bottom } >
0 commit comments