fix(sidebar): mark partial launch tasks offline
This commit is contained in:
parent
3c60ab8653
commit
0f7028f911
2 changed files with 39 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ import {
|
||||||
NO_PROJECT_KEY,
|
NO_PROJECT_KEY,
|
||||||
sortTasksByFreshness,
|
sortTasksByFreshness,
|
||||||
} from '@renderer/utils/taskGrouping';
|
} from '@renderer/utils/taskGrouping';
|
||||||
import { resolveTeamStatus } from '@renderer/utils/teamListStatus';
|
import { isTeamListStatusRunning, resolveTeamStatus } from '@renderer/utils/teamListStatus';
|
||||||
import { deriveTaskDisplayId } from '@shared/utils/taskIdentity';
|
import { deriveTaskDisplayId } from '@shared/utils/taskIdentity';
|
||||||
import {
|
import {
|
||||||
Archive,
|
Archive,
|
||||||
|
|
@ -361,7 +361,7 @@ export const GlobalTaskList = memo(function GlobalTaskList({
|
||||||
getCurrentProvisioningProgressForTeam(provisioningState, team.teamName),
|
getCurrentProvisioningProgressForTeam(provisioningState, team.teamName),
|
||||||
leadActivityByTeam
|
leadActivityByTeam
|
||||||
);
|
);
|
||||||
if (status === 'offline') {
|
if (!isTeamListStatusRunning(status)) {
|
||||||
result.add(team.teamName);
|
result.add(team.teamName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { createRoot } from 'react-dom/client';
|
||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
|
||||||
import type { GlobalTask } from '../../../../src/shared/types';
|
import type { GlobalTask, TeamSummary } from '../../../../src/shared/types';
|
||||||
|
|
||||||
interface StoreState {
|
interface StoreState {
|
||||||
globalTasks: GlobalTask[];
|
globalTasks: GlobalTask[];
|
||||||
|
|
@ -19,7 +19,7 @@ interface StoreState {
|
||||||
totalSessions: number;
|
totalSessions: number;
|
||||||
worktrees: { path: string }[];
|
worktrees: { path: string }[];
|
||||||
}[];
|
}[];
|
||||||
teams: { teamName: string; displayName: string }[];
|
teams: (Pick<TeamSummary, 'teamName' | 'displayName'> & Partial<TeamSummary>)[];
|
||||||
provisioningRuns: Record<string, { state: string; runId: string; updatedAt: string }>;
|
provisioningRuns: Record<string, { state: string; runId: string; updatedAt: string }>;
|
||||||
currentProvisioningRunIdByTeam: Record<string, string | null>;
|
currentProvisioningRunIdByTeam: Record<string, string | null>;
|
||||||
leadActivityByTeam: Record<string, 'active' | 'idle' | 'offline'>;
|
leadActivityByTeam: Record<string, 'active' | 'idle' | 'offline'>;
|
||||||
|
|
@ -327,6 +327,41 @@ describe('GlobalTaskList project grouping', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('marks task cards as offline when the owning team has a partial launch failure', async () => {
|
||||||
|
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
|
||||||
|
const aliveList = vi.fn(() => Promise.resolve([]));
|
||||||
|
setElectronApiForTest({ teams: { aliveList } });
|
||||||
|
storeState.globalTasks = [makeTask(1)];
|
||||||
|
storeState.teams = [
|
||||||
|
{
|
||||||
|
teamName: 'alpha-team',
|
||||||
|
displayName: 'Alpha Team',
|
||||||
|
partialLaunchFailure: true,
|
||||||
|
teamLaunchState: 'partial_failure',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const host = document.createElement('div');
|
||||||
|
document.body.appendChild(host);
|
||||||
|
const root = createRoot(host);
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
root.render(React.createElement(GlobalTaskList));
|
||||||
|
await flushMicrotasks();
|
||||||
|
await flushMicrotasks();
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(aliveList).toHaveBeenCalled();
|
||||||
|
expect(
|
||||||
|
host.querySelector('[data-testid="sidebar-task-item"]')?.getAttribute('data-team-offline')
|
||||||
|
).toBe('true');
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
root.unmount();
|
||||||
|
await flushMicrotasks();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('marks task cards as offline when alive-list is initialized before teams are loaded', async () => {
|
it('marks task cards as offline when alive-list is initialized before teams are loaded', async () => {
|
||||||
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
|
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
|
||||||
const aliveList = vi.fn(() => Promise.resolve([]));
|
const aliveList = vi.fn(() => Promise.resolve([]));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue