feat(platform): expose capacity check findings
This commit is contained in:
@@ -275,6 +275,7 @@ export interface OpsHealth {
|
||||
linkHealth: LinkHealth[];
|
||||
kafkaLag: number | null;
|
||||
activeConnections: number | null;
|
||||
capacityFindings: string[];
|
||||
redisOnlineKeys: number | null;
|
||||
tdengineWritable: boolean;
|
||||
mysqlWritable: boolean;
|
||||
|
||||
@@ -198,6 +198,15 @@ export function Quality({
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
{health?.capacityFindings?.length ? (
|
||||
<Card bordered title="容量检查发现" style={{ marginTop: 16 }}>
|
||||
<Space wrap>
|
||||
{health.capacityFindings.map((item) => (
|
||||
<Tag key={item} color="orange">{item}</Tag>
|
||||
))}
|
||||
</Space>
|
||||
</Card>
|
||||
) : null}
|
||||
{filterSummary.length > 0 ? (
|
||||
<Card bordered title="当前筛选" style={{ marginTop: 16 }}>
|
||||
<Space wrap>
|
||||
|
||||
@@ -4153,6 +4153,31 @@ test('quality health shows active connection capacity metric', async () => {
|
||||
expect(screen.getByText('120,000')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('quality health shows structured capacity findings', async () => {
|
||||
window.history.replaceState(null, '', '/#/quality');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: path.includes('/api/ops/health')
|
||||
? { linkHealth: [], kafkaLag: 42, activeConnections: 120000, capacityFindings: ['kafka lag 42'], redisOnlineKeys: 368, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } }
|
||||
: path.includes('/api/quality/summary')
|
||||
? { issueVehicleCount: 0, issueRecordCount: 0, errorCount: 0, warningCount: 0, protocols: [], issueTypes: [] }
|
||||
: { items: [], total: 0, limit: 20, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
});
|
||||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByRole('heading', { name: '质量治理' })).toBeInTheDocument();
|
||||
expect(await screen.findByText('容量检查发现')).toBeInTheDocument();
|
||||
expect(screen.getByText('kafka lag 42')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('shows vehicle service evidence chain before source details', async () => {
|
||||
window.history.replaceState(null, '', '/#/detail?keyword=VIN001');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
|
||||
Reference in New Issue
Block a user