feat: add application config overview and inline editing
Add admin page at /admin/appconfig with a DataTable showing all application configurations. Inline dropdowns allow editing log level, engine level, payload capture mode, and metrics toggle directly from the table. Changes push to agents via SSE immediately. Also adds a config bar on the AgentHealth page (/agents/:appId) for per-application config management with the same 4 settings. Backend: GET /api/v1/config list endpoint, findAll() on repository, sensible defaults for logForwardingLevel/engineLevel/payloadCaptureMode. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ export interface ApplicationConfig {
|
||||
updatedAt?: string
|
||||
engineLevel?: string
|
||||
payloadCaptureMode?: string
|
||||
logForwardingLevel?: string
|
||||
metricsEnabled: boolean
|
||||
samplingRate: number
|
||||
tracedProcessors: Record<string, string>
|
||||
@@ -24,6 +25,17 @@ function authFetch(url: string, init?: RequestInit): Promise<Response> {
|
||||
return fetch(url, { ...init, headers })
|
||||
}
|
||||
|
||||
export function useAllApplicationConfigs() {
|
||||
return useQuery({
|
||||
queryKey: ['applicationConfig', 'all'],
|
||||
queryFn: async () => {
|
||||
const res = await authFetch('/api/v1/config')
|
||||
if (!res.ok) throw new Error('Failed to fetch configs')
|
||||
return res.json() as Promise<ApplicationConfig[]>
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useApplicationConfig(application: string | undefined) {
|
||||
return useQuery({
|
||||
queryKey: ['applicationConfig', application],
|
||||
@@ -50,6 +62,7 @@ export function useUpdateApplicationConfig() {
|
||||
},
|
||||
onSuccess: (saved) => {
|
||||
queryClient.setQueryData(['applicationConfig', saved.application], saved)
|
||||
queryClient.invalidateQueries({ queryKey: ['applicationConfig', 'all'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user