forked from 0xWheatyz/SPARC
Add rate limiting dashboard to admin panel
- Enhance GET /admin/rate-limits to return per-IP breakdown, 24h throttled count, and hourly time-series of rejected requests - Add AdminRateLimits React page with auto-refresh (configurable interval), summary cards, throttled-over-time bar chart, endpoint table, and per-IP breakdown table - Add TypeScript types (RateLimitStatsResponse, etc.) and adminApi.getRateLimits() - Wire up /admin/rate-limits route and nav link (admin-only) - Expand unit tests: auth, empty state, per-IP, throttled_24h, time-series, response shape contract (10 tests total) Closes leeworks-agents/SPARC#1686 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,9 @@ import { Batch } from './pages/Batch';
|
||||
import { AnalyticsPage } from './pages/Analytics';
|
||||
import { About } from './pages/About';
|
||||
import { AdminUsers } from './pages/AdminUsers';
|
||||
import { AdminRateLimits } from './pages/AdminRateLimits';
|
||||
import { Compare } from './pages/Compare';
|
||||
import { HistoryDiff } from './pages/HistoryDiff';
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
@@ -45,6 +47,7 @@ function App() {
|
||||
<Route path="/batch" element={<Batch />} />
|
||||
<Route path="/analytics" element={<AnalyticsPage />} />
|
||||
<Route path="/compare" element={<Compare />} />
|
||||
<Route path="/history-diff" element={<HistoryDiff />} />
|
||||
<Route path="/about" element={<About />} />
|
||||
|
||||
{/* Admin routes */}
|
||||
@@ -56,6 +59,14 @@ function App() {
|
||||
</ProtectedRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/admin/rate-limits"
|
||||
element={
|
||||
<ProtectedRoute requireAdmin>
|
||||
<AdminRateLimits />
|
||||
</ProtectedRoute>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
|
||||
{/* Default redirect */}
|
||||
|
||||
Reference in New Issue
Block a user