|
|
@@ -1,8 +1,10 @@
|
|
|
import { Button, Card, Form, Input, Select, Space, Switch, Table, Tag, Typography } from 'antd';
|
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
|
|
|
|
+import { StatusTag } from '../components/common/StatusTag';
|
|
|
+import { getDnsCurrentValues } from '../frontend/domain-model.js';
|
|
|
import { useI18n } from '../frontend/i18n/react';
|
|
|
-import type { RuntimeConfig, User } from '../frontend/types';
|
|
|
+import type { DnsRecord, RuntimeConfig, User } from '../frontend/types';
|
|
|
|
|
|
interface SettingsProps {
|
|
|
me: User | null;
|
|
|
@@ -28,6 +30,27 @@ export default function Settings({ me, settings, users, loading, onSave }: Setti
|
|
|
{ title: 'Role', dataIndex: 'role', render: (value) => <Tag>{value}</Tag> },
|
|
|
{ title: 'Status', dataIndex: 'status', render: (value) => <Tag color={value === 'active' ? 'success' : 'default'}>{value}</Tag> }
|
|
|
];
|
|
|
+ const checkColumns: ColumnsType<DnsRecord> = [
|
|
|
+ { title: t('settings.checkItem'), dataIndex: 'label', width: 160 },
|
|
|
+ { title: t('dnsRecord.hostname'), dataIndex: 'host', width: 180, render: (value) => <Typography.Text code>{value || '-'}</Typography.Text> },
|
|
|
+ { title: t('dnsRecord.targetValue'), dataIndex: 'value', width: 220, render: (value) => <Typography.Text code>{value || '-'}</Typography.Text> },
|
|
|
+ {
|
|
|
+ title: t('dnsRecord.currentValue'),
|
|
|
+ width: 260,
|
|
|
+ render: (_, record) => {
|
|
|
+ const values: string[] = getDnsCurrentValues(record);
|
|
|
+ return values.length
|
|
|
+ ? (
|
|
|
+ <Space direction="vertical" size={4}>
|
|
|
+ {values.map((value) => <Typography.Text key={value} code>{value}</Typography.Text>)}
|
|
|
+ </Space>
|
|
|
+ )
|
|
|
+ : <Typography.Text type="secondary">{t('dnsRecord.emptyCurrent')}</Typography.Text>;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { title: t('common.status'), width: 120, render: (_, record) => <StatusTag record={record} /> }
|
|
|
+ ];
|
|
|
+ const checkData = settings?.systemChecks?.ptr ? [settings.systemChecks.ptr] : [];
|
|
|
|
|
|
return (
|
|
|
<Space direction="vertical" size={16} className="full-width">
|
|
|
@@ -66,6 +89,22 @@ export default function Settings({ me, settings, users, loading, onSave }: Setti
|
|
|
</Button>
|
|
|
</Form>
|
|
|
</Card>
|
|
|
+ <Card
|
|
|
+ title={t('settings.deliveryChecks')}
|
|
|
+ extra={
|
|
|
+ settings?.systemChecks?.checkedAt
|
|
|
+ ? <Typography.Text type="secondary">{new Date(settings.systemChecks.checkedAt).toLocaleString()}</Typography.Text>
|
|
|
+ : null
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <Table
|
|
|
+ rowKey="key"
|
|
|
+ columns={checkColumns}
|
|
|
+ dataSource={checkData}
|
|
|
+ pagination={false}
|
|
|
+ scroll={{ x: 940 }}
|
|
|
+ />
|
|
|
+ </Card>
|
|
|
<Card title="Users">
|
|
|
<Table rowKey="id" columns={columns} dataSource={users} />
|
|
|
</Card>
|