Refactor jail detail hooks: split into useJailData and useJailCommands

- Split monolithic useJailDetail hook into separate concerns
- Created useJailData for fetching and managing jail data
- Created useJailCommands for jail operations (power, console, etc.)
- Updated JailDetailPage to use new hooks
- Updated tests to reflect new hook structure
- Removed old useJailDetail hook

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-04-25 19:14:16 +02:00
parent 8d30a81346
commit 8bd5713d38
7 changed files with 299 additions and 279 deletions

View File

@@ -8,7 +8,8 @@
import { Button, MessageBar, MessageBarBody, Spinner, Text } from "@fluentui/react-components";
import { ArrowLeftRegular } from "@fluentui/react-icons";
import { Link, useParams } from "react-router-dom";
import { useJailDetail } from "../hooks/useJailDetail";
import { useJailData } from "../hooks/useJailData";
import { useJailCommands } from "../hooks/useJailCommands";
import { useJailBannedIps } from "../hooks/useJailBannedIps";
import { BannedIpsSection } from "../components/jail/BannedIpsSection";
import { JailInfoSection } from "./jail/JailInfoSection";
@@ -20,8 +21,8 @@ import { useJailDetailPageStyles } from "./jail/jailDetailPageStyles";
export function JailDetailPage(): React.JSX.Element {
const styles = useJailDetailPageStyles();
const { name = "" } = useParams<{ name: string }>();
const { jail, ignoreList, ignoreSelf, loading, error, refresh, addIp, removeIp, toggleIgnoreSelf, start, stop, reload, setIdle } =
useJailDetail(name);
const { jail, ignoreList, ignoreSelf, loading, error, refresh } = useJailData(name);
const { addIp, removeIp, toggleIgnoreSelf, start, stop, reload, setIdle } = useJailCommands(name, refresh);
const {
items,
total,