Refactor shared data source selection for dashboard and map

This commit is contained in:
2026-04-21 17:56:59 +02:00
parent e244a85291
commit 86a7336ac0
5 changed files with 33 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
*/
import type { HistoryQuery } from "../types/history";
import type { TimeRange } from "../types/ban";
/**
* Compare two history query objects for semantic equality.
@@ -25,3 +26,13 @@ export function areHistoryQueriesEqual(
a.page_size === b.page_size
);
}
/**
* Return the data source for the given dashboard time range.
*
* @param range - The selected time range.
* @returns The backend source to query.
*/
export function getDataSource(range: TimeRange): "fail2ban" | "archive" {
return range === "24h" ? "fail2ban" : "archive";
}