feat(ui): Quick-Toggles überall vervollständigt

NTP-Pools, User-Accounts, Backend-Server im Detail-Panel und
Routing-Rules im Domain-Detail-Panel — alle aktiv-Felder sind
jetzt inline schaltbar, kein Modale nötig.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-05-24 11:09:48 +02:00
parent 784533eb99
commit e419eceab8
4 changed files with 64 additions and 9 deletions

View File

@@ -12,7 +12,6 @@ import { useTranslation } from 'react-i18next'
import apiClient, { isEnvelope } from '../../api/client'
import PageHeader from '../../components/PageHeader'
import ActionButtons from '../../components/ActionButtons'
import StatusDot from '../../components/StatusDot'
const { Text } = Typography
@@ -275,6 +274,14 @@ function ServerPanel({ backendID, haproxyStats }: { backendID: number; haproxySt
},
onError: (e: Error) => message.error(e.message),
})
const quickToggle = useMutation({
mutationFn: async ({ id, row, checked }: { id: number; row: BackendServer; checked: boolean }) => {
const { id: _id, ...body } = row
await apiClient.put(`/backend-servers/${id}`, { ...body, active: checked })
},
onSuccess: () => { void qc.invalidateQueries({ queryKey: ['backend-servers', backendID] }) },
onError: (e: Error) => message.error(e.message),
})
const cols: ColumnsType<BackendServer> = [
{
@@ -292,7 +299,14 @@ function ServerPanel({ backendID, haproxyStats }: { backendID: number; haproxySt
},
{
title: t('backends.active'), dataIndex: 'active', width: 80,
render: (v: boolean) => <StatusDot active={v} />,
render: (v: boolean, r: BackendServer) => (
<Switch
size="small"
checked={v}
loading={quickToggle.isPending && quickToggle.variables?.id === r.id}
onChange={(checked) => quickToggle.mutate({ id: r.id, row: r, checked })}
/>
),
},
{
title: 'Live', key: 'live', width: 160,