feat(requests): conditionally render traefik reload warning

This commit is contained in:
HarikrishnanD
2025-11-07 11:40:30 +05:30
parent 1ce153371a
commit 615d89ee0c
@@ -59,6 +59,25 @@ export const ShowRequests = () => {
to: undefined, to: undefined,
}); });
// Check if logs exist to determine if traefik has been reloaded
// Only fetch when active to minimize network calls
const { data: statsLogsCheck } = api.settings.readStatsLogs.useQuery(
{
page: {
pageIndex: 0,
pageSize: 1,
},
},
{
enabled: !!isActive,
refetchInterval: 5000, // Check every 5 seconds when active
},
);
// Determine if warning should be shown
// Show warning only if active but no logs exist yet
const shouldShowWarning = isActive && (statsLogsCheck?.totalCount ?? 0) === 0;
useEffect(() => { useEffect(() => {
if (logCleanupStatus) { if (logCleanupStatus) {
setCronExpression(logCleanupStatus.cronExpression || "0 0 * * *"); setCronExpression(logCleanupStatus.cronExpression || "0 0 * * *");
@@ -79,6 +98,7 @@ export const ShowRequests = () => {
See all the incoming requests that pass trough Traefik See all the incoming requests that pass trough Traefik
</CardDescription> </CardDescription>
{shouldShowWarning && (
<AlertBlock type="warning"> <AlertBlock type="warning">
When you activate, you need to reload traefik to apply the When you activate, you need to reload traefik to apply the
changes, you can reload traefik in{" "} changes, you can reload traefik in{" "}
@@ -89,6 +109,7 @@ export const ShowRequests = () => {
Settings Settings
</Link> </Link>
</AlertBlock> </AlertBlock>
)}
</CardHeader> </CardHeader>
<CardContent className="space-y-2 py-8 border-t"> <CardContent className="space-y-2 py-8 border-t">
<div className="flex w-full gap-4 justify-end items-center"> <div className="flex w-full gap-4 justify-end items-center">