Skip to content

Commit 2bd2f1f

Browse files
committed
Auto group menus by model and code format
1 parent 71f057b commit 2bd2f1f

File tree

38 files changed

+1022
-804
lines changed

38 files changed

+1022
-804
lines changed

tyadmin_api_cli/adapters/field_adapter.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@
44
'task': {
55
'index_import': """import {queryPeriodicTask_task} from './service';""",
66
'field': """
7-
{
7+
{
88
9-
title: 'task',
10-
dataIndex: 'task',
11-
rules: [
12-
],
9+
title: 'task',
10+
dataIndex: 'task',
11+
rules: [
12+
],
1313
renderFormItem: (item, {value, onChange}) => {
1414
return dealPureSelectField(item, value, onChange, PeriodicTask_task);
15-
}, },
16-
""",
17-
'effect_state': """ const [PeriodicTask_task, setPeriodicTask_task] = useState([]);
15+
},
16+
},
17+
""",
18+
'effect_state': """ const [PeriodicTask_task, setPeriodicTask_task] = useState([]);
1819
useEffect(() => {
1920
queryPeriodicTask_task().then(value => {
2021
setPeriodicTask_task(value);
2122
});
2223
}, []);""",
23-
'services': """export async function queryPeriodicTask_task(params) {
24-
return request('/api/xadmin/v1/adapters/periodic_task/task', {
24+
'services': """export async function queryPeriodicTask_task(params) {
25+
return request('/api/xadmin/v1/adapters/periodic_task/task', {
2526
params,
2627
});
2728
}"""

tyadmin_api_cli/antd_full_templates/config/config.js

Lines changed: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// https://umijs.org/config/
2-
import {defineConfig} from 'umi';
2+
import { defineConfig } from 'umi';
33
import defaultSettings from './defaultSettings';
44
import proxy from './proxy';
55

66
var fs = require("fs");
77
const path = require('path');
8-
const {REACT_APP_ENV} = process.env;
9-
const auto_route = eval(fs.readFileSync(path.join(__dirname, 'auto_menu.json')).toString());
8+
const { REACT_APP_ENV } = process.env;
9+
const auto_route = eval(fs.readFileSync(path.join(__dirname, 'route.js')).toString());
1010
export default defineConfig({
1111
hash: true,
1212
antd: {},
@@ -29,61 +29,28 @@ export default defineConfig({
2929
ie: 11,
3030
},
3131
// umi routes: https://umijs.org/docs/routing
32-
routes: [{
33-
path: '/xadmin/login',
34-
component: '../layouts/UserLayout',
35-
routes: [{
36-
name: 'login',
32+
routes: [
33+
{
3734
path: '/xadmin/login',
38-
component: './TyAdminBuiltIn/UserLogin',
39-
},],
40-
},
35+
component: '../layouts/UserLayout',
36+
routes: [
37+
{
38+
name: 'login',
39+
path: '/xadmin/login',
40+
component: './TyAdminBuiltIn/UserLogin',
41+
},
42+
],
43+
},
4144
{
4245
path: '/xadmin/',
4346
component: '../layouts/SecurityLayout',
44-
routes: [{
45-
path: '/xadmin/',
46-
component: '../layouts/BasicLayout',
47-
authority: ['admin', 'user'],
48-
routes: [{
49-
name: '首页',
50-
path: '/xadmin/index',
51-
icon: 'dashboard',
52-
component: './TyAdminBuiltIn/DashBoard',
47+
routes: [
48+
{
49+
path: '/xadmin/',
50+
component: '../layouts/BasicLayout',
51+
authority: ['admin', 'user'],
52+
routes: auto_route,
5353
},
54-
{
55-
path: '/xadmin/',
56-
redirect: '/xadmin/index',
57-
},
58-
...auto_route,
59-
{
60-
path: '/xadmin/account/change_password',
61-
name: '修改密码',
62-
hideInMenu: true,
63-
icon: 'dashboard',
64-
component: './TyAdminBuiltIn/ChangePassword',
65-
},
66-
{
67-
name: 'Tyadmin内置',
68-
icon: 'VideoCamera',
69-
path: '/xadmin/sys',
70-
routes: [{
71-
name: 'TyAdmin日志',
72-
icon: 'smile',
73-
path: '/xadmin/sys/ty_admin_sys_log',
74-
component: './TyAdminBuiltIn/TyAdminSysLogList',
75-
}, {
76-
name: 'TyAdmin验证',
77-
icon: 'smile',
78-
path: '/xadmin/sys/ty_admin_email_verify_record',
79-
component: './TyAdminBuiltIn/TyAdminEmailVerifyRecordList',
80-
}],
81-
},
82-
{
83-
component: './404',
84-
},
85-
],
86-
},
8754
{
8855
component: './404',
8956
},
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
[
2+
{
3+
name: '首页',
4+
path: '/xadmin/index',
5+
icon: 'dashboard',
6+
component: './TyAdminBuiltIn/DashBoard'
7+
},
8+
{
9+
name: 'auth',
10+
icon: 'BarsOutlined',
11+
path: '/xadmin/auth',
12+
routes:
13+
[
14+
{
15+
name: '权限',
16+
path: '/xadmin/permission',
17+
component: './AutoGenPage/PermissionList',
18+
},
19+
{
20+
name: '组',
21+
path: '/xadmin/group',
22+
component: './AutoGenPage/GroupList',
23+
},
24+
{
25+
name: '用户',
26+
path: '/xadmin/user',
27+
component: './AutoGenPage/UserList',
28+
}
29+
]
30+
},
31+
{
32+
name: 'django_celery_beat',
33+
icon: 'BarsOutlined',
34+
path: '/xadmin/django_celery_beat',
35+
routes:
36+
[
37+
{
38+
name: 'solar event',
39+
path: '/xadmin/solar_schedule',
40+
component: './AutoGenPage/SolarScheduleList',
41+
},
42+
{
43+
name: 'interval',
44+
path: '/xadmin/interval_schedule',
45+
component: './AutoGenPage/IntervalScheduleList',
46+
},
47+
{
48+
name: 'clocked',
49+
path: '/xadmin/clocked_schedule',
50+
component: './AutoGenPage/ClockedScheduleList',
51+
},
52+
{
53+
name: 'crontab',
54+
path: '/xadmin/crontab_schedule',
55+
component: './AutoGenPage/CrontabScheduleList',
56+
},
57+
{
58+
name: 'periodic tasks',
59+
path: '/xadmin/periodic_tasks',
60+
component: './AutoGenPage/PeriodicTasksList',
61+
},
62+
{
63+
name: 'periodic task',
64+
path: '/xadmin/periodic_task',
65+
component: './AutoGenPage/PeriodicTaskList',
66+
}
67+
]
68+
},
69+
{
70+
name: 'authtoken',
71+
icon: 'BarsOutlined',
72+
path: '/xadmin/authtoken',
73+
routes:
74+
[
75+
{
76+
name: '令牌',
77+
path: '/xadmin/token',
78+
component: './AutoGenPage/TokenList',
79+
},
80+
{
81+
name: 'token',
82+
path: '/xadmin/token_proxy',
83+
component: './AutoGenPage/TokenProxyList',
84+
}
85+
]
86+
},
87+
{
88+
name: 'storage',
89+
icon: 'BarsOutlined',
90+
path: '/xadmin/storage',
91+
routes:
92+
[
93+
{
94+
name: 'nas',
95+
path: '/xadmin/nas',
96+
component: './AutoGenPage/NasList',
97+
}
98+
]
99+
},
100+
{
101+
name: 'captcha',
102+
icon: 'BarsOutlined',
103+
path: '/xadmin/captcha',
104+
routes:
105+
[
106+
{
107+
name: 'captcha store',
108+
path: '/xadmin/captcha_store',
109+
component: './AutoGenPage/CaptchaStoreList',
110+
}
111+
]
112+
},
113+
{
114+
name: 'Tyadmin内置',
115+
icon: 'VideoCamera',
116+
path: '/xadmin/sys',
117+
routes:
118+
[
119+
{
120+
name: 'TyAdmin日志',
121+
icon: 'smile',
122+
path: '/xadmin/sys/ty_admin_sys_log',
123+
component: './TyAdminBuiltIn/TyAdminSysLogList'
124+
},
125+
{
126+
name: 'TyAdmin验证',
127+
icon: 'smile',
128+
path: '/xadmin/sys/ty_admin_email_verify_record',
129+
component: './TyAdminBuiltIn/TyAdminEmailVerifyRecordList'
130+
}
131+
]
132+
}
133+
]

tyadmin_api_cli/antd_full_templates/src/global.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ if (pwa) {
7373
}),
7474
btn,
7575
key,
76-
onClose: async () => {},
76+
onClose: async () => { },
7777
});
7878
});
7979
} else if ('serviceWorker' in navigator) {

tyadmin_api_cli/antd_full_templates/src/pages/TyAdminBuiltIn/ChangePassword/index.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import {PageHeaderWrapper} from '@ant-design/pro-layout';
1+
import { PageHeaderWrapper } from '@ant-design/pro-layout';
22
import React from 'react';
3-
import {Button, Card, Form, Input, message} from 'antd';
4-
import {changePassword} from '@/pages/TyAdminBuiltIn/ChangePassword/service';
5-
import {history} from 'umi';
6-
import {stringify} from "querystring";
7-
import {getPageQuery} from '@/utils/utils';
3+
import { Button, Card, Form, Input, message } from 'antd';
4+
import { changePassword } from '@/pages/TyAdminBuiltIn/ChangePassword/service';
5+
import { history } from 'umi';
6+
import { stringify } from "querystring";
7+
import { getPageQuery } from '@/utils/utils';
88

99
const FormItem = Form.Item;
1010
const tailLayout = {
11-
wrapperCol: {offset: 5, span: 19},
11+
wrapperCol: { offset: 5, span: 19 },
1212
};
1313

1414
const ChangePassPage = () => {
@@ -96,7 +96,7 @@ const ChangePassPage = () => {
9696
required: true,
9797
message: '请再次输入新密码',
9898
},
99-
({getFieldValue}) => ({
99+
({ getFieldValue }) => ({
100100
validator(rule, value) {
101101
if (!value || getFieldValue('new_password') === value) {
102102
return Promise.resolve();

tyadmin_api_cli/antd_full_templates/src/pages/TyAdminBuiltIn/ChangePassword/service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import request from 'umi-request';
33
export async function changePassword(params) {
44
return request('/api/xadmin/v1/change_password', {
55
method: 'POST',
6-
data: { ...params},
6+
data: { ...params },
77
});
88
}

tyadmin_api_cli/antd_full_templates/src/pages/TyAdminBuiltIn/DashBoard/components/Charts/MiniArea/index.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ const MiniArea = props => {
9696
tooltip={false}
9797
/>
9898
) : (
99-
<span
100-
style={{
101-
display: 'none',
102-
}}
103-
/>
104-
)}
99+
<span
100+
style={{
101+
display: 'none',
102+
}}
103+
/>
104+
)}
105105
</Chart>
106106
)}
107107
</div>

tyadmin_api_cli/antd_full_templates/src/pages/TyAdminBuiltIn/DashBoard/components/Charts/MiniProgress/index.jsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ const MiniProgress = ({
99
strokeWidth,
1010
percent,
1111
}) => (
12-
<div className={styles.miniProgress}>
13-
<Tooltip title={targetLabel}>
14-
<div
15-
className={styles.target}
16-
style={{
17-
left: target ? `${target}%` : undefined,
18-
}}
19-
>
20-
<span
12+
<div className={styles.miniProgress}>
13+
<Tooltip title={targetLabel}>
14+
<div
15+
className={styles.target}
2116
style={{
22-
backgroundColor: color || undefined,
17+
left: target ? `${target}%` : undefined,
2318
}}
24-
/>
25-
<span
19+
>
20+
<span
21+
style={{
22+
backgroundColor: color || undefined,
23+
}}
24+
/>
25+
<span
26+
style={{
27+
backgroundColor: color || undefined,
28+
}}
29+
/>
30+
</div>
31+
</Tooltip>
32+
<div className={styles.progressWrap}>
33+
<div
34+
className={styles.progress}
2635
style={{
2736
backgroundColor: color || undefined,
37+
width: percent ? `${percent}%` : undefined,
38+
height: strokeWidth || undefined,
2839
}}
2940
/>
3041
</div>
31-
</Tooltip>
32-
<div className={styles.progressWrap}>
33-
<div
34-
className={styles.progress}
35-
style={{
36-
backgroundColor: color || undefined,
37-
width: percent ? `${percent}%` : undefined,
38-
height: strokeWidth || undefined,
39-
}}
40-
/>
4142
</div>
42-
</div>
43-
);
43+
);
4444

4545
export default MiniProgress;

0 commit comments

Comments
 (0)