feat(platform): refresh quality link health

This commit is contained in:
lingniu
2026-07-03 22:59:15 +08:00
parent ea367fe581
commit 909f7d6720

View File

@@ -22,6 +22,7 @@ export function Quality({ onHealthLoaded }: { onHealthLoaded?: (health: OpsHealt
const [issues, setIssues] = useState<QualityIssueRow[]>([]);
const [health, setHealth] = useState<OpsHealth | null>(null);
const [loadingIssues, setLoadingIssues] = useState(true);
const [loadingHealth, setLoadingHealth] = useState(true);
const [filters, setFilters] = useState<Record<string, string>>({});
const [pagination, setPagination] = useState({ currentPage: 1, pageSize: 20, total: 0 });
@@ -39,14 +40,20 @@ export function Quality({ onHealthLoaded }: { onHealthLoaded?: (health: OpsHealt
.finally(() => setLoadingIssues(false));
};
useEffect(() => {
loadIssues({}, 1, pagination.pageSize);
const loadHealth = () => {
setLoadingHealth(true);
api.opsHealth()
.then((nextHealth) => {
setHealth(nextHealth);
onHealthLoaded?.(nextHealth);
})
.catch((error: Error) => Toast.error(error.message));
.catch((error: Error) => Toast.error(error.message))
.finally(() => setLoadingHealth(false));
};
useEffect(() => {
loadIssues({}, 1, pagination.pageSize);
loadHealth();
}, []);
return (
@@ -102,8 +109,13 @@ export function Quality({ onHealthLoaded }: { onHealthLoaded?: (health: OpsHealt
]}
/>
</Card>
<Card bordered title="链路健康" style={{ marginTop: 16 }}>
<Card
bordered
title={<Space><span></span><Button size="small" loading={loadingHealth} onClick={loadHealth}></Button></Space>}
style={{ marginTop: 16 }}
>
<Table
loading={loadingHealth}
dataSource={health?.linkHealth ?? []}
pagination={false}
columns={[