fix: languages config, update-password
This commit is contained in:
@@ -3,6 +3,7 @@ import SealInput from '@/components/seal-form/seal-input';
|
||||
import SealSelect from '@/components/seal-form/seal-select';
|
||||
import { PageActionType } from '@/config/types';
|
||||
import { SyncOutlined } from '@ant-design/icons';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Form, Modal } from 'antd';
|
||||
import { expirationOptions } from '../config';
|
||||
import { FormData } from '../config/types';
|
||||
@@ -23,6 +24,7 @@ const AddModal: React.FC<AddModalProps> = ({
|
||||
onCancel
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
const intl = useIntl();
|
||||
const Suffix = (
|
||||
<SyncOutlined
|
||||
style={{
|
||||
@@ -53,18 +55,49 @@ const AddModal: React.FC<AddModalProps> = ({
|
||||
}
|
||||
>
|
||||
<Form name="addAPIKey" form={form} onFinish={onOk} preserve={false}>
|
||||
<Form.Item<FormData> name="name" rules={[{ required: true }]}>
|
||||
<SealInput.Input label="Name" required></SealInput.Input>
|
||||
<Form.Item<FormData>
|
||||
name="name"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: intl.formatMessage(
|
||||
{ id: 'common.form.rule.input' },
|
||||
{
|
||||
name: intl.formatMessage({ id: 'common.table.name' })
|
||||
}
|
||||
)
|
||||
}
|
||||
]}
|
||||
>
|
||||
<SealInput.Input
|
||||
label={intl.formatMessage({ id: 'common.table.name' })}
|
||||
required
|
||||
></SealInput.Input>
|
||||
</Form.Item>
|
||||
<Form.Item<FormData> name="expires_in" rules={[{ required: true }]}>
|
||||
<Form.Item<FormData>
|
||||
name="expires_in"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: intl.formatMessage(
|
||||
{ id: 'common.form.rule.select' },
|
||||
{
|
||||
name: intl.formatMessage({ id: 'apikeys.form.expiretime' })
|
||||
}
|
||||
)
|
||||
}
|
||||
]}
|
||||
>
|
||||
<SealSelect
|
||||
label="Expiration"
|
||||
label={intl.formatMessage({ id: 'apikeys.form.expiretime' })}
|
||||
required
|
||||
options={expirationOptions}
|
||||
></SealSelect>
|
||||
</Form.Item>
|
||||
<Form.Item<FormData> name="description" rules={[{ required: false }]}>
|
||||
<SealInput.TextArea label="Description"></SealInput.TextArea>
|
||||
<SealInput.TextArea
|
||||
label={intl.formatMessage({ id: 'common.table.description' })}
|
||||
></SealInput.TextArea>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
@@ -128,7 +128,7 @@ const Models: React.FC = () => {
|
||||
};
|
||||
const res = await createApisKey({ data: params });
|
||||
setOpenAddModal(false);
|
||||
message.success('successfully!');
|
||||
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
||||
setDataSource([res, ...dataSource]);
|
||||
setTotal(total + 1);
|
||||
} catch (error) {
|
||||
@@ -144,11 +144,14 @@ const Models: React.FC = () => {
|
||||
const handleDelete = (row: ListItem) => {
|
||||
Modal.confirm({
|
||||
title: '',
|
||||
content: 'Are you sure you want to delete the selected keys?',
|
||||
content: intl.formatMessage(
|
||||
{ id: 'common.delete.confirm' },
|
||||
{ type: intl.formatMessage({ id: 'apikeys.table.apikeys' }) }
|
||||
),
|
||||
async onOk() {
|
||||
console.log('OK');
|
||||
await deleteApisKey(row.id);
|
||||
message.success('successfully!');
|
||||
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
||||
fetchData();
|
||||
},
|
||||
onCancel() {
|
||||
@@ -160,10 +163,13 @@ const Models: React.FC = () => {
|
||||
const handleDeleteBatch = () => {
|
||||
Modal.confirm({
|
||||
title: '',
|
||||
content: 'Are you sure you want to delete the selected keys?',
|
||||
content: intl.formatMessage(
|
||||
{ id: 'common.delete.confirm' },
|
||||
{ type: intl.formatMessage({ id: 'apikeys.table.apikeys' }) }
|
||||
),
|
||||
async onOk() {
|
||||
await handleBatchRequest(rowSelection.selectedRowKeys, deleteApisKey);
|
||||
message.success('successfully!');
|
||||
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
||||
fetchData();
|
||||
},
|
||||
onCancel() {
|
||||
@@ -172,12 +178,6 @@ const Models: React.FC = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const handleEditUser = () => {
|
||||
setOpenAddModal(true);
|
||||
setAction(PageAction.EDIT);
|
||||
setTitle('Edit User');
|
||||
};
|
||||
|
||||
const renderSecrectKey = (text: string, record: ListItem) => {
|
||||
const { value } = record;
|
||||
|
||||
@@ -187,7 +187,7 @@ const Models: React.FC = () => {
|
||||
{value && (
|
||||
<span>
|
||||
<Tag color="error" style={{ padding: '10px 12px' }}>
|
||||
确保立即复制您的个人访问密钥。您将无法再次看到它!
|
||||
{intl.formatMessage({ id: 'apikeys.table.save.tips' })}
|
||||
</Tag>
|
||||
<span className="flex-center">
|
||||
<Tooltip
|
||||
@@ -299,7 +299,7 @@ const Models: React.FC = () => {
|
||||
}}
|
||||
/>
|
||||
<Column
|
||||
title="Operation"
|
||||
title={intl.formatMessage({ id: 'common.table.operation' })}
|
||||
key="operation"
|
||||
render={(text, record: ListItem) => {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user