refactoring-backend #3

Merged
lukas.pupkalipinski merged 403 commits from refactoring-backend into main 2026-05-20 20:23:46 +02:00
Showing only changes of commit 941502b710 - Show all commits

View File

@@ -9,7 +9,6 @@
*/
import { memo, useMemo } from "react";
import { useDashboardFilters } from "../providers/DashboardFilterProvider";
import {
Badge,
Button,
@@ -42,16 +41,16 @@ interface BanTableProps {
* Active time-range preset — controlled by the parent `DashboardPage`.
* Changing this value triggers a re-fetch.
*/
timeRange?: TimeRange;
timeRange: TimeRange;
/**
* Active origin filter — controlled by the parent `DashboardPage`.
* Changing this value triggers a re-fetch and resets to page 1.
*/
origin?: BanOriginFilter;
origin: BanOriginFilter;
/**
* Data source used for the table query.
*/
source?: "fail2ban" | "archive";
source: "fail2ban" | "archive";
}
// ---------------------------------------------------------------------------
@@ -194,14 +193,10 @@ function buildBanColumns(styles: ReturnType<typeof useStyles>): TableColumnDefin
*/
export const BanTable = memo(function BanTable({ timeRange, origin, source }: BanTableProps): React.JSX.Element {
const styles = useStyles();
const context = useDashboardFilters();
const effectiveTimeRange = timeRange ?? context.timeRange;
const effectiveOrigin = origin ?? context.originFilter;
const effectiveSource = source ?? context.source;
const { banItems, total, page, setPage, loading, error, refresh } = useBans(
effectiveTimeRange,
effectiveOrigin,
effectiveSource,
timeRange,
origin,
source,
);
const banColumns = useMemo(() => buildBanColumns(styles), [styles]);