feat: persistent per-application config with GET/PUT endpoints
Add application_config table (V4 migration), repository, and REST
controller. GET /api/v1/config/{app} returns config, PUT saves and
pushes CONFIG_UPDATE to all LIVE agents via SSE. UI tracing toggle
now uses config API instead of direct SET_TRACED_PROCESSORS command.
Tracing store syncs with server config on load.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,8 @@ interface TracingState {
|
||||
isTraced: (app: string, processorId: string) => boolean
|
||||
/** Toggle processor tracing (BOTH on, remove on off). Returns the full map for the app. */
|
||||
toggleProcessor: (app: string, processorId: string) => Record<string, CaptureMode>
|
||||
/** Sync store with server-side config (called when config is fetched). */
|
||||
syncFromServer: (app: string, tracedProcessors: Record<string, string>) => void
|
||||
}
|
||||
|
||||
export const useTracingStore = create<TracingState>((set, get) => ({
|
||||
@@ -25,4 +27,14 @@ export const useTracingStore = create<TracingState>((set, get) => ({
|
||||
}))
|
||||
return current
|
||||
},
|
||||
|
||||
syncFromServer: (app, serverMap) => {
|
||||
const mapped: Record<string, CaptureMode> = {}
|
||||
for (const [k, v] of Object.entries(serverMap)) {
|
||||
mapped[k] = v as CaptureMode
|
||||
}
|
||||
set((state) => ({
|
||||
tracedProcessors: { ...state.tracedProcessors, [app]: mapped },
|
||||
}))
|
||||
},
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user