Files
IdeA/frontend/src/adapters/workState.ts
Blomios c179f93a26 feat(frontend): boutons cancel/retry des tâches de fond (B8)
Câble l'action utilisateur sur les commandes Tauri B8 :

- port WorkStateGateway : ajout de cancelBackgroundTask/retryBackgroundTask
  (le read-model se rafraîchit via l'événement domaine backgroundTaskChanged ;
  retry rejoue sous un NOUVEL id de tâche).
- adapter Tauri : invoke cancel_background_task/retry_background_task.
- adapter mock : no-ops (le refresh réel est piloté par les événements).
- ProjectWorkStatePanel (BackgroundTaskRow) : état busy + affichage d'erreur
  + refresh après action.
- test ProjectsView.ls7 : stub de gateway complété.

Build vert : npm run build (tsc --noEmit + vite build), vitest 449 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 14:53:32 +02:00

28 lines
951 B
TypeScript

/**
* Tauri adapter for {@link WorkStateGateway}.
*
* This is the only frontend place that knows the `get_project_work_state`
* command name; features consume the gateway port through DI.
*/
import { invoke } from "@tauri-apps/api/core";
import type { ProjectWorkState } from "@/domain";
import type { WorkStateGateway } from "@/ports";
import { normalizeProjectWorkState } from "./workStateNormalization";
export class TauriWorkStateGateway implements WorkStateGateway {
async getProjectWorkState(projectId: string): Promise<ProjectWorkState> {
const state = await invoke<unknown>("get_project_work_state", { projectId });
return normalizeProjectWorkState(state);
}
async cancelBackgroundTask(taskId: string): Promise<void> {
await invoke<unknown>("cancel_background_task", { taskId });
}
async retryBackgroundTask(taskId: string): Promise<void> {
await invoke<unknown>("retry_background_task", { taskId });
}
}