mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-12 18:26:36 +08:00
feat(rate-limits): use 5m trend buckets and 24h/7d ranges
Overview API accepts bucket_minutes (5|60); rate-limit analysis uses 5-minute buckets and drops 15d/30d presets. Widen rank value column.
This commit is contained in:
@@ -11,7 +11,7 @@ import { LoadingStateWithBorder } from '@/components/layout/loading';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { AccessLogService } from '@/lib/services/openflare';
|
||||
|
||||
import type { OverviewRangeHours } from '../access-logs/components/access-log-utils';
|
||||
import type { RateLimitRangeHours } from '../access-logs/components/access-log-utils';
|
||||
import { AnalysisTab } from './components/analysis-tab';
|
||||
import { ConfigTab } from './components/config-tab';
|
||||
|
||||
@@ -27,15 +27,16 @@ function RateLimitsPageContent() {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const tab = resolveTab(searchParams.get('tab'));
|
||||
const [hours, setHours] = useState<OverviewRangeHours>(24);
|
||||
const [hours, setHours] = useState<RateLimitRangeHours>(24);
|
||||
const [hosts, setHosts] = useState<string[]>([]);
|
||||
|
||||
const overviewQuery = useQuery({
|
||||
queryKey: ['openflare', 'rate-limits', 'overview', hours, hosts],
|
||||
queryKey: ['openflare', 'rate-limits', 'overview', hours, hosts, 5],
|
||||
queryFn: () =>
|
||||
AccessLogService.getOverview({
|
||||
hours,
|
||||
hosts: hosts.length > 0 ? hosts : undefined,
|
||||
bucket_minutes: 5,
|
||||
}),
|
||||
enabled: !!user?.is_admin && tab === 'analysis',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user