feat: Phase 1 — Config UI Schema system with per-field widget routing

- Backend: add Arma3ConfigGenerator.get_ui_schema() with widget hints per field
- Backend: add ServerService.get_config_schema() and GET /config/schema endpoint
- Frontend: add FieldSchema/ConfigSchema types + useServerConfigSchema hook
- Frontend: new TagListEditor component for dynamic string-list editing
- Frontend: ConfigEditor now routes each field to correct widget (text/number/password/textarea/select/toggle/tag-list)
- Frontend: password fields have show/hide toggle; toggles render as checkbox; tag-list uses TagListEditor
- Tests: 8 new tests covering hook and TagListEditor; all 136 tests green
This commit is contained in:
Tran G. (Revernomad) Khoa
2026-04-17 20:27:06 +07:00
parent e71dd9a600
commit dedf082491
8 changed files with 370 additions and 20 deletions

View File

@@ -115,6 +115,21 @@ export interface Mod {
path: string;
size_bytes: number;
enabled: boolean;
display_name: string | null;
workshop_id: string | null;
}
export interface FieldSchema {
widget: "text" | "number" | "password" | "textarea" | "select" | "toggle" | "tag-list";
label?: string;
placeholder?: string;
min?: number;
max?: number;
options?: string[];
}
export interface ConfigSchema {
[section: string]: { [field: string]: FieldSchema };
}
export interface ModsResponse {
@@ -125,6 +140,19 @@ export interface ModsResponse {
// ── Query Hooks ────────────────────────────────────────────────────────
export function useServerConfigSchema(serverId: number) {
return useQuery({
queryKey: ["servers", serverId, "config", "schema"],
queryFn: async () => {
const res = await apiClient.get<{ success: boolean; data: ConfigSchema }>(
`/api/servers/${serverId}/config/schema`,
);
return res.data.data;
},
enabled: serverId > 0,
});
}
export function useServerConfig(serverId: number) {
return useQuery({
queryKey: ["servers", serverId, "config"],