fix(platform): avoid false storage error while health loads

This commit is contained in:
lingniu
2026-07-04 08:47:11 +08:00
parent 1f777c4040
commit ff8a868abd
2 changed files with 32 additions and 2 deletions

View File

@@ -18,7 +18,8 @@ function formatLag(value?: number | null) {
}
function storageReadStatus(health: OpsHealth | null) {
return health?.tdengineWritable && health.mysqlWritable ? 'ok' : 'error';
if (!health) return 'pending';
return health.tdengineWritable && health.mysqlWritable ? 'ok' : 'error';
}
function formatRequestTimeout(health: OpsHealth | null) {
@@ -191,7 +192,9 @@ export function Quality({
<Col span={6}><Card bordered title="BFF 请求超时">{formatRequestTimeout(health)}</Card></Col>
<Col span={6}>
<Card bordered title="存储读取">
<Tag color={statusColor[storageReadStatus(health)]}>{storageReadStatus(health) === 'ok' ? '正常' : '异常'}</Tag>
<Tag color={statusColor[storageReadStatus(health)] ?? 'grey'}>
{storageReadStatus(health) === 'pending' ? '检测中' : storageReadStatus(health) === 'ok' ? '正常' : '异常'}
</Tag>
</Card>
</Col>
</Row>