feat(dns+ntp): DNS-Cache-Flush + NTP-Force-Sync — operative Aktionen (1.1.94)
Backend: POST /dns/flush-cache (unbound-control flush_zone .)
POST /ntp/force-sync (chronyc makestep)
Beide werden im Audit-Log festgehalten.
UI: Schaltflächen in DNS-Settings und NTP-Settings neben Save,
mit Tooltip-Beschreibung + i18n (de+en).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useState } from 'react'
|
||||
import { Alert, Button, Drawer, Form, Input, InputNumber, Modal, Select, Space, Switch, Tabs, Tag, Tooltip, Typography, message } from 'antd'
|
||||
import type { ColumnsType } from 'antd/es/table'
|
||||
import { CheckCircleOutlined, CloseCircleOutlined, GlobalOutlined, NodeIndexOutlined, PlusOutlined, SettingOutlined } from '@ant-design/icons'
|
||||
import { CheckCircleOutlined, ClearOutlined, CloseCircleOutlined, GlobalOutlined, NodeIndexOutlined, PlusOutlined, SettingOutlined } from '@ant-design/icons'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
@@ -490,6 +490,12 @@ function SettingsTab() {
|
||||
onError: (e: Error) => message.error(e.message),
|
||||
})
|
||||
|
||||
const flushCache = useMutation({
|
||||
mutationFn: async () => { await apiClient.post('/dns/flush-cache') },
|
||||
onSuccess: () => message.success(t('dns.settings.flushCacheOk')),
|
||||
onError: (e: Error) => message.error(t('dns.settings.flushCacheFailed') + ': ' + e.message),
|
||||
})
|
||||
|
||||
if (isLoading) return null
|
||||
return (
|
||||
<Form
|
||||
@@ -540,11 +546,22 @@ function SettingsTab() {
|
||||
</Form.Item>
|
||||
</Space>
|
||||
<Form.Item>
|
||||
<Tooltip title={isViewer ? t('auth.viewerBadge') : undefined}>
|
||||
<Button type="primary" htmlType="submit" disabled={isViewer} loading={save.isPending}>
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Space>
|
||||
<Tooltip title={isViewer ? t('auth.viewerBadge') : undefined}>
|
||||
<Button type="primary" htmlType="submit" disabled={isViewer} loading={save.isPending}>
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip title={t('dns.settings.flushCacheTooltip')}>
|
||||
<Button
|
||||
icon={<ClearOutlined />}
|
||||
loading={flushCache.isPending}
|
||||
onClick={() => flushCache.mutate()}
|
||||
>
|
||||
{t('dns.settings.flushCacheBtn')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
Alert, Button, Card, Col, Form, Input, InputNumber, Modal, Row, Select, Space, Statistic, Switch, Tabs, Tag, Tooltip, Typography, message,
|
||||
} from 'antd'
|
||||
import type { ColumnsType } from 'antd/es/table'
|
||||
import { CheckCircleOutlined, ClockCircleOutlined, CloseCircleOutlined, DatabaseOutlined, PlusOutlined, ReloadOutlined, SettingOutlined } from '@ant-design/icons'
|
||||
import { CheckCircleOutlined, ClockCircleOutlined, CloseCircleOutlined, DatabaseOutlined, PlusOutlined, ReloadOutlined, SettingOutlined, ThunderboltOutlined } from '@ant-design/icons'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
@@ -381,6 +381,12 @@ function SettingsTab() {
|
||||
onError: (e: Error) => message.error(e.message),
|
||||
})
|
||||
|
||||
const forceSync = useMutation({
|
||||
mutationFn: async () => { await apiClient.post('/ntp/force-sync') },
|
||||
onSuccess: () => message.success(t('ntp.settings.forceSyncOk')),
|
||||
onError: (e: Error) => message.error(t('ntp.settings.forceSyncFailed') + ': ' + e.message),
|
||||
})
|
||||
|
||||
if (isLoading) return null
|
||||
return (
|
||||
<Form
|
||||
@@ -423,11 +429,22 @@ function SettingsTab() {
|
||||
<Input placeholder="right/UTC" allowClear />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Tooltip title={isViewer ? t('auth.viewerBadge') : undefined}>
|
||||
<Button type="primary" htmlType="submit" disabled={isViewer} loading={save.isPending}>
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Space>
|
||||
<Tooltip title={isViewer ? t('auth.viewerBadge') : undefined}>
|
||||
<Button type="primary" htmlType="submit" disabled={isViewer} loading={save.isPending}>
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip title={t('ntp.settings.forceSyncTooltip')}>
|
||||
<Button
|
||||
icon={<ThunderboltOutlined />}
|
||||
loading={forceSync.isPending}
|
||||
onClick={() => forceSync.mutate()}
|
||||
>
|
||||
{t('ntp.settings.forceSyncBtn')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user