fix(*): 全量 UI 审查与 undefined 展示异常修复

This commit is contained in:
zhanjunhao
2026-11-20 10:18:17 +08:00
parent 04cc45bbb7
commit 605cff1d58
65 changed files with 507 additions and 274 deletions
+23 -20
View File
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { formatPercent } from '../../helpers/safeDisplay';
import { formatPercent, toFiniteNumber } from '../../helpers/safeDisplay';
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import {
@@ -97,7 +97,7 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
<div className='text-xs p-1'>
<div style={{ color: bgColor }} className='font-semibold'>
{isHealthy ? t('正常') : t('异常')} (
{point.uptime_percent?.toFixed(1)}
{formatPercent(point.uptime_percent, 1).replace('%', '')}
{I18N_TECHNICAL_TEXT.PERCENT_CLOSE}
</div>
<div className='text-gray-400 mt-1'>
@@ -352,25 +352,28 @@ const GroupMonitor = () => {
title: t('可用率'),
dataIndex: 'uptime_percent',
key: 'uptime_percent',
render: (value) => (
<div className='flex items-center gap-2'>
<div className='w-16 h-1.5 bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden'>
<div
className='h-full rounded-full'
style={{
width: `${Math.min(100, value || 0)}%`,
backgroundColor: getUptimeColor(value),
}}
/>
render: (value) => {
const uptime = Math.max(0, Math.min(100, toFiniteNumber(value) ?? 0));
return (
<div className='flex items-center gap-2'>
<div className='w-16 h-1.5 bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden'>
<div
className='h-full rounded-full'
style={{
width: `${uptime}%`,
backgroundColor: getUptimeColor(uptime),
}}
/>
</div>
<span
className='text-sm font-medium'
style={{ color: getUptimeColor(uptime) }}
>
{formatPercent(uptime, 1)}
</span>
</div>
<span
className='text-sm font-medium'
style={{ color: getUptimeColor(value) }}
>
{formatPercent(value || 0, 1)}
</span>
</div>
),
);
},
sorter: (a, b) => (a.uptime_percent || 0) - (b.uptime_percent || 0),
},
{