diff --git a/Docs/Tasks.md b/Docs/Tasks.md index 0e3d450..fbcd874 100644 --- a/Docs/Tasks.md +++ b/Docs/Tasks.md @@ -244,7 +244,9 @@ Issues are grouped by category and ordered roughly by severity. Each entry descr --- -### TASK-013 — Consolidate `api/config.ts` and `api/file_config.ts` duplicate functions +### TASK-013 — Consolidate `api/config.ts` and `api/file_config.ts` duplicate functions (done) + +**Where fixed:** `frontend/src/api/config.ts`, `frontend/src/hooks/useFilterRawFile.ts`, `frontend/src/hooks/useActionRawFile.ts`, `frontend/src/components/config/JailFilesTab.tsx`, `frontend/src/components/config/ExportTab.tsx` **Where found:** Both `frontend/src/api/config.ts` and `frontend/src/api/file_config.ts` export identical functions: `fetchJailConfigFiles`, `createJailConfigFile`, `fetchJailConfigFileContent`, `updateJailConfigFile`, `setJailConfigFileEnabled`, `fetchFilterFiles`, `fetchFilterFile`, `updateFilterFile`, `createFilterFile`, `fetchActionFiles`, `fetchActionFile`, `updateActionFile`, `createActionFile`. diff --git a/frontend/src/components/__tests__/ConfigPageLogPath.test.tsx b/frontend/src/components/__tests__/ConfigPageLogPath.test.tsx index 932cffe..7dab04d 100644 --- a/frontend/src/components/__tests__/ConfigPageLogPath.test.tsx +++ b/frontend/src/components/__tests__/ConfigPageLogPath.test.tsx @@ -118,7 +118,7 @@ vi.mock("../../api/config", () => ({ updateParsedJailFile: vi.fn(), })); -vi.mock("../../api/file_config", () => ({ +vi.mock("../../api/config", () => ({ fetchJailConfigFiles: mockFetchJailConfigFiles, createJailConfigFile: vi.fn().mockResolvedValue({ name: "new-jail", diff --git a/frontend/src/components/config/ExportTab.tsx b/frontend/src/components/config/ExportTab.tsx index f8a836d..535e67d 100644 --- a/frontend/src/components/config/ExportTab.tsx +++ b/frontend/src/components/config/ExportTab.tsx @@ -20,7 +20,7 @@ import { createFilterFile, updateActionFile, updateFilterFile, -} from "../../api/file_config"; +} from "../../api/config"; import { JailFilesTab } from "./JailFilesTab"; import { ConfFilesTab } from "./ConfFilesTab"; diff --git a/frontend/src/components/config/JailFilesTab.tsx b/frontend/src/components/config/JailFilesTab.tsx index 58214a9..8c750be 100644 --- a/frontend/src/components/config/JailFilesTab.tsx +++ b/frontend/src/components/config/JailFilesTab.tsx @@ -31,7 +31,7 @@ import { createJailConfigFile, fetchJailConfigFiles, setJailConfigFileEnabled, -} from "../../api/file_config"; +} from "../../api/config"; import type { JailConfigFile } from "../../types/config"; import { JailFileForm } from "./JailFileForm"; import { useConfigStyles } from "./configStyles"; diff --git a/frontend/src/components/config/__tests__/FiltersTab.test.tsx b/frontend/src/components/config/__tests__/FiltersTab.test.tsx index 91e23bd..f7694b8 100644 --- a/frontend/src/components/config/__tests__/FiltersTab.test.tsx +++ b/frontend/src/components/config/__tests__/FiltersTab.test.tsx @@ -14,9 +14,6 @@ import type { FilterConfig, FilterListResponse } from "../../../types/config"; vi.mock("../../../api/config", () => ({ fetchFilters: vi.fn(), -})); - -vi.mock("../../../api/file_config", () => ({ fetchFilterFile: vi.fn(), updateFilterFile: vi.fn(), })); diff --git a/frontend/src/hooks/useActionRawFile.ts b/frontend/src/hooks/useActionRawFile.ts index 3fd4f15..17cdeb9 100644 --- a/frontend/src/hooks/useActionRawFile.ts +++ b/frontend/src/hooks/useActionRawFile.ts @@ -2,7 +2,7 @@ * React hook for loading and saving a single raw action file. */ import { useCallback } from "react"; -import { fetchActionFile, updateActionFile } from "../api/file_config"; +import { fetchActionFile, updateActionFile } from "../api/config"; export interface UseActionRawFileResult { fetchRawContent: () => Promise; diff --git a/frontend/src/hooks/useFilterRawFile.ts b/frontend/src/hooks/useFilterRawFile.ts index 71ed384..0cfc51e 100644 --- a/frontend/src/hooks/useFilterRawFile.ts +++ b/frontend/src/hooks/useFilterRawFile.ts @@ -2,7 +2,7 @@ * React hook for loading and saving a single raw filter file. */ import { useCallback } from "react"; -import { fetchFilterFile, updateFilterFile } from "../api/file_config"; +import { fetchFilterFile, updateFilterFile } from "../api/config"; export interface UseFilterRawFileResult { fetchRawContent: () => Promise;