Add jail control actions to useJailDetail hook

Implement TASK F-2: Wrap JailDetailPage jail-control API calls in a hook.

Changes:
- Add start(), stop(), reload(), and setIdle() methods to useJailDetail hook
- Update JailDetailPage to use hook control methods instead of direct API imports
- Update error handling to remove dependency on ApiError type
- Add comprehensive tests for new control methods (8 tests)
- Update existing test to include new hook methods in mock

The control methods handle refetching jail data after each operation,
consistent with the pattern used in useJails hook.
This commit is contained in:
2026-03-20 13:58:01 +01:00
parent 8c4fe767de
commit d30d138146
4 changed files with 260 additions and 37 deletions

View File

@@ -101,6 +101,10 @@ function mockHook(ignoreSelf: boolean): void {
addIp: mockAddIp,
removeIp: mockRemoveIp,
toggleIgnoreSelf: mockToggleIgnoreSelf,
start: vi.fn().mockResolvedValue(undefined),
stop: vi.fn().mockResolvedValue(undefined),
reload: vi.fn().mockResolvedValue(undefined),
setIdle: vi.fn().mockResolvedValue(undefined),
};
vi.mocked(useJailDetail).mockReturnValue(result);
}