mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-18 11:36:17 +00:00
Update system-logs.tsx
This commit is contained in:
@@ -120,6 +120,16 @@ export function SystemLogs() {
|
|||||||
fetchAllData()
|
fetchAllData()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (dateFilter !== "now") {
|
||||||
|
console.log("[v0] Date filter changed to:", dateFilter)
|
||||||
|
fetchSystemLogs().then((newLogs) => {
|
||||||
|
console.log("[v0] Loaded logs for date filter:", dateFilter, "Count:", newLogs.length)
|
||||||
|
setLogs(newLogs)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [dateFilter, customDays])
|
||||||
|
|
||||||
const fetchAllData = async () => {
|
const fetchAllData = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
@@ -158,7 +168,14 @@ export function SystemLogs() {
|
|||||||
|
|
||||||
const fetchSystemLogs = async (): Promise<SystemLog[]> => {
|
const fetchSystemLogs = async (): Promise<SystemLog[]> => {
|
||||||
try {
|
try {
|
||||||
const apiUrl = getApiUrl("/api/logs")
|
let apiUrl = getApiUrl("/api/logs")
|
||||||
|
|
||||||
|
// Add date filter parameters if not "now"
|
||||||
|
if (dateFilter !== "now") {
|
||||||
|
const daysAgo = dateFilter === "custom" ? Number.parseInt(customDays) : Number.parseInt(dateFilter)
|
||||||
|
apiUrl += `?since_days=${daysAgo}`
|
||||||
|
console.log("[v0] Fetching logs with since_days:", daysAgo)
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetch(apiUrl, {
|
const response = await fetch(apiUrl, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|||||||
Reference in New Issue
Block a user