diff --git a/management-ui/src/pages/Alerts/index.tsx b/management-ui/src/pages/Alerts/index.tsx index 78dd81e..dbc3a02 100644 --- a/management-ui/src/pages/Alerts/index.tsx +++ b/management-ui/src/pages/Alerts/index.tsx @@ -129,6 +129,13 @@ export default function AlertsPage() { }, onError: (e: Error) => message.error(e.message), }) + const quickToggle = useMutation({ + mutationFn: async ({ id, row, checked }: { id: number; row: Channel; checked: boolean }) => { + await apiClient.put(`/alerts/channels/${id}`, buildPayload({ ...row, active: checked } as ChannelFormValues)) + }, + onSuccess: () => { void qc.invalidateQueries({ queryKey: ['alerts', 'channels'] }) }, + onError: (e: Error) => message.error(e.message), + }) const del = useMutation({ mutationFn: async (id: number) => { await apiClient.delete(`/alerts/channels/${id}`) }, onSuccess: () => { qc.invalidateQueries({ queryKey: ['alerts', 'channels'] }) }, @@ -161,8 +168,14 @@ export default function AlertsPage() { }, { title: t('alerts.col.active'), dataIndex: 'active', width: 80, - render: (v: boolean) => - v ? an : aus, + render: (v: boolean, r: Channel) => ( + quickToggle.mutate({ id: r.id, row: r, checked })} + /> + ), }, { title: t('common.actions'), key: 'a', width: 180,