Files
cameleer-server/ui/src/stores/tracing-store.ts
hsiegeln 4cdbcdaeea
Some checks failed
CI / cleanup-branch (push) Has been skipped
CI / build (push) Failing after 32s
CI / docker (push) Has been skipped
CI / deploy (push) Has been skipped
CI / deploy-feature (push) Has been skipped
fix: update frontend field names for identity rename (applicationId, instanceId)
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>
2026-04-01 18:22:16 +02:00

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 },
}))
},
}))