feat(#116): update command hooks for synchronous group response
Add CommandGroupResponse and ConfigUpdateResponse types. Switch useSendGroupCommand and useSendRouteCommand from openapi-fetch to authFetch returning CommandGroupResponse. Update useUpdateApplicationConfig to return ConfigUpdateResponse and fix all consumer onSuccess callbacks to access saved.config.version instead of saved.version. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -155,7 +155,7 @@ export default function AppConfigDetailPage() {
|
||||
updateConfig.mutate(updated, {
|
||||
onSuccess: (saved) => {
|
||||
setEditing(false);
|
||||
toast({ title: 'Config saved', description: `${appId} updated to v${saved.version}`, variant: 'success' });
|
||||
toast({ title: 'Config saved', description: `${appId} updated to v${saved.config.version}`, variant: 'success' });
|
||||
},
|
||||
onError: () => {
|
||||
toast({ title: 'Save failed', description: 'Could not update configuration', variant: 'error' });
|
||||
|
||||
@@ -141,7 +141,7 @@ function AppConfigDetail({ appId, onClose }: { appId: string; onClose: () => voi
|
||||
if (!config || !form) return;
|
||||
const updated = { ...config, ...form, tracedProcessors: tracedDraft, routeRecording: routeRecordingDraft } as ApplicationConfig;
|
||||
updateConfig.mutate(updated, {
|
||||
onSuccess: (saved) => { setEditing(false); toast({ title: 'Config saved', description: `${appId} updated to v${saved.version}`, variant: 'success' }); },
|
||||
onSuccess: (saved) => { setEditing(false); toast({ title: 'Config saved', description: `${appId} updated to v${saved.config.version}`, variant: 'success' }); },
|
||||
onError: () => { toast({ title: 'Save failed', description: 'Could not update configuration', variant: 'error' }); },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ export default function AgentHealth() {
|
||||
onSuccess: (saved) => {
|
||||
setConfigEditing(false);
|
||||
setConfigDraft({});
|
||||
toast({ title: 'Config updated', description: `${appId} (v${saved.version})`, variant: 'success' });
|
||||
toast({ title: 'Config updated', description: `${appId} (v${saved.config.version})`, variant: 'success' });
|
||||
},
|
||||
onError: () => {
|
||||
toast({ title: 'Config update failed', variant: 'error' });
|
||||
|
||||
@@ -216,7 +216,7 @@ function DiagramPanel({ appId, routeId, exchangeId, onCorrelatedSelect, onClearS
|
||||
if (!updatedConfig) return;
|
||||
updateConfig.mutate(updatedConfig, {
|
||||
onSuccess: (saved) => {
|
||||
toast({ title: 'Tap configuration saved', description: `Pushed to agents (v${saved.version})`, variant: 'success' });
|
||||
toast({ title: 'Tap configuration saved', description: `Pushed to agents (v${saved.config.version})`, variant: 'success' });
|
||||
},
|
||||
onError: () => {
|
||||
toast({ title: 'Tap update failed', description: 'Could not save configuration', variant: 'error' });
|
||||
@@ -229,7 +229,7 @@ function DiagramPanel({ appId, routeId, exchangeId, onCorrelatedSelect, onClearS
|
||||
const taps = appConfig.taps.filter(t => t.tapId !== tap.tapId);
|
||||
updateConfig.mutate({ ...appConfig, taps }, {
|
||||
onSuccess: (saved) => {
|
||||
toast({ title: 'Tap deleted', description: `${tap.attributeName} removed (v${saved.version})`, variant: 'success' });
|
||||
toast({ title: 'Tap deleted', description: `${tap.attributeName} removed (v${saved.config.version})`, variant: 'success' });
|
||||
},
|
||||
onError: () => {
|
||||
toast({ title: 'Tap delete failed', description: 'Could not save configuration', variant: 'error' });
|
||||
@@ -256,7 +256,7 @@ function DiagramPanel({ appId, routeId, exchangeId, onCorrelatedSelect, onClearS
|
||||
tracedProcessors,
|
||||
}, {
|
||||
onSuccess: (saved) => {
|
||||
toast({ title: `Tracing ${enabled ? 'enabled' : 'disabled'}`, description: `${nodeId} — pushed to agents (v${saved.version})`, variant: 'success' });
|
||||
toast({ title: `Tracing ${enabled ? 'enabled' : 'disabled'}`, description: `${nodeId} — pushed to agents (v${saved.config.version})`, variant: 'success' });
|
||||
},
|
||||
onError: () => {
|
||||
useTracingStore.getState().toggleProcessor(appId, nodeId);
|
||||
|
||||
Reference in New Issue
Block a user