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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user