feat(requests): conditionally render traefik reload warning
This commit is contained in:
Mauricio Siu
2025-12-06 12:56:21 -06:00
committed by GitHub
@@ -65,6 +65,25 @@ export const ShowRequests = () => {
to: Date | undefined; to: Date | undefined;
}>(getDefaultDateRange()); }>(getDefaultDateRange());
// 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 * * *");
@@ -85,6 +104,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{" "}
@@ -95,6 +115,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">