expressa 1.1.2 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +1 -1
- package/README.md +4 -3
- package/controllers/collections.js +53 -32
- package/controllers/install.js +34 -27
- package/db/cached.js +3 -0
- package/db/file.js +3 -0
- package/db/memory.js +3 -0
- package/db/mongo.js +7 -8
- package/db/postgres.js +13 -0
- package/index.js +6 -5
- package/listeners_validation.js +4 -0
- package/modules/admin/.babelrc +13 -12
- package/modules/admin/build/webpack.prod.conf.js +5 -3
- package/modules/admin/config/index.js +2 -2
- package/modules/admin/dist/index.html +1 -1
- package/modules/admin/dist/index.html.gz +0 -0
- package/modules/admin/dist/static/css/app.9dd57eea.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-1dff.39c7634b.css +1 -0
- package/modules/admin/dist/static/css/chunk-1dff.39c7634b.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-3bc2.89632b9d.css.gz +0 -0
- package/modules/admin/dist/static/css/{chunk-5cee.ce0e4bdb.css → chunk-5cee.9685afb8.css} +0 -0
- package/modules/admin/dist/static/css/chunk-5cee.9685afb8.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-621e.f3d0eab6.css +1 -0
- package/modules/admin/dist/static/css/chunk-621e.f3d0eab6.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-7291.13514e45.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-a99c.c4b0e273.css +1 -0
- package/modules/admin/dist/static/css/chunk-a99c.c4b0e273.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-b423.5f239333.css.gz +0 -0
- package/modules/admin/dist/static/css/{chunk-bd5f.aefa49d7.css → chunk-bd5f.6ab011ba.css} +0 -0
- package/modules/admin/dist/static/css/chunk-bd5f.6ab011ba.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-e375.1d849865.css +1 -0
- package/modules/admin/dist/static/css/chunk-e375.1d849865.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-elementUI.3d004d9f.css.gz +0 -0
- package/modules/admin/dist/static/css/{chunk-759b.3a895a1e.css → chunk-f075.3a895a1e.css} +0 -0
- package/modules/admin/dist/static/css/chunk-f075.3a895a1e.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-libs.327ad89e.css +14 -0
- package/modules/admin/dist/static/css/chunk-libs.327ad89e.css.gz +0 -0
- package/modules/admin/dist/static/js/app.947e8310.js +1 -0
- package/modules/admin/dist/static/js/app.947e8310.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-09d8.561880e0.js +2 -0
- package/modules/admin/dist/static/js/{chunk-23bd.5fa24c85.js.LICENSE.txt → chunk-09d8.561880e0.js.LICENSE.txt} +1 -1
- package/modules/admin/dist/static/js/chunk-09d8.561880e0.js.LICENSE.txt.gz +0 -0
- package/modules/admin/dist/static/js/chunk-09d8.561880e0.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-1dff.b5ee003b.js +1 -0
- package/modules/admin/dist/static/js/chunk-1dff.b5ee003b.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-3bc2.b0270c10.js +1 -0
- package/modules/admin/dist/static/js/chunk-3bc2.b0270c10.js.gz +0 -0
- package/modules/admin/dist/static/js/{chunk-5cee.a3b03f7a.js → chunk-5cee.a6f0e769.js} +0 -0
- package/modules/admin/dist/static/js/chunk-5cee.a6f0e769.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-621e.c63db96c.js +1 -0
- package/modules/admin/dist/static/js/chunk-621e.c63db96c.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-7291.f914fca7.js +1 -0
- package/modules/admin/dist/static/js/chunk-7291.f914fca7.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-a99c.3f48f127.js +1 -0
- package/modules/admin/dist/static/js/chunk-a99c.3f48f127.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-b423.387c504c.js.gz +0 -0
- package/modules/admin/dist/static/js/{chunk-bd5f.e9509f10.js → chunk-bd5f.af5f2197.js} +0 -0
- package/modules/admin/dist/static/js/chunk-bd5f.af5f2197.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-e375.7ba1b61f.js +1 -0
- package/modules/admin/dist/static/js/chunk-e375.7ba1b61f.js.gz +0 -0
- package/modules/admin/dist/static/js/{chunk-e7c3.e5df8ceb.js → chunk-e7c3.a8659352.js} +1 -1
- package/modules/admin/dist/static/js/chunk-e7c3.a8659352.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-elementUI.b0c99c08.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-f075.6b230660.js +1 -0
- package/modules/admin/dist/static/js/chunk-f075.6b230660.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-libs.5637556a.js +2 -0
- package/modules/admin/dist/static/js/{chunk-libs.b6f27cfe.js.LICENSE.txt → chunk-libs.5637556a.js.LICENSE.txt} +1 -1
- package/modules/admin/dist/static/js/chunk-libs.5637556a.js.LICENSE.txt.gz +0 -0
- package/modules/admin/dist/static/js/chunk-libs.5637556a.js.gz +0 -0
- package/modules/admin/package.json +4 -3
- package/modules/admin/src/main.js +2 -2
- package/modules/admin/src/router/index.js +185 -185
- package/modules/admin/src/utils/request.js +47 -48
- package/modules/admin/src/views/ListDocuments2.vue +407 -309
- package/package.json +5 -5
- package/test/collections.js +2 -3
- package/test/collections.querying.js +18 -4
- package/test/test.js +4 -0
- package/util.js +19 -0
- package/modules/admin/dist/static/css/chunk-36ca.e7e72230.css +0 -1
- package/modules/admin/dist/static/css/chunk-62f2.538cfd24.css +0 -1
- package/modules/admin/dist/static/css/chunk-7869.220d4af5.css +0 -1
- package/modules/admin/dist/static/css/chunk-e80a.5ee55031.css +0 -1
- package/modules/admin/dist/static/css/chunk-libs.68e8d170.css +0 -14
- package/modules/admin/dist/static/js/app.12d7fe96.js +0 -1
- package/modules/admin/dist/static/js/chunk-23bd.5fa24c85.js +0 -2
- package/modules/admin/dist/static/js/chunk-36ca.eda87655.js +0 -1
- package/modules/admin/dist/static/js/chunk-3bc2.028748b7.js +0 -1
- package/modules/admin/dist/static/js/chunk-62f2.ee07e11b.js +0 -1
- package/modules/admin/dist/static/js/chunk-7291.590524e9.js +0 -1
- package/modules/admin/dist/static/js/chunk-759b.89a889b6.js +0 -1
- package/modules/admin/dist/static/js/chunk-7869.b7ab2c47.js +0 -1
- package/modules/admin/dist/static/js/chunk-e80a.cc0d79f4.js +0 -1
- package/modules/admin/dist/static/js/chunk-libs.b6f27cfe.js +0 -2
|
@@ -8,7 +8,7 @@ object-assign
|
|
|
8
8
|
* @license MIT */
|
|
9
9
|
|
|
10
10
|
/*!
|
|
11
|
-
* Bootstrap v4.6.
|
|
11
|
+
* Bootstrap v4.6.1 (https://getbootstrap.com/)
|
|
12
12
|
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
13
13
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
14
14
|
*/
|
|
Binary file
|
|
@@ -47,15 +47,16 @@
|
|
|
47
47
|
"babel-preset-env": "1.7.0",
|
|
48
48
|
"babel-preset-stage-2": "6.24.1",
|
|
49
49
|
"chalk": "2.4.1",
|
|
50
|
+
"compression-webpack-plugin": "^6.1.1",
|
|
50
51
|
"copy-webpack-plugin": "^5.1.0",
|
|
51
52
|
"css-loader": "1.0.0",
|
|
52
53
|
"eslint": "^7.0.0",
|
|
53
54
|
"eslint-friendly-formatter": "^4.0.1",
|
|
54
55
|
"eslint-loader": "^4.0.2",
|
|
55
|
-
"eslint-plugin-vue": "^
|
|
56
|
+
"eslint-plugin-vue": "^7.0.0",
|
|
56
57
|
"file-loader": "1.1.11",
|
|
57
58
|
"friendly-errors-webpack-plugin": "1.7.0",
|
|
58
|
-
"html-webpack-plugin": "4.0.0
|
|
59
|
+
"html-webpack-plugin": "^4.0.0",
|
|
59
60
|
"mini-css-extract-plugin": "0.4.1",
|
|
60
61
|
"node-notifier": "5.2.1",
|
|
61
62
|
"node-sass": "^6.0.1",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"postcss-url": "7.3.2",
|
|
69
70
|
"rimraf": "2.6.2",
|
|
70
71
|
"sass-loader": "7.0.3",
|
|
71
|
-
"script-ext-html-webpack-plugin": "2.
|
|
72
|
+
"script-ext-html-webpack-plugin": "^2.1.5",
|
|
72
73
|
"semver": "5.5.0",
|
|
73
74
|
"shelljs": "0.8.2",
|
|
74
75
|
"svg-sprite-loader": "3.8.0",
|
|
@@ -23,9 +23,9 @@ import '@/permission' // permission control
|
|
|
23
23
|
import { VuePlugin } from 'vuera'
|
|
24
24
|
|
|
25
25
|
import Unicon from 'vue-unicons/dist/vue-unicons-vue2.umd'
|
|
26
|
-
import { uniDatabase, uniHome,
|
|
26
|
+
import { uniDatabase, uniHome, uniUsersAlt, uniShieldCheck, uniBookOpen, uniDiary, uniFlask, uniCog, uniPlus, uniLink } from 'vue-unicons/dist/icons'
|
|
27
27
|
|
|
28
|
-
Unicon.add([uniDatabase, uniHome,
|
|
28
|
+
Unicon.add([uniDatabase, uniHome, uniUsersAlt, uniShieldCheck, uniBookOpen, uniDiary, uniFlask, uniCog, uniPlus, uniLink])
|
|
29
29
|
Vue.use(Unicon)
|
|
30
30
|
|
|
31
31
|
Vue.use(ElementUI, { locale })
|
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import Router from 'vue-router'
|
|
3
|
-
|
|
4
|
-
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
|
|
5
|
-
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading
|
|
6
|
-
|
|
7
|
-
Vue.use(Router)
|
|
8
|
-
|
|
9
|
-
/* Layout */
|
|
10
|
-
import Layout from '../views/layout/Layout'
|
|
11
|
-
|
|
12
|
-
const capitalize = (s) => {
|
|
13
|
-
if (typeof s !== 'string') return ''
|
|
14
|
-
return s.charAt(0).toUpperCase() + s.slice(1)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
|
|
19
|
-
* alwaysShow: true if set true, will always show the root menu, whatever its child routes length
|
|
20
|
-
* if not set alwaysShow, only more than one route under the children
|
|
21
|
-
* it will becomes nested mode, otherwise not show the root menu
|
|
22
|
-
* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb
|
|
23
|
-
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
|
24
|
-
* meta : {
|
|
25
|
-
title: 'title' the name show in submenu and breadcrumb (recommend set)
|
|
26
|
-
icon: 'svg-name' the icon show in the sidebar,
|
|
27
|
-
}
|
|
28
|
-
**/
|
|
29
|
-
|
|
30
|
-
export const constantRouterMap = [
|
|
31
|
-
{ path: '/login', component: () => import('@/views/login/index'), hidden: true },
|
|
32
|
-
{ path: '/install', component: () => import('@/views/Install'), hidden: true },
|
|
33
|
-
{ path: '/404', component: () => import('@/views/404'), hidden: true },
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
path: '/',
|
|
37
|
-
component: Layout,
|
|
38
|
-
redirect: '/home',
|
|
39
|
-
name: 'Home',
|
|
40
|
-
meta: { title: 'Home', icon: 'home
|
|
41
|
-
children: [{
|
|
42
|
-
path: 'home',
|
|
43
|
-
meta: { title: 'Home', icon: 'home
|
|
44
|
-
component: () => import('@/views/Home')
|
|
45
|
-
}, {
|
|
46
|
-
path: '/edit/:collectionName/:id',
|
|
47
|
-
component: () => import('@/views/EditDocument'),
|
|
48
|
-
hidden: true
|
|
49
|
-
}]
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
{
|
|
53
|
-
path: '/users',
|
|
54
|
-
redirect: '/users/list',
|
|
55
|
-
component: Layout,
|
|
56
|
-
name: 'Users',
|
|
57
|
-
meta: { title: 'People', icon: 'users-alt' },
|
|
58
|
-
children: [{
|
|
59
|
-
path: 'list',
|
|
60
|
-
meta: { title: 'Users', icon: 'users-alt' },
|
|
61
|
-
name: 'users2',
|
|
62
|
-
component: () => import('@/views/ListDocuments2'),
|
|
63
|
-
props: { collectionName: 'users' },
|
|
64
|
-
}, {
|
|
65
|
-
path: 'add',
|
|
66
|
-
meta: { title: 'Add User', icon: 'plus' },
|
|
67
|
-
name: 'newuser',
|
|
68
|
-
component: () => import('@/views/EditDocument'),
|
|
69
|
-
props: { collectionName: 'users', id: 'create' },
|
|
70
|
-
}, {
|
|
71
|
-
path: 'role',
|
|
72
|
-
meta: { title: 'Roles', icon: 'shield-check' },
|
|
73
|
-
name: 'role',
|
|
74
|
-
component: () => import('@/views/ListDocuments2'),
|
|
75
|
-
props: { collectionName: 'role' },
|
|
76
|
-
}, {
|
|
77
|
-
path: 'addrole',
|
|
78
|
-
meta: { title: 'Add Role', icon: 'plus' },
|
|
79
|
-
name: 'newrole',
|
|
80
|
-
component: () => import('@/views/EditDocument'),
|
|
81
|
-
props: { collectionName: 'role', id: 'create' },
|
|
82
|
-
}],
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
path: '/list/:collectionName',
|
|
87
|
-
component: Layout,
|
|
88
|
-
hidden: true,
|
|
89
|
-
name: 'Data',
|
|
90
|
-
meta: { title: 'Data', icon: 'database' },
|
|
91
|
-
children: [{
|
|
92
|
-
path: '',
|
|
93
|
-
name: ':collectionName',
|
|
94
|
-
component: () => import('@/views/ListDocuments2'),
|
|
95
|
-
props: route => ({ collectionName: route.params.collectionName }),
|
|
96
|
-
meta: { title: capitalize(name) }
|
|
97
|
-
}]
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
path: '/manage/permissions',
|
|
102
|
-
component: Layout,
|
|
103
|
-
name: 'permissions',
|
|
104
|
-
meta: { title: 'Manage' },
|
|
105
|
-
children: [
|
|
106
|
-
{
|
|
107
|
-
path: '',
|
|
108
|
-
name: 'permissions',
|
|
109
|
-
component: () => import('@/views/ManagePermissions'),
|
|
110
|
-
meta: { title: 'Permissions' }
|
|
111
|
-
}
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
{
|
|
116
|
-
path: '/dev',
|
|
117
|
-
component: Layout,
|
|
118
|
-
meta: { title: 'Dev', icon: 'flask' },
|
|
119
|
-
name: 'Dev',
|
|
120
|
-
children: [
|
|
121
|
-
{
|
|
122
|
-
path: '',
|
|
123
|
-
name: '',
|
|
124
|
-
component: () => import('@/views/Dev'),
|
|
125
|
-
meta: { title: '' },
|
|
126
|
-
hidden: true,
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
path: 'listeners',
|
|
130
|
-
name: 'listeners',
|
|
131
|
-
component: () => import('@/views/ManageListeners'),
|
|
132
|
-
meta: { title: 'Listeners' }
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
path: 'middleware',
|
|
136
|
-
name: 'middleware',
|
|
137
|
-
component: () => import('@/views/ManageMiddleware'),
|
|
138
|
-
meta: { title: 'Middleware' }
|
|
139
|
-
}, {
|
|
140
|
-
path: 'requestlogs',
|
|
141
|
-
meta: { title: 'Request Logs', icon: 'diary' },
|
|
142
|
-
name: 'requestlogs',
|
|
143
|
-
component: () => import('@/views/ListDocuments2'),
|
|
144
|
-
props: { collectionName: 'requestlog', columns: ['method', 'url', 'req.ip', 'user', 'res.message', 'res.statusCode', 'res.headers.content-length'] },
|
|
145
|
-
}, {
|
|
146
|
-
path: 'viewrequest/:requestId',
|
|
147
|
-
hidden: true,
|
|
148
|
-
meta: { title: 'View Request', icon: 'diary' },
|
|
149
|
-
name: 'viewrequest',
|
|
150
|
-
component: () => import('@/views/ViewRequest'),
|
|
151
|
-
}, {
|
|
152
|
-
path: '/edit/collection',
|
|
153
|
-
component: Layout,
|
|
154
|
-
name: 'Schema',
|
|
155
|
-
hidden: true,
|
|
156
|
-
meta: { title: 'Schemas', icon: 'cog' },
|
|
157
|
-
children: [{
|
|
158
|
-
hidden: true,
|
|
159
|
-
path: '/:collectionName',
|
|
160
|
-
name: name,
|
|
161
|
-
meta: { title: capitalize(name) }
|
|
162
|
-
}]
|
|
163
|
-
},
|
|
164
|
-
]
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
{
|
|
168
|
-
path: 'external-link',
|
|
169
|
-
component: Layout,
|
|
170
|
-
children: [
|
|
171
|
-
{
|
|
172
|
-
path: 'https://github.com/thomas4019/expressa',
|
|
173
|
-
meta: { title: 'Expressa Docs', icon: 'link' }
|
|
174
|
-
}
|
|
175
|
-
]
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
{ path: '*', redirect: '/404', hidden: true }
|
|
179
|
-
]
|
|
180
|
-
|
|
181
|
-
export default new Router({
|
|
182
|
-
// mode: 'history',
|
|
183
|
-
scrollBehavior: () => ({ y: 0 }),
|
|
184
|
-
routes: constantRouterMap
|
|
185
|
-
})
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import Router from 'vue-router'
|
|
3
|
+
|
|
4
|
+
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
|
|
5
|
+
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading
|
|
6
|
+
|
|
7
|
+
Vue.use(Router)
|
|
8
|
+
|
|
9
|
+
/* Layout */
|
|
10
|
+
import Layout from '../views/layout/Layout'
|
|
11
|
+
|
|
12
|
+
const capitalize = (s) => {
|
|
13
|
+
if (typeof s !== 'string') return ''
|
|
14
|
+
return s.charAt(0).toUpperCase() + s.slice(1)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
|
|
19
|
+
* alwaysShow: true if set true, will always show the root menu, whatever its child routes length
|
|
20
|
+
* if not set alwaysShow, only more than one route under the children
|
|
21
|
+
* it will becomes nested mode, otherwise not show the root menu
|
|
22
|
+
* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb
|
|
23
|
+
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
|
24
|
+
* meta : {
|
|
25
|
+
title: 'title' the name show in submenu and breadcrumb (recommend set)
|
|
26
|
+
icon: 'svg-name' the icon show in the sidebar,
|
|
27
|
+
}
|
|
28
|
+
**/
|
|
29
|
+
|
|
30
|
+
export const constantRouterMap = [
|
|
31
|
+
{ path: '/login', component: () => import('@/views/login/index'), hidden: true },
|
|
32
|
+
{ path: '/install', component: () => import('@/views/Install'), hidden: true },
|
|
33
|
+
{ path: '/404', component: () => import('@/views/404'), hidden: true },
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
path: '/',
|
|
37
|
+
component: Layout,
|
|
38
|
+
redirect: '/home',
|
|
39
|
+
name: 'Home',
|
|
40
|
+
meta: { title: 'Home', icon: 'home' },
|
|
41
|
+
children: [{
|
|
42
|
+
path: 'home',
|
|
43
|
+
meta: { title: 'Home', icon: 'home' },
|
|
44
|
+
component: () => import('@/views/Home')
|
|
45
|
+
}, {
|
|
46
|
+
path: '/edit/:collectionName/:id',
|
|
47
|
+
component: () => import('@/views/EditDocument'),
|
|
48
|
+
hidden: true
|
|
49
|
+
}]
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
{
|
|
53
|
+
path: '/users',
|
|
54
|
+
redirect: '/users/list',
|
|
55
|
+
component: Layout,
|
|
56
|
+
name: 'Users',
|
|
57
|
+
meta: { title: 'People', icon: 'users-alt' },
|
|
58
|
+
children: [{
|
|
59
|
+
path: 'list',
|
|
60
|
+
meta: { title: 'Users', icon: 'users-alt' },
|
|
61
|
+
name: 'users2',
|
|
62
|
+
component: () => import('@/views/ListDocuments2'),
|
|
63
|
+
props: { collectionName: 'users' },
|
|
64
|
+
}, {
|
|
65
|
+
path: 'add',
|
|
66
|
+
meta: { title: 'Add User', icon: 'plus' },
|
|
67
|
+
name: 'newuser',
|
|
68
|
+
component: () => import('@/views/EditDocument'),
|
|
69
|
+
props: { collectionName: 'users', id: 'create' },
|
|
70
|
+
}, {
|
|
71
|
+
path: 'role',
|
|
72
|
+
meta: { title: 'Roles', icon: 'shield-check' },
|
|
73
|
+
name: 'role',
|
|
74
|
+
component: () => import('@/views/ListDocuments2'),
|
|
75
|
+
props: { collectionName: 'role' },
|
|
76
|
+
}, {
|
|
77
|
+
path: 'addrole',
|
|
78
|
+
meta: { title: 'Add Role', icon: 'plus' },
|
|
79
|
+
name: 'newrole',
|
|
80
|
+
component: () => import('@/views/EditDocument'),
|
|
81
|
+
props: { collectionName: 'role', id: 'create' },
|
|
82
|
+
}],
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
{
|
|
86
|
+
path: '/list/:collectionName',
|
|
87
|
+
component: Layout,
|
|
88
|
+
hidden: true,
|
|
89
|
+
name: 'Data',
|
|
90
|
+
meta: { title: 'Data', icon: 'database' },
|
|
91
|
+
children: [{
|
|
92
|
+
path: '',
|
|
93
|
+
name: ':collectionName',
|
|
94
|
+
component: () => import('@/views/ListDocuments2'),
|
|
95
|
+
props: route => ({ collectionName: route.params.collectionName }),
|
|
96
|
+
meta: { title: capitalize(name) }
|
|
97
|
+
}]
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
{
|
|
101
|
+
path: '/manage/permissions',
|
|
102
|
+
component: Layout,
|
|
103
|
+
name: 'permissions',
|
|
104
|
+
meta: { title: 'Manage', icon: 'shield-check' },
|
|
105
|
+
children: [
|
|
106
|
+
{
|
|
107
|
+
path: '',
|
|
108
|
+
name: 'permissions',
|
|
109
|
+
component: () => import('@/views/ManagePermissions'),
|
|
110
|
+
meta: { title: 'Permissions' }
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
{
|
|
116
|
+
path: '/dev',
|
|
117
|
+
component: Layout,
|
|
118
|
+
meta: { title: 'Dev', icon: 'flask' },
|
|
119
|
+
name: 'Dev',
|
|
120
|
+
children: [
|
|
121
|
+
{
|
|
122
|
+
path: '',
|
|
123
|
+
name: '',
|
|
124
|
+
component: () => import('@/views/Dev'),
|
|
125
|
+
meta: { title: '' },
|
|
126
|
+
hidden: true,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
path: 'listeners',
|
|
130
|
+
name: 'listeners',
|
|
131
|
+
component: () => import('@/views/ManageListeners'),
|
|
132
|
+
meta: { title: 'Listeners' }
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
path: 'middleware',
|
|
136
|
+
name: 'middleware',
|
|
137
|
+
component: () => import('@/views/ManageMiddleware'),
|
|
138
|
+
meta: { title: 'Middleware' }
|
|
139
|
+
}, {
|
|
140
|
+
path: 'requestlogs',
|
|
141
|
+
meta: { title: 'Request Logs', icon: 'diary' },
|
|
142
|
+
name: 'requestlogs',
|
|
143
|
+
component: () => import('@/views/ListDocuments2'),
|
|
144
|
+
props: { collectionName: 'requestlog', columns: ['method', 'url', 'req.ip', 'user', 'res.message', 'res.statusCode', 'res.headers.content-length'] },
|
|
145
|
+
}, {
|
|
146
|
+
path: 'viewrequest/:requestId',
|
|
147
|
+
hidden: true,
|
|
148
|
+
meta: { title: 'View Request', icon: 'diary' },
|
|
149
|
+
name: 'viewrequest',
|
|
150
|
+
component: () => import('@/views/ViewRequest'),
|
|
151
|
+
}, {
|
|
152
|
+
path: '/edit/collection',
|
|
153
|
+
component: Layout,
|
|
154
|
+
name: 'Schema',
|
|
155
|
+
hidden: true,
|
|
156
|
+
meta: { title: 'Schemas', icon: 'cog' },
|
|
157
|
+
children: [{
|
|
158
|
+
hidden: true,
|
|
159
|
+
path: '/:collectionName',
|
|
160
|
+
name: name,
|
|
161
|
+
meta: { title: capitalize(name) }
|
|
162
|
+
}]
|
|
163
|
+
},
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
{
|
|
168
|
+
path: 'external-link',
|
|
169
|
+
component: Layout,
|
|
170
|
+
children: [
|
|
171
|
+
{
|
|
172
|
+
path: 'https://github.com/thomas4019/expressa',
|
|
173
|
+
meta: { title: 'Expressa Docs', icon: 'link' }
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
{ path: '*', redirect: '/404', hidden: true }
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
export default new Router({
|
|
182
|
+
// mode: 'history',
|
|
183
|
+
scrollBehavior: () => ({ y: 0 }),
|
|
184
|
+
routes: constantRouterMap
|
|
185
|
+
})
|
|
@@ -1,48 +1,47 @@
|
|
|
1
|
-
import axios from 'axios'
|
|
2
|
-
import { Message } from 'element-ui'
|
|
3
|
-
import store from '../store'
|
|
4
|
-
import { getToken } from '@/utils/auth'
|
|
5
|
-
|
|
6
|
-
const get = (o, p) =>
|
|
7
|
-
p.reduce((xs, x) => (xs && xs[x]) ? xs[x] : null, o)
|
|
8
|
-
|
|
9
|
-
const service = axios.create({
|
|
10
|
-
// eslint-disable-next-line
|
|
11
|
-
baseURL: (typeof settings !== 'undefined' ? settings.apiurl :
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export default service
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
import { Message } from 'element-ui'
|
|
3
|
+
import store from '../store'
|
|
4
|
+
import { getToken } from '@/utils/auth'
|
|
5
|
+
|
|
6
|
+
const get = (o, p) =>
|
|
7
|
+
p.reduce((xs, x) => (xs && xs[x]) ? xs[x] : null, o)
|
|
8
|
+
|
|
9
|
+
const service = axios.create({
|
|
10
|
+
// eslint-disable-next-line
|
|
11
|
+
baseURL: (typeof settings !== 'undefined' ? settings.apiurl : 'https://dev.racepass.com/api/v1/'), timeout: 5000 // 请求超时时间
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
// request拦截器
|
|
15
|
+
service.interceptors.request.use(
|
|
16
|
+
config => {
|
|
17
|
+
if (store.getters.token) {
|
|
18
|
+
config.headers['x-access-token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
|
19
|
+
}
|
|
20
|
+
return config
|
|
21
|
+
},
|
|
22
|
+
error => {
|
|
23
|
+
// Do something with request error
|
|
24
|
+
console.log(error) // for debug
|
|
25
|
+
Promise.reject(error)
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
// response 拦截器
|
|
30
|
+
service.interceptors.response.use(
|
|
31
|
+
response => {
|
|
32
|
+
return response
|
|
33
|
+
},
|
|
34
|
+
error => {
|
|
35
|
+
console.log(error) // for debug
|
|
36
|
+
const errorMessage = get(error, ['response', 'data', 'error']) || error.message
|
|
37
|
+
Message({
|
|
38
|
+
message: errorMessage,
|
|
39
|
+
type: 'error',
|
|
40
|
+
duration: 0,
|
|
41
|
+
showClose: true,
|
|
42
|
+
})
|
|
43
|
+
return Promise.reject(error)
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
export default service
|