mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2026-03-13 09:02:05 +08:00
feat: Team page add i18n
This commit is contained in:
@@ -299,7 +299,7 @@ export default forwardRef(function CreateConnection(props: IProps, ref: Forwarde
|
||||
loading={loadings.confirmButton}
|
||||
onClick={saveConnection.bind(null, backfillData.id ? submitType.UPDATE : submitType.SAVE)}
|
||||
>
|
||||
{backfillData.id ? i18n('common.button.edit') : i18n('common.button.save')}
|
||||
{backfillData.id ? i18n('common.button.modify') : i18n('common.button.save')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ export default {
|
||||
'common.text.is': 'no',
|
||||
'common.button.affirm': 'Affirm',
|
||||
'common.button.edit': 'Edit',
|
||||
'common.button.modify': 'Modify',
|
||||
'common.button.confirm': 'Confirm',
|
||||
'common.button.cancel': 'Cancel',
|
||||
'common.data.hour': '{1} {hour|hours}',
|
||||
@@ -75,5 +76,8 @@ export default {
|
||||
'common.text.editorRightClick': 'Editor right click',
|
||||
'common.form.error.required': 'This field is required!',
|
||||
'common.form.error.email': 'The input is not a valid email!',
|
||||
'common.tips.delete.confirm': 'Are you sure to delete it?'
|
||||
'common.tips.delete.confirm': 'Are you sure to delete it?',
|
||||
'common.tips.updateSuccess': 'Update Successfully',
|
||||
'common.tips.createSuccess': 'Create Successfully',
|
||||
'common.text.action': 'Action'
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ import setting from './setting';
|
||||
import workspace from './workspace';
|
||||
import dashboard from './dashboard';
|
||||
import chat from './chat';
|
||||
import team from './team'
|
||||
|
||||
export default {
|
||||
lang: 'en',
|
||||
@@ -14,5 +15,6 @@ export default {
|
||||
...workspace,
|
||||
...menu,
|
||||
...dashboard,
|
||||
...chat
|
||||
...chat,
|
||||
...team
|
||||
};
|
||||
|
||||
39
chat2db-client/src/i18n/en-us/team.ts
Normal file
39
chat2db-client/src/i18n/en-us/team.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
export default {
|
||||
'team.tab.datasource': 'DataSource Management',
|
||||
'team.tab.user': 'User Management',
|
||||
'team.tab.team': 'Team Management',
|
||||
'team.datasource.alias': 'DataSource Name',
|
||||
'team.datasource.url': 'DataSource URL',
|
||||
'team.user.userName': 'UserName',
|
||||
'team.user.nickName': 'NickName',
|
||||
'team.user.status': 'Status',
|
||||
'team.action.rightManagement': 'Right Management',
|
||||
'team.action.editDatasource': 'Edit DataSource',
|
||||
'team.action.addDatasource': 'Add DataSource',
|
||||
'team.action.addUser': 'Add User',
|
||||
'team.action.editTeam': 'Edit Team',
|
||||
'team.action.addTeam': 'Add Team',
|
||||
'team.action.affiliation.user': 'Affiliation User',
|
||||
'team.action.affiliation.team': 'Affiliation Team',
|
||||
'team.action.affiliation.datasource': 'Affiliation DataSource',
|
||||
'team.input.search.placeholder': 'Please enter keywords to search',
|
||||
|
||||
'team.user.addForm.userName': 'UserName',
|
||||
'team.user.addForm.nickName': 'NickName',
|
||||
'team.user.addForm.email': 'Email',
|
||||
'team.user.addForm.password': 'Password',
|
||||
'team.user.addForm.roleCode': 'Role',
|
||||
'team.user.addForm.roleCode.admin': 'Admin',
|
||||
'team.user.addForm.roleCode.user': 'User',
|
||||
'team.user.addForm.status': 'Status',
|
||||
'team.user.addForm.status.valid': 'Valid',
|
||||
'team.user.addForm.status.invalid': 'Invalid',
|
||||
|
||||
|
||||
'team.team.addForm.code': 'Team Code',
|
||||
'team.team.addForm.name': 'Team Name',
|
||||
'team.team.addForm.status': 'Status',
|
||||
'team.team.addForm.status.valid': 'Valid',
|
||||
'team.team.addForm.status.invalid': 'Invalid',
|
||||
'team.team.addForm.description': 'Description',
|
||||
}
|
||||
@@ -3,6 +3,7 @@ export default {
|
||||
'common.text.is': '是',
|
||||
'common.button.affirm': '确认',
|
||||
'common.button.edit': '编辑',
|
||||
'common.button.modify': '修改',
|
||||
'common.button.confirm': '确认',
|
||||
'common.button.cancel': '取消',
|
||||
'common.data.hour': '{1}小时',
|
||||
@@ -73,5 +74,8 @@ export default {
|
||||
'common.text.editorRightClick': '编辑器右键',
|
||||
'common.form.error.required': '此项必填!',
|
||||
'common.form.error.email': '不是正确的邮箱格式',
|
||||
'common.tips.delete.confirm': '确认要删除吗?'
|
||||
'common.tips.delete.confirm': '确认要删除吗?',
|
||||
'common.tips.updateSuccess': '更新成功',
|
||||
'common.tips.createSuccess': '创建成功',
|
||||
'common.text.action': '操作'
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ import setting from './setting';
|
||||
import workspace from './workspace';
|
||||
import dashboard from './dashboard';
|
||||
import chat from './chat';
|
||||
import team from './team'
|
||||
|
||||
export default {
|
||||
lang: LangType.ZH_CN,
|
||||
@@ -16,5 +17,6 @@ export default {
|
||||
...menu,
|
||||
...connection,
|
||||
...dashboard,
|
||||
...chat
|
||||
...chat,
|
||||
...team
|
||||
};
|
||||
|
||||
39
chat2db-client/src/i18n/zh-cn/team.ts
Normal file
39
chat2db-client/src/i18n/zh-cn/team.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
export default {
|
||||
'team.tab.datasource': '链接管理',
|
||||
'team.tab.user': '用户管理',
|
||||
'team.tab.team': '团队管理',
|
||||
'team.datasource.alias': '链接名称',
|
||||
'team.datasource.url': '链接地址',
|
||||
'team.user.userName': '用户名',
|
||||
'team.user.nickName': '昵称',
|
||||
'team.user.status': '状态',
|
||||
'team.action.rightManagement': '权限管理',
|
||||
'team.action.editDatasource': '编辑链接',
|
||||
'team.action.addDatasource': '添加链接',
|
||||
'team.action.editUser': '编辑用户',
|
||||
'team.action.addUser': '添加用户',
|
||||
'team.action.editTeam': '编辑团队',
|
||||
'team.action.addTeam': '添加团队',
|
||||
'team.action.affiliation.user': '包含用户',
|
||||
'team.action.affiliation.team': '所属团队',
|
||||
'team.action.affiliation.datasource': '归属链接',
|
||||
'team.input.search.placeholder': '输入关键字进行搜索',
|
||||
|
||||
'team.user.addForm.userName': '用户名',
|
||||
'team.user.addForm.nickName': '昵称',
|
||||
'team.user.addForm.email': '邮箱',
|
||||
'team.user.addForm.password': '密码',
|
||||
'team.user.addForm.roleCode': '角色',
|
||||
'team.user.addForm.roleCode.admin': '管理员',
|
||||
'team.user.addForm.roleCode.user': '用户',
|
||||
'team.user.addForm.status': '状态',
|
||||
'team.user.addForm.status.valid': '有效',
|
||||
'team.user.addForm.status.invalid': '无效',
|
||||
|
||||
'team.team.addForm.code': '团队编码',
|
||||
'team.team.addForm.name': '团队名',
|
||||
'team.team.addForm.status': '状态',
|
||||
'team.team.addForm.status.valid': '有效',
|
||||
'team.team.addForm.status.invalid': '无效',
|
||||
'team.team.addForm.description': '描述',
|
||||
}
|
||||
@@ -9,8 +9,8 @@ import i18n from '@/i18n';
|
||||
import { isValid } from '@/utils/check';
|
||||
import CreateConnection from '@/blocks/CreateConnection';
|
||||
import UniversalDrawer from '../universal-drawer';
|
||||
import styles from './index.less';
|
||||
import { isNumber } from 'lodash';
|
||||
import styles from './index.less';
|
||||
|
||||
function DataSourceManagement() {
|
||||
const [dataSource, setDataSource] = useState<IDataSourceVO[]>([]);
|
||||
@@ -34,19 +34,19 @@ function DataSourceManagement() {
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
title: '链接名称',
|
||||
title: i18n('team.datasource.alias'),
|
||||
dataIndex: 'alias',
|
||||
key: 'alias',
|
||||
},
|
||||
{
|
||||
title: '链接地址',
|
||||
title: i18n('team.datasource.url'),
|
||||
dataIndex: 'url',
|
||||
key: 'url',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
title: i18n('common.text.action'),
|
||||
key: 'action',
|
||||
width: 180,
|
||||
width: 300,
|
||||
render: (_: any, record: IDataSourceVO) => (
|
||||
<>
|
||||
<Button type='link' onClick={() => {
|
||||
@@ -61,7 +61,7 @@ function DataSourceManagement() {
|
||||
id: record.id,
|
||||
})
|
||||
}}>
|
||||
权限管理
|
||||
{i18n('team.action.rightManagement')}
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title={i18n('common.tips.delete.confirm')}
|
||||
@@ -126,7 +126,7 @@ function DataSourceManagement() {
|
||||
const handleDelete = async (id?: number) => {
|
||||
if (isNumber(id)) {
|
||||
await deleteDataSource({ id })
|
||||
message.success('删除成功');
|
||||
message.success(i18n('common.text.successfullyDelete'));
|
||||
queryDataSourceList();
|
||||
}
|
||||
};
|
||||
@@ -141,7 +141,7 @@ function DataSourceManagement() {
|
||||
const requestApi = isUpdate ? updateDataSource : createDataSource;
|
||||
try {
|
||||
await requestApi({ ...connectionInfo.current })
|
||||
message.success(isUpdate ? '更新成功' : '创建成功')
|
||||
message.success(isUpdate ? i18n('common.tips.updateSuccess') : i18n('common.tips.createSuccess'))
|
||||
setShowCreateConnection(false)
|
||||
queryDataSourceList()
|
||||
} catch {
|
||||
@@ -153,13 +153,13 @@ function DataSourceManagement() {
|
||||
<div>
|
||||
<div className={styles.tableTop}>
|
||||
<Input.Search
|
||||
style={{ width: '200px' }}
|
||||
placeholder="输入关键字进行搜索"
|
||||
style={{ width: '320px' }}
|
||||
placeholder={i18n('team.input.search.placeholder')}
|
||||
onSearch={handleSearch}
|
||||
enterButton={<SearchOutlined />}
|
||||
/>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={handleAddDataSource}>
|
||||
添加链接
|
||||
{i18n('team.action.editDatasource')}
|
||||
</Button>
|
||||
</div>
|
||||
<Table
|
||||
@@ -171,7 +171,7 @@ function DataSourceManagement() {
|
||||
/>
|
||||
|
||||
<Drawer
|
||||
title={connectionInfo?.current?.id ? '编辑链接' : '添加链接'}
|
||||
title={connectionInfo?.current?.id ? i18n('team.action.editDatasource') : i18n('team.action.addDatasource')}
|
||||
width={1000}
|
||||
open={showCreateConnection}
|
||||
onClose={() => setShowCreateConnection(false)}
|
||||
@@ -189,7 +189,7 @@ function DataSourceManagement() {
|
||||
})
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div >
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { ApiOutlined, UserOutlined, TeamOutlined } from '@ant-design/icons';
|
||||
import { Tabs } from 'antd';
|
||||
import styles from './index.less';
|
||||
import DataSourceManagement from './datasource-management';
|
||||
import UserManagement from './user-management';
|
||||
import TeamManagement from './team-management';
|
||||
import i18n from '@/i18n';
|
||||
import styles from './index.less';
|
||||
|
||||
const Team = () => {
|
||||
const [activeKey, setActiveKey] = useState<string>('0');
|
||||
const tabList = useMemo(
|
||||
() => [
|
||||
{
|
||||
label: '共享链接管理',
|
||||
label: i18n('team.tab.datasource'),
|
||||
icon: <ApiOutlined />,
|
||||
children: <DataSourceManagement />,
|
||||
},
|
||||
{
|
||||
label: '用户管理',
|
||||
label: i18n('team.tab.user'),
|
||||
icon: <UserOutlined />,
|
||||
children: <UserManagement />,
|
||||
},
|
||||
{
|
||||
label: '团队管理',
|
||||
label: i18n('team.tab.team'),
|
||||
icon: <TeamOutlined />,
|
||||
children: <TeamManagement />,
|
||||
},
|
||||
|
||||
@@ -35,23 +35,23 @@ function TeamManagement() {
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
title: '团队编码',
|
||||
title: i18n('team.team.addForm.code'),
|
||||
dataIndex: 'code',
|
||||
key: 'code',
|
||||
},
|
||||
{
|
||||
title: '团队名',
|
||||
title: i18n('team.team.addForm.name'),
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
title: i18n('team.team.addForm.status'),
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
render: (status: StatusType) => <Tag color={status === StatusType.VALID ? 'green' : 'red'}>{status}</Tag>,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
title: i18n('common.text.action'),
|
||||
key: 'action',
|
||||
width: 260,
|
||||
render: (_: any, record: ITeamVO) => (
|
||||
@@ -70,7 +70,7 @@ function TeamManagement() {
|
||||
});
|
||||
}}
|
||||
>
|
||||
包含用户
|
||||
{i18n('team.action.affiliation.user')}
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
@@ -82,7 +82,7 @@ function TeamManagement() {
|
||||
type: AffiliationType.TEAM_DATASOURCE
|
||||
});
|
||||
}}>
|
||||
归属链接
|
||||
{i18n('team.action.affiliation.datasource')}
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title={i18n('common.tips.delete.confirm')}
|
||||
@@ -150,7 +150,7 @@ function TeamManagement() {
|
||||
const handleDelete = async (id?: number) => {
|
||||
if (id !== undefined) {
|
||||
await deleteTeam({ id });
|
||||
message.success('删除成功');
|
||||
message.success(i18n('common.text.successfullyDelete'));
|
||||
queryTeamList();
|
||||
}
|
||||
};
|
||||
@@ -159,13 +159,13 @@ function TeamManagement() {
|
||||
<div>
|
||||
<div className={styles.tableTop}>
|
||||
<Input.Search
|
||||
style={{ width: '200px' }}
|
||||
placeholder="输入关键字进行搜索"
|
||||
style={{ width: '320px' }}
|
||||
placeholder={i18n('team.input.search.placeholder')}
|
||||
onSearch={handleSearch}
|
||||
enterButton={<SearchOutlined />}
|
||||
/>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={() => setIsModalVisible(true)}>
|
||||
添加团队
|
||||
{i18n('team.action.addUser')}
|
||||
</Button>
|
||||
</div>
|
||||
<Table
|
||||
@@ -178,7 +178,7 @@ function TeamManagement() {
|
||||
/>
|
||||
|
||||
<Modal
|
||||
title={form.getFieldValue('id') !== undefined ? '编辑团队' : '添加团队'}
|
||||
title={form.getFieldValue('id') !== undefined ? i18n('team.action.editTeam') : i18n('team.action.addTeam')}
|
||||
open={isModalVisible}
|
||||
onOk={() => {
|
||||
form
|
||||
@@ -207,19 +207,19 @@ function TeamManagement() {
|
||||
status: StatusType.VALID,
|
||||
}}
|
||||
>
|
||||
<Form.Item label="团队编码" name="code" rules={[requireRule]}>
|
||||
<Form.Item label={i18n('team.team.addForm.code')} name="code" rules={[requireRule]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="团队名" name="name">
|
||||
<Form.Item label={i18n('team.team.addForm.name')} name="name">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="状态" name="status" rules={[requireRule]}>
|
||||
<Form.Item label={i18n('team.team.addForm.status')} name="status" rules={[requireRule]}>
|
||||
<Radio.Group>
|
||||
<Radio value={StatusType.VALID}>有效</Radio>
|
||||
<Radio value={StatusType.INVALID}>无效</Radio>
|
||||
<Radio value={StatusType.VALID}>{i18n('team.team.addForm.status.valid')}</Radio>
|
||||
<Radio value={StatusType.INVALID}>{i18n('team.team.addForm.status.invalid')}</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label="描述" name="description">
|
||||
<Form.Item label={i18n('team.team.addForm.description')} name="description">
|
||||
<Input.TextArea />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
@@ -35,23 +35,23 @@ function UserManagement() {
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
title: '用户名',
|
||||
title: i18n('team.user.userName'),
|
||||
dataIndex: 'userName',
|
||||
key: 'userName',
|
||||
},
|
||||
{
|
||||
title: '昵称',
|
||||
title: i18n('team.user.nickName'),
|
||||
dataIndex: 'nickName',
|
||||
key: 'nickName',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
title: i18n('team.user.status'),
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
render: (status: StatusType) => <Tag color={status === StatusType.VALID ? 'green' : 'red'}>{status}</Tag>,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
title: i18n('common.text.action'),
|
||||
key: 'action',
|
||||
width: 260,
|
||||
render: (_: any, record: IUserVO) => (
|
||||
@@ -69,7 +69,7 @@ function UserManagement() {
|
||||
id: record.id,
|
||||
})
|
||||
}}>
|
||||
所属团队
|
||||
{i18n('team.action.affiliation.team')}
|
||||
</Button>
|
||||
<Button type='link' onClick={() => {
|
||||
setDrawerInfo({
|
||||
@@ -79,7 +79,7 @@ function UserManagement() {
|
||||
id: record.id,
|
||||
})
|
||||
}}>
|
||||
归属链接
|
||||
{i18n('team.action.affiliation.datasource')}
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title={i18n('common.tips.delete.confirm')}
|
||||
@@ -139,7 +139,7 @@ function UserManagement() {
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
await deleteUser({ id })
|
||||
message.success('删除成功')
|
||||
message.success(i18n('common.text.successfullyDelete'))
|
||||
queryUserList()
|
||||
}
|
||||
|
||||
@@ -155,8 +155,8 @@ function UserManagement() {
|
||||
<div className={styles.tableTop}>
|
||||
<Input.Search
|
||||
maxLength={50}
|
||||
style={{ width: '200px' }}
|
||||
placeholder="输入关键字进行搜索"
|
||||
style={{ width: '320px' }}
|
||||
placeholder={i18n('team.input.search.placeholder')}
|
||||
onSearch={handleSearch}
|
||||
enterButton={<SearchOutlined />}
|
||||
/>
|
||||
@@ -164,7 +164,7 @@ function UserManagement() {
|
||||
form.resetFields();
|
||||
setIsModalVisible(true)
|
||||
}}>
|
||||
添加用户
|
||||
{i18n('team.action.addUser')}
|
||||
</Button>
|
||||
</div>
|
||||
<Table
|
||||
@@ -176,7 +176,7 @@ function UserManagement() {
|
||||
/>
|
||||
|
||||
<Modal
|
||||
title={isEditing ? '编辑用户' : '添加用户'}
|
||||
title={isEditing ? i18n('team.action.editUser') : i18n('team.action.addUser')}
|
||||
open={isModalVisible}
|
||||
onOk={() => {
|
||||
form
|
||||
@@ -209,31 +209,31 @@ function UserManagement() {
|
||||
status: StatusType.VALID,
|
||||
}}
|
||||
>
|
||||
<Form.Item label="用户名" name="userName" rules={[requireRule]}>
|
||||
<Form.Item label={i18n('team.user.addForm.userName')} name="userName" rules={[requireRule]}>
|
||||
<Input maxLength={50} showCount autoComplete='off' />
|
||||
</Form.Item>
|
||||
<Form.Item label="昵称" name="nickName" rules={[requireRule]}>
|
||||
<Form.Item label={i18n('team.user.addForm.nickName')} name="nickName" rules={[requireRule]}>
|
||||
<Input maxLength={100} showCount />
|
||||
</Form.Item>
|
||||
<Form.Item label="邮箱" name="email" rules={[requireRule, {
|
||||
<Form.Item label={i18n('team.user.addForm.email')} name="email" rules={[requireRule, {
|
||||
type: 'email',
|
||||
message: i18n('common.form.error.email')
|
||||
}]}>
|
||||
<Input autoComplete='off' />
|
||||
</Form.Item>
|
||||
<Form.Item label="密码" name="password" rules={[requireRule]}>
|
||||
<Form.Item label={i18n('team.user.addForm.password')} name="password" rules={[requireRule]}>
|
||||
<Input.Password maxLength={30} placeholder={isEditing ? '******' : ''} autoComplete='fake-password' />
|
||||
</Form.Item>
|
||||
<Form.Item label="角色" name="roleCode" rules={[requireRule]}>
|
||||
<Form.Item label={i18n('team.user.addForm.roleCode')} name="roleCode" rules={[requireRule]}>
|
||||
<Radio.Group>
|
||||
<Radio value={RoleType.ADMIN}>管理员</Radio>
|
||||
<Radio value={RoleType.USER}>用户</Radio>
|
||||
<Radio value={RoleType.ADMIN}>{i18n('team.user.addForm.roleCode.admin')}</Radio>
|
||||
<Radio value={RoleType.USER}>{i18n('team.user.addForm.roleCode.user')}</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label="状态" name="status" rules={[requireRule]}>
|
||||
<Form.Item label={i18n('team.user.addForm.status')} name="status" rules={[requireRule]}>
|
||||
<Radio.Group>
|
||||
<Radio value={StatusType.VALID}>有效</Radio>
|
||||
<Radio value={StatusType.INVALID}>无效</Radio>
|
||||
<Radio value={StatusType.VALID}>{i18n('team.user.addForm.status.valid')}</Radio>
|
||||
<Radio value={StatusType.INVALID}>{i18n('team.user.addForm.status.invalid')}</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
Reference in New Issue
Block a user