expressa 1.2.4 → 1.4.0
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 +2 -2
- package/auth/index.js +45 -31
- package/auth/jwt.js +3 -2
- package/controllers/users.js +8 -1
- package/index.js +3 -7
- package/listeners.js +64 -59
- package/listeners_users.js +88 -87
- package/middleware/permissions.js +47 -53
- package/modules/admin/dist/index.html +1 -1
- package/modules/admin/dist/index.html.gz +0 -0
- package/modules/admin/dist/static/css/{chunk-5cee.9685afb8.css → chunk-5061.ce0e4bdb.css} +0 -0
- package/modules/admin/dist/static/css/{chunk-5cee.9685afb8.css.gz → chunk-5061.ce0e4bdb.css.gz} +0 -0
- package/modules/admin/dist/static/css/chunk-5e50.f67eeaed.css +1 -0
- package/modules/admin/dist/static/css/chunk-5e50.f67eeaed.css.gz +0 -0
- package/modules/admin/dist/static/css/{chunk-621e.f3d0eab6.css → chunk-621e.b826be8d.css} +0 -0
- package/modules/admin/dist/static/css/{chunk-621e.f3d0eab6.css.gz → chunk-621e.b826be8d.css.gz} +0 -0
- package/modules/admin/dist/static/css/chunk-7109.2bd6f37e.css +1 -0
- package/modules/admin/dist/static/css/chunk-7109.2bd6f37e.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-7f4f.f67eeaed.css +1 -0
- package/modules/admin/dist/static/css/chunk-7f4f.f67eeaed.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-9a95.c647a2ef.css +1 -0
- package/modules/admin/dist/static/css/chunk-9a95.c647a2ef.css.gz +0 -0
- package/modules/admin/dist/static/css/{chunk-bd5f.6ab011ba.css → chunk-bd5f.aefa49d7.css} +0 -0
- package/modules/admin/dist/static/css/{chunk-bd5f.6ab011ba.css.gz → chunk-bd5f.aefa49d7.css.gz} +0 -0
- package/modules/admin/dist/static/css/{chunk-e375.1d849865.css → chunk-e374.025d58bb.css} +0 -0
- package/modules/admin/dist/static/css/{chunk-e375.1d849865.css.gz → chunk-e374.025d58bb.css.gz} +0 -0
- package/modules/admin/dist/static/js/{app.ebe90d64.js → app.da5e53a7.js} +1 -1
- package/modules/admin/dist/static/js/app.da5e53a7.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-5061.83e6ccfa.js +1 -0
- package/modules/admin/dist/static/js/chunk-5061.83e6ccfa.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-5e17.a2b69611.js +1 -0
- package/modules/admin/dist/static/js/chunk-5e17.a2b69611.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-5e50.6820e69c.js +1 -0
- package/modules/admin/dist/static/js/chunk-5e50.6820e69c.js.gz +0 -0
- package/modules/admin/dist/static/js/{chunk-621e.6fe293e9.js → chunk-621e.ccf42393.js} +0 -0
- package/modules/admin/dist/static/js/{chunk-621e.6fe293e9.js.gz → chunk-621e.ccf42393.js.gz} +0 -0
- package/modules/admin/dist/static/js/chunk-7109.10cb4860.js +1 -0
- package/modules/admin/dist/static/js/chunk-7109.10cb4860.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-7f4f.ae4400a8.js +1 -0
- package/modules/admin/dist/static/js/chunk-7f4f.ae4400a8.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-9a95.bdd76583.js +1 -0
- package/modules/admin/dist/static/js/chunk-9a95.bdd76583.js.gz +0 -0
- package/modules/admin/dist/static/js/{chunk-bd5f.af5f2197.js → chunk-bd5f.e9509f10.js} +0 -0
- package/modules/admin/dist/static/js/{chunk-bd5f.af5f2197.js.gz → chunk-bd5f.e9509f10.js.gz} +0 -0
- package/modules/admin/dist/static/js/{chunk-e375.089d85cd.js → chunk-e374.7c87a0dd.js} +1 -1
- package/modules/admin/dist/static/js/chunk-e374.7c87a0dd.js.gz +0 -0
- package/modules/admin/package.json +1 -0
- package/modules/admin/src/router/index.js +200 -185
- package/modules/admin/src/views/Endpoints.vue +250 -0
- package/modules/admin/src/views/ListDocuments2.vue +465 -407
- package/modules/admin/src/views/ViewRequest.vue +7 -3
- package/modules/core/core.js +5 -0
- package/modules/logging/logging.js +3 -0
- package/package.json +1 -1
- package/test/0-install.js +1 -0
- package/test/users.js +37 -1
- package/util.js +18 -8
- package/modules/admin/dist/static/css/chunk-1dff.39c7634b.css +0 -1
- package/modules/admin/dist/static/css/chunk-1dff.39c7634b.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-3bc2.89632b9d.css +0 -1
- package/modules/admin/dist/static/css/chunk-3bc2.89632b9d.css.gz +0 -0
- package/modules/admin/dist/static/css/chunk-f691.4817ca73.css +0 -1
- package/modules/admin/dist/static/css/chunk-f691.4817ca73.css.gz +0 -0
- package/modules/admin/dist/static/js/app.ebe90d64.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-1dff.1f1c0999.js +0 -1
- package/modules/admin/dist/static/js/chunk-1dff.1f1c0999.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-3bc2.028748b7.js +0 -1
- package/modules/admin/dist/static/js/chunk-3bc2.028748b7.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-5cee.a6f0e769.js +0 -1
- package/modules/admin/dist/static/js/chunk-5cee.a6f0e769.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-e375.089d85cd.js.gz +0 -0
- package/modules/admin/dist/static/js/chunk-f691.c0cbf5c1.js +0 -1
- package/modules/admin/dist/static/js/chunk-f691.c0cbf5c1.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-
|
|
1
|
+
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-e374"],{"3FMA":function(t,e,n){"use strict";var a=n("ID0Q");n.n(a).a},"3j9E":function(t,e,n){"use strict";n.d(e,"a",(function(){return a})),n.d(e,"b",(function(){return i}));var a=function(){var t=this.$createElement;this._self._c;return this._m(0)},i=[function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("div",{staticClass:"jsoneditor-vue"})])}]},GZHj:function(t,e,n){"use strict";n.d(e,"a",(function(){return a})),n.d(e,"b",(function(){return i}));var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"container"},[n("div",{staticClass:"error-message"},[t._v("\n "+t._s(t.error)+"\n ")]),t._v(" "),t.ready?[t.ready?n("JSONEditor",{attrs:{schema:t.schema},model:{value:t.data,callback:function(e){t.data=e},expression:"data"}}):t._e(),t._v(" "),n("div",[n("button",{staticClass:"btn btn-primary",on:{click:t.save}},[t._v("\n Save\n ")]),t._v(" "),n("button",{staticClass:"btn btn-danger",on:{click:t.del}},[t._v("\n Delete\n ")])])]:t._e()],2)])},i=[]},ID0Q:function(t,e,n){},KJ4A:function(t,e,n){"use strict";var a=n("d9An");n.n(a).a},O0nT:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=c(n("Yz+Y")),i=c(n("iCc5")),r=c(n("V7oC")),o=c(n("FYw3")),s=c(n("tfYw")),u=c(n("mRg0"));function c(t){return t&&t.__esModule?t:{default:t}}n("drU8");var l=n("0fIc").JSONEditor;e.default={props:{value:{type:Object,default:function(){}},schema:{type:Object,default:function(){}}},data:function(){return{editor:null,error:!1,json:this.value,internalChange:!1}},watch:{},mounted:function(){this.update()},methods:{update:function(){var t=this,e={schema:this.schema,startval:this.value,theme:"bootstrap4",iconlib:"materialicons",required_by_default:!0};this.editor&&this.editor.destroy(),this.editor=new l(this.$el.querySelector(".jsoneditor-vue"),e);var n=!0;this.editor.on("change",(function(){n?n=!1:t.$emit("input",t.editor.getValue())}));var a;(a=document.querySelector(".je-modal .je-edit-json--textarea")).classList.remove("je-edit-json--textarea"),a.classList.add("expandable-textarea")},onSave:function(){this.$emit("json-save",this.json)}}},l&&(l.defaults.resolvers.unshift((function(t){if("object"===t.type&&"schema"===t.format)return"schema"})),l.defaults.editors.schema=function(t){function e(){return(0,i.default)(this,e),(0,o.default)(this,(e.__proto__||(0,a.default)(e)).apply(this,arguments))}return(0,u.default)(e,t),(0,r.default)(e,[{key:"setValue",value:function(t,e){this.value=t,this.schemaeditor.setValue(t),this.onChange()}},{key:"getValue",value:function(){return void 0!==this.schemaeditor?this.schemaeditor.getValue():{}}},{key:"register",value:function(){(0,s.default)(e.prototype.__proto__||(0,a.default)(e.prototype),"register",this).call(this),this.input&&this.input.setAttribute("name",this.formname)}},{key:"unregister",value:function(){(0,s.default)(e.prototype.__proto__||(0,a.default)(e.prototype),"unregister",this).call(this),this.input&&this.input.removeAttribute("name")}},{key:"getNumColumns",value:function(){return 12}},{key:"build",value:function(){var t=this;this.options.compact||(this.label=this.header=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.options.compact&&(this.container.className+=" compact"),this.input=document.createElement("div"),this.control=this.theme.getFormControl(this.label,this.input,this.description),(this.schema.readOnly||this.schema.readonly)&&(this.always_disabled=!0,this.input.disabled=!0),this.container.appendChild(this.control),this.schemaeditor=new window.JSONSchemaEditor(this.input,{startval:{}}),this.schemaeditor.on("change",(function(){t.onChange(!0)}))}},{key:"enable",value:function(){this.always_disabled||(this.input.disabled=!1),(0,s.default)(e.prototype.__proto__||(0,a.default)(e.prototype),"enable",this).call(this)}},{key:"disable",value:function(){this.input.disabled=!0,(0,s.default)(e.prototype.__proto__||(0,a.default)(e.prototype),"disable",this).call(this)}},{key:"destroy",value:function(){this.label&&this.label.parentNode&&this.label.parentNode.removeChild(this.label),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),(0,s.default)(e.prototype.__proto__||(0,a.default)(e.prototype),"destroy",this).call(this)}}]),e}(l.AbstractEditor))},TYEE:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a,i=c(n("14Xm")),r=c(n("D3Ub")),o=c(n("t3Un")),s=c(n("fKSE")),u=c(n("Q2AE"));function c(t){return t&&t.__esModule?t:{default:t}}e.default={name:"CollectionTable",components:{JSONEditor:s.default},props:{collectionName:{type:String,default:""},id:{type:String,default:""}},data:function(){return{data:{},collectionName:"",id:"",error:"",options:{mode:"text"},schema:{},ready:!1}},watch:{"$route.path":{handler:"update"}},mounted:(a=(0,r.default)(i.default.mark((function t(){return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.update();case 1:case"end":return t.stop()}}),t,this)}))),function(){return a.apply(this,arguments)}),methods:{update:function(){var t=this;return(0,r.default)(i.default.mark((function e(){return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.ready=!1,t.$route.params.collectionName&&(t.collectionName=t.$route.params.collectionName),t.$route.params.id&&(t.id=t.$route.params.id),e.prev=3,"create"===t.id){e.next=10;break}return e.next=7,(0,o.default)({url:"/"+t.collectionName+"/"+t.id});case 7:t.data=e.sent.data,e.next=11;break;case 10:t.data={};case 11:return e.next=13,(0,o.default)({url:"/"+t.collectionName+"/schema"});case 13:t.schema=e.sent.data,t.ready=!0,e.next=20;break;case 17:e.prev=17,e.t0=e.catch(3),t.error=e.t0.error||e.t0;case 20:case"end":return e.stop()}}),e,t,[[3,17]])})))()},save:function(){var t=this;return(0,r.default)(i.default.mark((function e(){return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("create"!==t.id){e.next=5;break}return e.next=3,(0,o.default)({method:"post",url:"/"+t.collectionName,data:t.data});case 3:e.next=7;break;case 5:return e.next=7,(0,o.default)({method:"put",url:"/"+t.collectionName+"/"+t.id,data:t.data});case 7:if("collection"!==t.collectionName){e.next=12;break}return e.next=10,(0,o.default)({url:"/status/"});case 10:t.statusInfo=e.sent.data,u.default.dispatch("StatusInfo",t.statusInfo);case 12:"users"===t.collectionName?t.$router.push("/users/list"):"settings"===t.collectionName?t.$router.push("/home"):t.$router.push("/list/"+t.collectionName+"/");case 13:case"end":return e.stop()}}),e,t)})))()},del:function(){var t=this;return(0,r.default)(i.default.mark((function e(){return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,o.default)({method:"delete",url:"/"+t.collectionName+"/"+t.id});case 2:t.$router.push("/list/"+t.collectionName+"/");case 3:case"end":return e.stop()}}),e,t)})))()}}}},XZgb:function(t,e,n){"use strict";n.r(e);var a=n("O0nT"),i=n.n(a);for(var r in a)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(r);e.default=i.a},ZoMo:function(t,e,n){"use strict";n.r(e);var a=n("GZHj"),i=n("tPw9");for(var r in i)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(r);n("KJ4A");var o=n("KHd+"),s=Object(o.a)(i.default,a.a,a.b,!1,null,null,null);s.options.__file="EditDocument.vue",e.default=s.exports},d9An:function(t,e,n){},fKSE:function(t,e,n){"use strict";n.r(e);var a=n("3j9E"),i=n("XZgb");for(var r in i)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(r);n("3FMA");var o=n("KHd+"),s=Object(o.a)(i.default,a.a,a.b,!1,null,null,null);s.options.__file="JSONEditor.vue",e.default=s.exports},tPw9:function(t,e,n){"use strict";n.r(e);var a=n("TYEE"),i=n.n(a);for(var r in a)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(r);e.default=i.a}}]);
|
|
Binary file
|
|
@@ -1,185 +1,200 @@
|
|
|
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: '/
|
|
117
|
-
component: Layout,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
children: [
|
|
121
|
-
{
|
|
122
|
-
path: '',
|
|
123
|
-
name: '',
|
|
124
|
-
component: () => import('@/views/
|
|
125
|
-
meta: { title: '' }
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
meta: { title: '
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
]
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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: '/endpoints',
|
|
117
|
+
component: Layout,
|
|
118
|
+
name: 'endpoints',
|
|
119
|
+
meta: { title: 'Search', icon: 'link' },
|
|
120
|
+
children: [
|
|
121
|
+
{
|
|
122
|
+
path: '',
|
|
123
|
+
name: 'endpoints',
|
|
124
|
+
component: () => import('@/views/Endpoints'),
|
|
125
|
+
meta: { title: 'Endpoints' }
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
{
|
|
131
|
+
path: '/dev',
|
|
132
|
+
component: Layout,
|
|
133
|
+
meta: { title: 'Dev', icon: 'flask' },
|
|
134
|
+
name: 'Dev',
|
|
135
|
+
children: [
|
|
136
|
+
{
|
|
137
|
+
path: '',
|
|
138
|
+
name: '',
|
|
139
|
+
component: () => import('@/views/Dev'),
|
|
140
|
+
meta: { title: '' },
|
|
141
|
+
hidden: true,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
path: 'listeners',
|
|
145
|
+
name: 'listeners',
|
|
146
|
+
component: () => import('@/views/ManageListeners'),
|
|
147
|
+
meta: { title: 'Listeners' }
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
path: 'middleware',
|
|
151
|
+
name: 'middleware',
|
|
152
|
+
component: () => import('@/views/ManageMiddleware'),
|
|
153
|
+
meta: { title: 'Middleware' }
|
|
154
|
+
}, {
|
|
155
|
+
path: 'requestlogs',
|
|
156
|
+
meta: { title: 'Request Logs', icon: 'diary' },
|
|
157
|
+
name: 'requestlogs',
|
|
158
|
+
component: () => import('@/views/ListDocuments2'),
|
|
159
|
+
props: { collectionName: 'requestlog', columns: ['method', 'url', 'req.ip', 'user', 'res.message', 'res.statusCode', 'res.headers.content-length'] },
|
|
160
|
+
}, {
|
|
161
|
+
path: 'viewrequest/:requestId',
|
|
162
|
+
hidden: true,
|
|
163
|
+
meta: { title: 'View Request', icon: 'diary' },
|
|
164
|
+
name: 'viewrequest',
|
|
165
|
+
component: () => import('@/views/ViewRequest'),
|
|
166
|
+
}, {
|
|
167
|
+
path: '/edit/collection',
|
|
168
|
+
component: Layout,
|
|
169
|
+
name: 'Schema',
|
|
170
|
+
hidden: true,
|
|
171
|
+
meta: { title: 'Schemas', icon: 'cog' },
|
|
172
|
+
children: [{
|
|
173
|
+
hidden: true,
|
|
174
|
+
path: '/:collectionName',
|
|
175
|
+
name: name,
|
|
176
|
+
meta: { title: capitalize(name) }
|
|
177
|
+
}]
|
|
178
|
+
},
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
{
|
|
183
|
+
path: 'external-link',
|
|
184
|
+
component: Layout,
|
|
185
|
+
children: [
|
|
186
|
+
{
|
|
187
|
+
path: 'https://github.com/thomas4019/expressa',
|
|
188
|
+
meta: { title: 'Expressa Docs', icon: 'link' }
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
{ path: '*', redirect: '/404', hidden: true }
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
export default new Router({
|
|
197
|
+
// mode: 'history',
|
|
198
|
+
scrollBehavior: () => ({ y: 0 }),
|
|
199
|
+
routes: constantRouterMap
|
|
200
|
+
})
|