From f223e35cbbdb8bcc7bc5259d4522ed246cf401c2 Mon Sep 17 00:00:00 2001 From: jeffusion Date: Tue, 3 Mar 2026 16:32:21 +0800 Subject: [PATCH] feat(frontend): add config management page with UI components Add comprehensive configuration management UI: - ConfigManager: Main page with grouped config display - ConfigGroupCard: Expandable cards for each config group - ConfigFieldInput: Smart input based on field type - Text, URL, password (masked), number, boolean, enum, textarea UI Components added: - Select, Switch, Tabs, Textarea, Separator from shadcn/ui Features: - Real-time field validation - Source indicator (default/env/override) - Save/reset functionality with toast notifications - Responsive layout with collapsible groups --- frontend/src/components/ConfigFieldInput.tsx | 140 ++++++++++++++ frontend/src/components/ConfigGroupCard.tsx | 93 ++++++++++ frontend/src/components/ConfigManager.tsx | 181 +++++++++++++++++++ frontend/src/components/ui/select.tsx | 173 ++++++++++++++++++ frontend/src/components/ui/separator.tsx | 27 +++ frontend/src/components/ui/switch.tsx | 29 +++ frontend/src/components/ui/tabs.tsx | 58 ++++++ frontend/src/components/ui/textarea.tsx | 20 ++ frontend/src/services/configService.ts | 46 +++++ 9 files changed, 767 insertions(+) create mode 100644 frontend/src/components/ConfigFieldInput.tsx create mode 100644 frontend/src/components/ConfigGroupCard.tsx create mode 100644 frontend/src/components/ConfigManager.tsx create mode 100644 frontend/src/components/ui/select.tsx create mode 100644 frontend/src/components/ui/separator.tsx create mode 100644 frontend/src/components/ui/switch.tsx create mode 100644 frontend/src/components/ui/tabs.tsx create mode 100644 frontend/src/components/ui/textarea.tsx create mode 100644 frontend/src/services/configService.ts diff --git a/frontend/src/components/ConfigFieldInput.tsx b/frontend/src/components/ConfigFieldInput.tsx new file mode 100644 index 0000000..41a5e4a --- /dev/null +++ b/frontend/src/components/ConfigFieldInput.tsx @@ -0,0 +1,140 @@ + +import type { ConfigFieldDto } from '@/services/configService'; +import { Input } from '@/components/ui/input'; +import { Switch } from '@/components/ui/switch'; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; +import { Textarea } from '@/components/ui/textarea'; +import { Badge } from '@/components/ui/badge'; +import { Label } from '@/components/ui/label'; +import { Lock } from 'lucide-react'; + +interface ConfigFieldInputProps { + field: ConfigFieldDto; + value: any; + onChange: (value: any) => void; +} + +export function ConfigFieldInput({ field, value, onChange }: ConfigFieldInputProps) { + const isReadonly = !!field.readonly; + + const renderInput = () => { + const baseInputClasses = "bg-zinc-900/50 border-white/10 focus-visible:ring-primary focus-visible:border-primary transition-all duration-200" + (isReadonly ? " opacity-50 cursor-not-allowed" : ""); + switch (field.type) { + case 'boolean': + return ( + + ); + case 'enum': + return ( + + ); + case 'text': + return ( +