Complete the group→application terminology rename in the agent registry subsystem: - AgentInfo: field group → application, all wither methods updated - AgentRegistryService: findByGroup → findByApplication - AgentInstanceResponse: field group → application (API response) - AgentRegistrationRequest: field group → application (API request) - JwtServiceImpl: parameter names group → application (JWT claim string "group" preserved for token backward compatibility) - All controllers, lifecycle monitor, command controller updated - Integration tests: JSON request bodies "group" → "application" - Frontend: schema.d.ts, openapi.json, agent queries, AgentHealth RBAC group references (groups table, GroupAdminController, etc.) are NOT affected — they are a separate domain concept. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { api } from '../client';
|
|
|
|
interface DiagramLayout {
|
|
width?: number;
|
|
height?: number;
|
|
nodes?: Array<{ id?: string; label?: string; type?: string; x?: number; y?: number; width?: number; height?: number }>;
|
|
edges?: Array<{ from?: string; to?: string }>;
|
|
}
|
|
|
|
export function useDiagramLayout(contentHash: string | null) {
|
|
return useQuery({
|
|
queryKey: ['diagrams', 'layout', contentHash],
|
|
queryFn: async () => {
|
|
const { data, error } = await api.GET('/diagrams/{contentHash}/render', {
|
|
params: { path: { contentHash: contentHash! } },
|
|
headers: { Accept: 'application/json' },
|
|
});
|
|
if (error) throw new Error('Failed to load diagram layout');
|
|
return data as DiagramLayout;
|
|
},
|
|
enabled: !!contentHash,
|
|
});
|
|
}
|
|
|
|
export function useDiagramByRoute(application: string | undefined, routeId: string | undefined) {
|
|
return useQuery({
|
|
queryKey: ['diagrams', 'byRoute', application, routeId],
|
|
queryFn: async () => {
|
|
const { data, error } = await api.GET('/diagrams', {
|
|
params: { query: { application: application!, routeId: routeId! } },
|
|
});
|
|
if (error) throw new Error('Failed to load diagram for route');
|
|
return data!;
|
|
},
|
|
enabled: !!application && !!routeId,
|
|
});
|
|
}
|