diff --git a/src/pages/ServiceManage/LeaderDistribution/index.tsx b/src/pages/ServiceManage/LeaderDistribution/index.tsx index b75e39bf..d1ec874a 100644 --- a/src/pages/ServiceManage/LeaderDistribution/index.tsx +++ b/src/pages/ServiceManage/LeaderDistribution/index.tsx @@ -80,10 +80,18 @@ const LeaderDistribution: React.FC = (props: IProps) => { const lastItem = last(data); const hostList = lastItem!.name === 'Total' ? data.slice(0, data.length - 1) : data; + const total = hostList.reduce((acc, cur) => acc + cur.count, 0); const chartData = hostList.map(item => ({ type: item.name, - value: item.count + value: Number((item.count/total * 100).toFixed(1)) })); + chartInstance?.tooltip({ + customItems: (items) => { + return items.map((item) => { + return {...item,value: `${item.value}%`}; + }) + } + }) chartInstance?.data(chartData).render(); } }; diff --git a/src/pages/ServiceManage/Overview/index.tsx b/src/pages/ServiceManage/Overview/index.tsx index c9a901d6..8760e138 100644 --- a/src/pages/ServiceManage/Overview/index.tsx +++ b/src/pages/ServiceManage/Overview/index.tsx @@ -127,6 +127,7 @@ const Overview: React.FC = (props: IProps) => { }; const getBalanceStatus = async () => { + if (!currentSpace) return false; const { code,data } = await props.getJobs(); if (code === 0) { const hasRunningBalance = data.tables.find(item => item.Command.indexOf("BALANCE") && item.status === 'RUNNING');