|
@ -1,5 +1,5 @@ |
|
|
import { useTranslation } from '../../../i18n.ts' |
|
|
import { useTranslation } from '../../../i18n.ts' |
|
|
import { Button, Form, Popconfirm, Divider, Space, Tooltip, Badge } from 'antd' |
|
|
|
|
|
|
|
|
import { Button, Form, Space, Tooltip, Badge, Divider } from 'antd' |
|
|
import { useAtom, useAtomValue } from 'jotai' |
|
|
import { useAtom, useAtomValue } from 'jotai' |
|
|
import { |
|
|
import { |
|
|
deleteWebsiteDnsAccountAtom, |
|
|
deleteWebsiteDnsAccountAtom, |
|
@ -17,8 +17,10 @@ import { useStyle } from './style.ts' |
|
|
import { FilterOutlined } from '@ant-design/icons' |
|
|
import { FilterOutlined } from '@ant-design/icons' |
|
|
import { getValueCount } from '@/utils' |
|
|
import { getValueCount } from '@/utils' |
|
|
import { Table as ProTable } from '@/components/table' |
|
|
import { Table as ProTable } from '@/components/table' |
|
|
import {DNSTypeEnum, DNSTypes, syncDNSAtom} from "@/store/websites/dns.ts"; |
|
|
|
|
|
import {WebSite} from "@/types"; |
|
|
|
|
|
|
|
|
import { DNSTypeEnum, DNSTypes, syncDNSAtom } from '@/store/websites/dns.ts' |
|
|
|
|
|
import { WebSite } from '@/types' |
|
|
|
|
|
import Switch from '@/components/switch' |
|
|
|
|
|
import Popconfirm from '@/components/popconfirm' |
|
|
|
|
|
|
|
|
const i18nPrefix = 'websiteDnsAccounts.list' |
|
|
const i18nPrefix = 'websiteDnsAccounts.list' |
|
|
const getKeyColumn = (type: string, t) => { |
|
|
const getKeyColumn = (type: string, t) => { |
|
@ -28,14 +30,14 @@ const getKeyColumn = (type: string, t) => { |
|
|
columns.push(...[ |
|
|
columns.push(...[ |
|
|
{ |
|
|
{ |
|
|
title: t('website.ssl.dns.columns.accessKey', 'Access Key'), |
|
|
title: t('website.ssl.dns.columns.accessKey', 'Access Key'), |
|
|
dataIndex: 'accessKey', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'accessKey' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: t('website.ssl.dns.columns.secretKey', 'Secret Key'), |
|
|
title: t('website.ssl.dns.columns.secretKey', 'Secret Key'), |
|
|
dataIndex: 'secretKey', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'secretKey' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
@ -47,13 +49,13 @@ const getKeyColumn = (type: string, t) => { |
|
|
columns.push(...[ |
|
|
columns.push(...[ |
|
|
{ |
|
|
{ |
|
|
title: t('website.ssl.dns.columns.secretID', 'Secret ID'), |
|
|
title: t('website.ssl.dns.columns.secretID', 'Secret ID'), |
|
|
dataIndex: 'secretID', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'secretID' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: t('website.ssl.dns.columns.secretKey', 'Secret Key'), |
|
|
title: t('website.ssl.dns.columns.secretKey', 'Secret Key'), |
|
|
dataIndex: 'secretKey', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'secretKey' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
@ -65,13 +67,13 @@ const getKeyColumn = (type: string, t) => { |
|
|
columns.push(...[ |
|
|
columns.push(...[ |
|
|
{ |
|
|
{ |
|
|
title: t('website.ssl.dns.columns.apiId', 'ID'), |
|
|
title: t('website.ssl.dns.columns.apiId', 'ID'), |
|
|
dataIndex: 'apiId', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'apiId' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: t('website.ssl.dns.columns.token', 'Token'), |
|
|
title: t('website.ssl.dns.columns.token', 'Token'), |
|
|
dataIndex: 'token', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'token' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
@ -83,13 +85,13 @@ const getKeyColumn = (type: string, t) => { |
|
|
columns.push(...[ |
|
|
columns.push(...[ |
|
|
{ |
|
|
{ |
|
|
title: t('website.ssl.dns.columns.email', 'Email'), |
|
|
title: t('website.ssl.dns.columns.email', 'Email'), |
|
|
dataIndex: 'email', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'email' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: t('website.ssl.dns.columns.apiKey', 'API ToKen'), |
|
|
title: t('website.ssl.dns.columns.apiKey', 'API ToKen'), |
|
|
dataIndex: 'apiKey', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'apiKey' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
@ -103,7 +105,7 @@ const getKeyColumn = (type: string, t) => { |
|
|
case DNSTypeEnum.NameSilo: |
|
|
case DNSTypeEnum.NameSilo: |
|
|
columns.push({ |
|
|
columns.push({ |
|
|
title: t('website.ssl.dns.columns.apiKey', 'API Key'), |
|
|
title: t('website.ssl.dns.columns.apiKey', 'API Key'), |
|
|
dataIndex: 'apiKey', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'apiKey' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
@ -112,7 +114,7 @@ const getKeyColumn = (type: string, t) => { |
|
|
if (type === DNSTypeEnum.NameCheap) { |
|
|
if (type === DNSTypeEnum.NameCheap) { |
|
|
columns.push({ |
|
|
columns.push({ |
|
|
title: t('website.ssl.dns.columns.apiUser', 'API User'), |
|
|
title: t('website.ssl.dns.columns.apiUser', 'API User'), |
|
|
dataIndex: 'apiUser', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'apiUser' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
@ -120,7 +122,7 @@ const getKeyColumn = (type: string, t) => { |
|
|
} else if (type === DNSTypeEnum.Godaddy) { |
|
|
} else if (type === DNSTypeEnum.Godaddy) { |
|
|
columns.push({ |
|
|
columns.push({ |
|
|
title: t('website.ssl.dns.columns.apiSecret', 'API Secret'), |
|
|
title: t('website.ssl.dns.columns.apiSecret', 'API Secret'), |
|
|
dataIndex: 'apiSecret', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'apiSecret' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
@ -131,14 +133,14 @@ const getKeyColumn = (type: string, t) => { |
|
|
columns.push( |
|
|
columns.push( |
|
|
{ |
|
|
{ |
|
|
title: t('website.ssl.dns.columns.apiUser', 'UserName'), |
|
|
title: t('website.ssl.dns.columns.apiUser', 'UserName'), |
|
|
dataIndex: 'apiUser', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'apiUser' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: t('website.ssl.dns.columns.token', 'Token'), |
|
|
title: t('website.ssl.dns.columns.token', 'Token'), |
|
|
dataIndex: 'token', |
|
|
|
|
|
|
|
|
dataIndex: [ 'authorization', 'token' ], |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
rules: [ { required: true, message: t('message.required') } ] |
|
|
} |
|
|
} |
|
@ -181,6 +183,12 @@ const WebsiteDnsAccount = () => { |
|
|
title: t(`${i18nPrefix}.columns.name`, '名称'), |
|
|
title: t(`${i18nPrefix}.columns.name`, '名称'), |
|
|
dataIndex: 'name', |
|
|
dataIndex: 'name', |
|
|
valueType: 'text', |
|
|
valueType: 'text', |
|
|
|
|
|
width: 250, |
|
|
|
|
|
fieldProps: { |
|
|
|
|
|
style: { |
|
|
|
|
|
width: '100%' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
|
rules: [ |
|
|
rules: [ |
|
|
{ required: true, message: t('message.required', '请输入') } |
|
|
{ required: true, message: t('message.required', '请输入') } |
|
@ -188,10 +196,26 @@ const WebsiteDnsAccount = () => { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
|
|
|
title: t(`${i18nPrefix}.columns.name`, '标签'), |
|
|
|
|
|
dataIndex: 'tag', |
|
|
|
|
|
valueType: 'text', |
|
|
|
|
|
hideInForm: true, |
|
|
|
|
|
width: 200, |
|
|
|
|
|
fieldProps: { |
|
|
|
|
|
style: { |
|
|
|
|
|
width: '100%' |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
title: t(`${i18nPrefix}.columns.type`, '类型'), |
|
|
title: t(`${i18nPrefix}.columns.type`, '类型'), |
|
|
dataIndex: 'type', |
|
|
dataIndex: 'type', |
|
|
valueType: 'select', |
|
|
valueType: 'select', |
|
|
|
|
|
width: 200, |
|
|
fieldProps: { |
|
|
fieldProps: { |
|
|
|
|
|
style: { |
|
|
|
|
|
width: '100%' |
|
|
|
|
|
}, |
|
|
options: DNSTypes |
|
|
options: DNSTypes |
|
|
}, |
|
|
}, |
|
|
formItemProps: { |
|
|
formItemProps: { |
|
@ -212,10 +236,16 @@ const WebsiteDnsAccount = () => { |
|
|
{ |
|
|
{ |
|
|
title: t(`${i18nPrefix}.columns.status`, '状态'), |
|
|
title: t(`${i18nPrefix}.columns.status`, '状态'), |
|
|
dataIndex: 'status', |
|
|
dataIndex: 'status', |
|
|
|
|
|
valueType: 'switch', |
|
|
|
|
|
width: 200, |
|
|
|
|
|
render(_dom, record) { |
|
|
|
|
|
return <Switch size={'small'} value={record.status}/> |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: t(`${i18nPrefix}.columns.option`, '操作'), |
|
|
title: t(`${i18nPrefix}.columns.option`, '操作'), |
|
|
key: 'option', |
|
|
key: 'option', |
|
|
|
|
|
width: 300, |
|
|
valueType: 'option', |
|
|
valueType: 'option', |
|
|
fixed: 'right', |
|
|
fixed: 'right', |
|
|
render: (_, record) => [ |
|
|
render: (_, record) => [ |
|
@ -223,20 +253,24 @@ const WebsiteDnsAccount = () => { |
|
|
as={'a'} |
|
|
as={'a'} |
|
|
disabled={record.status === 2} |
|
|
disabled={record.status === 2} |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
|
|
|
|
record.status = record.status > 0 |
|
|
|
|
|
if (typeof record.authorization === 'string') { |
|
|
|
|
|
record.authorization = JSON.parse(record.authorization) |
|
|
|
|
|
} |
|
|
form.setFieldsValue(record) |
|
|
form.setFieldsValue(record) |
|
|
setOpen(true) |
|
|
setOpen(true) |
|
|
}}>{t('actions.edit')}</Action>, |
|
|
}}>{t('actions.edit')}</Action>, |
|
|
|
|
|
<Divider type={'vertical'}/>, |
|
|
<Popconfirm |
|
|
<Popconfirm |
|
|
key={'sync_confirm'} |
|
|
key={'sync_confirm'} |
|
|
disabled={isAsyncing || record.status === 2} |
|
|
disabled={isAsyncing || record.status === 2} |
|
|
onConfirm={() => { |
|
|
onConfirm={() => { |
|
|
asyncDNS(record) |
|
|
asyncDNS(record) |
|
|
}} |
|
|
}} |
|
|
title={t('message.deleteConfirm')}> |
|
|
|
|
|
<a key="del"> |
|
|
|
|
|
|
|
|
title={t('message.syncConfirm', '您确定要同步吗?')}> |
|
|
{t('actions.sync', '同步')} |
|
|
{t('actions.sync', '同步')} |
|
|
</a> |
|
|
|
|
|
</Popconfirm>, |
|
|
</Popconfirm>, |
|
|
|
|
|
<Divider type={'vertical'}/>, |
|
|
<Popconfirm |
|
|
<Popconfirm |
|
|
key={'del_confirm'} |
|
|
key={'del_confirm'} |
|
|
disabled={isDeleting} |
|
|
disabled={isDeleting} |
|
@ -244,9 +278,7 @@ const WebsiteDnsAccount = () => { |
|
|
deleteWebsiteDnsAccount([ record.id ]) |
|
|
deleteWebsiteDnsAccount([ record.id ]) |
|
|
}} |
|
|
}} |
|
|
title={t('message.deleteConfirm')}> |
|
|
title={t('message.deleteConfirm')}> |
|
|
<a key="del"> |
|
|
|
|
|
{t('actions.delete', '删除')} |
|
|
{t('actions.delete', '删除')} |
|
|
</a> |
|
|
|
|
|
</Popconfirm> |
|
|
</Popconfirm> |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
@ -270,7 +302,19 @@ const WebsiteDnsAccount = () => { |
|
|
<ListPageLayout className={styles.container}> |
|
|
<ListPageLayout className={styles.container}> |
|
|
<ProTable |
|
|
<ProTable |
|
|
rowKey="id" |
|
|
rowKey="id" |
|
|
headerTitle={t(`${i18nPrefix}.title`, '账号管理管理')} |
|
|
|
|
|
|
|
|
headerTitle={ |
|
|
|
|
|
<Space> |
|
|
|
|
|
<Button key={'add'} |
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
form.resetFields() |
|
|
|
|
|
form.setFieldsValue({ |
|
|
|
|
|
id: 0, |
|
|
|
|
|
}) |
|
|
|
|
|
setOpen(true) |
|
|
|
|
|
}} |
|
|
|
|
|
type={'primary'}>{t(`${i18nPrefix}.add`, '添加帐号')}</Button> |
|
|
|
|
|
</Space> |
|
|
|
|
|
} |
|
|
toolbar={{ |
|
|
toolbar={{ |
|
|
search: { |
|
|
search: { |
|
|
loading: isFetching && !!search?.title, |
|
|
loading: isFetching && !!search?.title, |
|
@ -298,25 +342,17 @@ const WebsiteDnsAccount = () => { |
|
|
</Badge> |
|
|
</Badge> |
|
|
</Tooltip>, |
|
|
</Tooltip>, |
|
|
<Divider type={'vertical'} key={'divider'}/>, |
|
|
<Divider type={'vertical'} key={'divider'}/>, |
|
|
<Button key={'add'} |
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
form.resetFields() |
|
|
|
|
|
form.setFieldsValue({ |
|
|
|
|
|
id: 0, |
|
|
|
|
|
}) |
|
|
|
|
|
setOpen(true) |
|
|
|
|
|
}} |
|
|
|
|
|
type={'primary'}>{t(`${i18nPrefix}.add`, '添加')}</Button> |
|
|
|
|
|
] |
|
|
] |
|
|
}} |
|
|
}} |
|
|
scroll={{ |
|
|
scroll={{ |
|
|
x: 2500, y: 'calc(100vh - 290px)' |
|
|
|
|
|
|
|
|
// x: 2500,
|
|
|
|
|
|
y: 'calc(100vh - 290px)' |
|
|
}} |
|
|
}} |
|
|
search={false} |
|
|
search={false} |
|
|
onRow={(record) => { |
|
|
onRow={(record) => { |
|
|
return { |
|
|
return { |
|
|
className: cx({ |
|
|
className: cx({ |
|
|
'ant-table-row-selected': currentWebsiteDnsAccount?.id === record.id |
|
|
|
|
|
|
|
|
// 'ant-table-row-selected': currentWebsiteDnsAccount?.id === record.id
|
|
|
}), |
|
|
}), |
|
|
onClick: () => { |
|
|
onClick: () => { |
|
|
setWebsiteDnsAccount(record) |
|
|
setWebsiteDnsAccount(record) |
|
@ -375,9 +411,11 @@ const WebsiteDnsAccount = () => { |
|
|
//
|
|
|
//
|
|
|
// }}
|
|
|
// }}
|
|
|
onFinish={async (values) => { |
|
|
onFinish={async (values) => { |
|
|
|
|
|
values.status = values.status ? 1 : 0 |
|
|
saveOrUpdate(values) |
|
|
saveOrUpdate(values) |
|
|
}} |
|
|
}} |
|
|
columns={columns as ProFormColumnsType[]}/> |
|
|
columns={columns as ProFormColumnsType[]}/> |
|
|
|
|
|
|
|
|
<BetaSchemaForm |
|
|
<BetaSchemaForm |
|
|
title={t(`${i18nPrefix}.filter.title`, '账号管理高级查询')} |
|
|
title={t(`${i18nPrefix}.filter.title`, '账号管理高级查询')} |
|
|
grid={true} |
|
|
grid={true} |
|
@ -438,6 +476,7 @@ const WebsiteDnsAccount = () => { |
|
|
|
|
|
|
|
|
}} |
|
|
}} |
|
|
columns={columns.filter(item => !item.hideInSearch) as ProFormColumnsType[]}/> |
|
|
columns={columns.filter(item => !item.hideInSearch) as ProFormColumnsType[]}/> |
|
|
|
|
|
|
|
|
</ListPageLayout> |
|
|
</ListPageLayout> |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|