The backend identity rename (applicationName → applicationId, agentId → instanceId) was not reflected in the frontend. This caused drilldown to fail (detail.applicationName was undefined, disabling the diagram fetch) and various display issues. Updated schema.d.ts, ExchangeHeader, ExecutionDiagram, Dashboard, AgentHealth, AgentInstance, LayoutShell, LogTab, InfoTab, DetailPanel, ExchangesPage, and tracing-store. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { create } from 'zustand'
|
|
|
|
type CaptureMode = 'NONE' | 'INPUT' | 'OUTPUT' | 'BOTH'
|
|
|
|
interface TracingState {
|
|
/** Key: applicationId → { processorId: captureMode } */
|
|
tracedProcessors: Record<string, Record<string, CaptureMode>>
|
|
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) => ({
|
|
tracedProcessors: {},
|
|
|
|
isTraced: (app, processorId) =>
|
|
processorId in (get().tracedProcessors[app] ?? {}),
|
|
|
|
toggleProcessor: (app, processorId) => {
|
|
const current = { ...(get().tracedProcessors[app] ?? {}) }
|
|
if (processorId in current) delete current[processorId]
|
|
else current[processorId] = 'BOTH'
|
|
set((state) => ({
|
|
tracedProcessors: { ...state.tracedProcessors, [app]: current },
|
|
}))
|
|
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 },
|
|
}))
|
|
},
|
|
}))
|