feat(web): redesign fleet cards and instance workspace

This commit is contained in:
chick
2026-07-19 18:54:26 +08:00
parent f2803896a8
commit 49ee4e6570
9 changed files with 458 additions and 74 deletions
@@ -20,6 +20,12 @@ const owner: InstanceContext = {
status: 'online',
authentication: 'authenticated',
freshness: 'fresh',
resources: {
cpuPercent: 18.4,
memoryPercent: 63.2,
maxTemperatureCelsius: 46.7,
phoneNumbers: ['13800138000'],
},
};
const overviewCapabilities: InstanceCapabilityMap = {
overview: { state: 'supported' },
@@ -108,7 +114,7 @@ describe('Phase 6.1 Overview / System read slice', () => {
).toBeTruthy();
});
it('is honest when no safe read source is injected and never attempts a production endpoint', () => {
it('renders the route-owned Fleet resource summary without inventing another endpoint', () => {
render(
<AppShell
pathname="/instances/alpha/overview"
@@ -116,9 +122,17 @@ describe('Phase 6.1 Overview / System read slice', () => {
capabilities={overviewCapabilities}
/>,
);
expect(screen.getByRole('status', { name: '概览不可用' }).textContent).toMatch(
/没有可用的安全概览只读数据源/i,
const operations = screen.getByRole('region', { name: '运行状态与资源' });
expect(within(operations).getByText('在线')).toBeTruthy();
expect(within(operations).getByRole('meter', { name: 'CPU使用率' }).getAttribute('value')).toBe(
'18.4',
);
expect(
within(operations).getByRole('meter', { name: '内存使用率' }).getAttribute('value'),
).toBe('63.2');
expect(within(operations).getByText('46.7 °C')).toBeTruthy();
expect(within(operations).getByText('13800138000')).toBeTruthy();
expect(screen.queryByText(/没有可用的安全概览只读数据源/i)).toBeNull();
expect(screen.queryByRole('button', { name: /restart/i })).toBeNull();
});