feat: MUI date-time pickers, multiselect hosts with search, fix host list

- Replace native datetime-local inputs with @mui/x-date-pickers DateTimePicker
  (proper dark-themed calendar popover with time picker, DD/MM/YYYY HH:mm format,
  min/max constraints between pickers, 24h clock)
- Replace single-host Select with Autocomplete (multiple, disableCloseOnSelect):
  checkbox per option, chip display with limitTags=2, built-in search/filter
- getAnalyticsHosts() now unions traffic event hosts WITH all configured proxy host
  domains (parsed from proxyHosts.domains JSON), so every proxy appears in the list
- analytics-db: buildWhere accepts hosts: string[] (empty = all); uses inArray for
  multi-host filtering via drizzle-orm
- All 6 API routes updated: accept hosts param (comma-separated) instead of host

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
fuomag9
2026-02-27 11:42:54 +01:00
parent 9e2007eb0c
commit cf74451e9a
12 changed files with 286 additions and 137 deletions

View File

@@ -5,9 +5,10 @@ import { getAnalyticsProtocols, INTERVAL_SECONDS } from '@/src/lib/analytics-db'
export async function GET(req: NextRequest) {
await requireUser();
const { searchParams } = req.nextUrl;
const host = searchParams.get('host') ?? 'all';
const hostsParam = searchParams.get('hosts') ?? '';
const hosts = hostsParam ? hostsParam.split(',').filter(Boolean) : [];
const { from, to } = resolveRange(searchParams);
const data = await getAnalyticsProtocols(from, to, host);
const data = await getAnalyticsProtocols(from, to, hosts);
return NextResponse.json(data);
}