feat(backups): Quick-Toggle für Remote-Ziele + hardcodiertes an/aus entfernt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -116,6 +116,16 @@ export default function RemoteTargetsTab() {
|
|||||||
},
|
},
|
||||||
onError: (e: Error) => msg.error(e.message),
|
onError: (e: Error) => msg.error(e.message),
|
||||||
})
|
})
|
||||||
|
const quickToggle = useMutation({
|
||||||
|
mutationFn: async ({ id, row, checked }: { id: number; row: RemoteTarget; checked: boolean }) => {
|
||||||
|
await apiClient.put(`/backup-remotes/${id}`, {
|
||||||
|
name: row.name, kind: row.kind, target_url: row.target_url,
|
||||||
|
settings: row.settings, active: checked,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onSuccess: () => { void qc.invalidateQueries({ queryKey: ['backup-remotes'] }) },
|
||||||
|
onError: (e: Error) => message.error(e.message),
|
||||||
|
})
|
||||||
const del = useMutation({
|
const del = useMutation({
|
||||||
mutationFn: async (id: number) => { await apiClient.delete(`/backup-remotes/${id}`) },
|
mutationFn: async (id: number) => { await apiClient.delete(`/backup-remotes/${id}`) },
|
||||||
onSuccess: () => { qc.invalidateQueries({ queryKey: ['backup-remotes'] }) },
|
onSuccess: () => { qc.invalidateQueries({ queryKey: ['backup-remotes'] }) },
|
||||||
@@ -156,7 +166,14 @@ export default function RemoteTargetsTab() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('remotes.col.active'), dataIndex: 'active', width: 80,
|
title: t('remotes.col.active'), dataIndex: 'active', width: 80,
|
||||||
render: (v: boolean) => v ? <Tag color="green">an</Tag> : <Tag>aus</Tag>,
|
render: (v: boolean, r: RemoteTarget) => (
|
||||||
|
<Switch
|
||||||
|
size="small"
|
||||||
|
checked={v}
|
||||||
|
loading={quickToggle.isPending && quickToggle.variables?.id === r.id}
|
||||||
|
onChange={(checked) => quickToggle.mutate({ id: r.id, row: r, checked })}
|
||||||
|
/>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('common.actions'), key: 'a', width: 240,
|
title: t('common.actions'), key: 'a', width: 240,
|
||||||
|
|||||||
Reference in New Issue
Block a user