Refactor shared data source selection for dashboard and map
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user