feat: rebuild warm operations workbench

This commit is contained in:
Codex
2026-07-30 14:49:33 +08:00
parent 25c853dea8
commit 570edf6bb2
88 changed files with 13413 additions and 2250 deletions
@@ -14,6 +14,7 @@ describe('Fleet API data source', () => {
memoryPercent: 67.8,
maxTemperatureCelsius: 52.6,
phoneNumbers: ['13800000000'],
version: '1.9.4',
}
: {
items: [
@@ -36,7 +37,13 @@ describe('Fleet API data source', () => {
);
const snapshot = await createFleetApiDataSource(fetcher as typeof fetch).load();
expect(snapshot.instances).toEqual([
{ id: 'alpha', name: 'Alpha', url: 'https://alpha.example/admin', tags: ['lab'], revision: 4 },
{
id: 'alpha',
name: 'Alpha',
url: 'https://alpha.example/admin',
tags: ['lab'],
revision: 4,
},
]);
expect(snapshot.statuses.get('alpha')?.summary?.resources).toEqual({
cpuPercent: 23.4,
@@ -44,6 +51,7 @@ describe('Fleet API data source', () => {
maxTemperatureCelsius: 52.6,
phoneNumbers: ['13800000000'],
});
expect(snapshot.statuses.get('alpha')?.summary?.version).toBe('1.9.4');
expect(fetcher).toHaveBeenCalledWith(
'/api/v1/instances',
expect.objectContaining({ credentials: 'same-origin' }),
@@ -81,12 +89,15 @@ describe('Fleet API data source', () => {
);
});
const partials: unknown[] = [];
const pending = createFleetApiDataSource(fetcher as typeof fetch).load(undefined, (snapshot) => {
partials.push({
resources: snapshot.statuses.get('alpha')?.summary?.resources,
freshness: snapshot.statuses.get('alpha')?.summary?.freshness,
});
});
const pending = createFleetApiDataSource(fetcher as typeof fetch).load(
undefined,
(snapshot) => {
partials.push({
resources: snapshot.statuses.get('alpha')?.summary?.resources,
freshness: snapshot.statuses.get('alpha')?.summary?.freshness,
});
},
);
await vi.waitFor(() => expect(partials.length).toBe(1));
expect(partials[0]).toEqual({ resources: undefined, freshness: 'unknown' });
resolveResources(