mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-02-18 16:36:27 +00:00
Update system-logs.tsx
This commit is contained in:
@@ -126,7 +126,7 @@ export function SystemLogs() {
|
|||||||
setError(null)
|
setError(null)
|
||||||
try {
|
try {
|
||||||
const [logsRes, backupsRes, eventsRes, notificationsRes] = await Promise.all([
|
const [logsRes, backupsRes, eventsRes, notificationsRes] = await Promise.all([
|
||||||
fetchSystemLogs(),
|
fetchSystemLogs(dateFilter, customDays),
|
||||||
fetchApi("/api/backups"),
|
fetchApi("/api/backups"),
|
||||||
fetchApi("/api/events?limit=50"),
|
fetchApi("/api/events?limit=50"),
|
||||||
fetchApi("/api/notifications"),
|
fetchApi("/api/notifications"),
|
||||||
@@ -156,11 +156,10 @@ export function SystemLogs() {
|
|||||||
setRefreshCounter((prev) => prev + 1)
|
setRefreshCounter((prev) => prev + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchSystemLogs = async (): Promise<SystemLog[]> => {
|
const fetchSystemLogs = async (filterDays: string, filterCustom: string): Promise<SystemLog[]> => {
|
||||||
try {
|
try {
|
||||||
const daysAgo = dateFilter === "custom" ? Number.parseInt(customDays) : Number.parseInt(dateFilter)
|
const daysAgo = filterDays === "custom" ? Number.parseInt(filterCustom) : Number.parseInt(filterDays)
|
||||||
const clampedDays = Math.max(1, Math.min(daysAgo || 1, 90))
|
const clampedDays = Math.max(1, Math.min(daysAgo || 1, 90))
|
||||||
// Only send since_days - no limit param, so the backend returns ALL logs for the period
|
|
||||||
const apiUrl = `/api/logs?since_days=${clampedDays}`
|
const apiUrl = `/api/logs?since_days=${clampedDays}`
|
||||||
|
|
||||||
console.log(`[v0] Fetching logs for ${clampedDays} days...`)
|
console.log(`[v0] Fetching logs for ${clampedDays} days...`)
|
||||||
|
|||||||
Reference in New Issue
Block a user