@afeefa/vue-app 0.0.113 → 0.0.115
Sign up to get free protection for your applications and to get access to all the features.
- package/.afeefa/package/release/version.txt +1 -1
- package/package.json +1 -1
- package/src-admin/AfeefaAdmin.js +114 -0
- package/src-admin/components/App.vue +7 -7
- package/src-admin/components/SidebarMenu.vue +7 -6
- package/src-admin/config/{AppConfig.js → AdminConfig.js} +2 -2
- package/src-admin/plugins/AuthPlugin.js +2 -2
- package/src-admin/bootstrap.js +0 -74
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.115
|
package/package.json
CHANGED
@@ -0,0 +1,114 @@
|
|
1
|
+
import './config/components'
|
2
|
+
import './directives'
|
3
|
+
|
4
|
+
import { apiResourcesPlugin } from '@a-vue/plugins/api-resources/ApiResourcesPlugin'
|
5
|
+
import { eventBusPlugin } from '@a-vue/plugins/event-bus/EventBusPlugin'
|
6
|
+
import { hasOptionsPlugin } from '@a-vue/plugins/has-options/HasOptionsPlugin'
|
7
|
+
import { timeout } from '@a-vue/utils/timeout'
|
8
|
+
import Vue from 'vue'
|
9
|
+
|
10
|
+
import { adminConfig } from './config/AdminConfig'
|
11
|
+
import routeConfigPlugin from './config/routing'
|
12
|
+
import vuetify from './config/vuetify'
|
13
|
+
import { authPlugin } from './plugins/AuthPlugin'
|
14
|
+
|
15
|
+
Vue.config.productionTip = false
|
16
|
+
|
17
|
+
export class AfeefaAdmin {
|
18
|
+
_appConfig = {}
|
19
|
+
_routeConfigCallback = null
|
20
|
+
_apiConfig = null
|
21
|
+
_authService = null
|
22
|
+
_initCallback = null
|
23
|
+
_components = {}
|
24
|
+
|
25
|
+
app (appConfig) {
|
26
|
+
this._appConfig = appConfig
|
27
|
+
return this
|
28
|
+
}
|
29
|
+
|
30
|
+
routing (routeConfigCallback) {
|
31
|
+
this._routeConfigCallback = routeConfigCallback
|
32
|
+
return this
|
33
|
+
}
|
34
|
+
|
35
|
+
api (apiConfig) {
|
36
|
+
this._apiConfig = apiConfig
|
37
|
+
return this
|
38
|
+
}
|
39
|
+
|
40
|
+
auth (authService) {
|
41
|
+
this._authService = authService
|
42
|
+
return this
|
43
|
+
}
|
44
|
+
|
45
|
+
init (initCallback) {
|
46
|
+
this._initCallback = initCallback
|
47
|
+
return this
|
48
|
+
}
|
49
|
+
|
50
|
+
async run () {
|
51
|
+
// set app config
|
52
|
+
adminConfig.app = this._appConfig
|
53
|
+
|
54
|
+
// authenticate current user before doing any gui-voodo
|
55
|
+
if (this._authService) {
|
56
|
+
adminConfig.authService = this._authService
|
57
|
+
|
58
|
+
const authenticated = await this._authService.authenticate()
|
59
|
+
if (!authenticated) {
|
60
|
+
return // redirects to login
|
61
|
+
}
|
62
|
+
Vue.use(authPlugin)
|
63
|
+
}
|
64
|
+
|
65
|
+
// auth went well, show splash screen
|
66
|
+
const splash = new Vue({
|
67
|
+
vuetify,
|
68
|
+
el: '#splash',
|
69
|
+
template: '<splash />',
|
70
|
+
components: {
|
71
|
+
Splash: adminConfig.app.components.Splash
|
72
|
+
}
|
73
|
+
})
|
74
|
+
|
75
|
+
// plugins
|
76
|
+
Vue.use(hasOptionsPlugin)
|
77
|
+
Vue.use(eventBusPlugin)
|
78
|
+
|
79
|
+
// load auth resources
|
80
|
+
if (this._authService) {
|
81
|
+
await this._authService.init()
|
82
|
+
}
|
83
|
+
|
84
|
+
// setup api resources
|
85
|
+
apiResourcesPlugin.register(this._apiConfig.models, this._apiConfig.apis)
|
86
|
+
Vue.use(apiResourcesPlugin)
|
87
|
+
await apiResourcesPlugin.schemasLoaded()
|
88
|
+
|
89
|
+
// load initial data
|
90
|
+
if (this._initCallback) {
|
91
|
+
await this._initCallback()
|
92
|
+
}
|
93
|
+
|
94
|
+
// setup router, routes and breadcrumb
|
95
|
+
this._routeConfigCallback(routeConfigPlugin)
|
96
|
+
const router = await routeConfigPlugin.getRouter()
|
97
|
+
|
98
|
+
// routeConfigPlugin.dumpRoutes()
|
99
|
+
// routeConfigPlugin.dumbBreadcrumbs()
|
100
|
+
|
101
|
+
// remove splash show app
|
102
|
+
timeout(() => {
|
103
|
+
new Vue({
|
104
|
+
vuetify,
|
105
|
+
router,
|
106
|
+
el: '#app',
|
107
|
+
template: '<start :splash="splash" />',
|
108
|
+
data: {
|
109
|
+
splash
|
110
|
+
}
|
111
|
+
})
|
112
|
+
}, 300)
|
113
|
+
}
|
114
|
+
}
|
@@ -9,7 +9,7 @@
|
|
9
9
|
>
|
10
10
|
<v-container
|
11
11
|
flex-column
|
12
|
-
align-
|
12
|
+
align-center
|
13
13
|
fill-height
|
14
14
|
>
|
15
15
|
<router-link
|
@@ -123,7 +123,7 @@
|
|
123
123
|
<script>
|
124
124
|
import { Component, Vue, Watch } from '@a-vue'
|
125
125
|
import { LoadingEvent } from '@a-vue/events'
|
126
|
-
import {
|
126
|
+
import { adminConfig } from '@a-admin/config/AdminConfig'
|
127
127
|
import { sleep } from '@a-vue/utils/timeout'
|
128
128
|
import AppBarButtons from './app/AppBarButtons'
|
129
129
|
import AppBarTitleContainer from './app/AppBarTitleContainer'
|
@@ -154,11 +154,11 @@ export default class App extends Vue {
|
|
154
154
|
}
|
155
155
|
|
156
156
|
get SidebarMenu () {
|
157
|
-
return
|
157
|
+
return adminConfig.app.components.SidebarMenu
|
158
158
|
}
|
159
159
|
|
160
160
|
get logoUrl () {
|
161
|
-
return
|
161
|
+
return adminConfig.app.logo
|
162
162
|
}
|
163
163
|
|
164
164
|
get account () {
|
@@ -169,15 +169,15 @@ export default class App extends Vue {
|
|
169
169
|
}
|
170
170
|
|
171
171
|
get title () {
|
172
|
-
return
|
172
|
+
return adminConfig.app.title
|
173
173
|
}
|
174
174
|
|
175
175
|
get loaderColor () {
|
176
|
-
return
|
176
|
+
return adminConfig.app.loaderColor
|
177
177
|
}
|
178
178
|
|
179
179
|
get rootRouteName () {
|
180
|
-
return
|
180
|
+
return adminConfig.app.rootRouteName || 'root'
|
181
181
|
}
|
182
182
|
|
183
183
|
startLoading () {
|
@@ -4,7 +4,7 @@
|
|
4
4
|
flex-column
|
5
5
|
>
|
6
6
|
<v-list class="pa-0">
|
7
|
-
<template v-for="item in
|
7
|
+
<template v-for="item in items">
|
8
8
|
<v-list-group
|
9
9
|
v-if="item.group"
|
10
10
|
:key="item.title"
|
@@ -36,7 +36,7 @@ import { Component, Vue } from '@a-vue'
|
|
36
36
|
import SidebarMenuItem from './menu/SidebarMenuItem'
|
37
37
|
|
38
38
|
@Component({
|
39
|
-
props: ['
|
39
|
+
props: ['items'],
|
40
40
|
components: {
|
41
41
|
SidebarMenuItem
|
42
42
|
}
|
@@ -50,11 +50,12 @@ export default class SidebarMenu extends Vue {
|
|
50
50
|
:deep(.v-list-group) {
|
51
51
|
> .v-list-item {
|
52
52
|
padding: 0;
|
53
|
+
|
53
54
|
> .v-list-item {
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
padding: 0;
|
56
|
+
padding-left: 19px;
|
57
|
+
flex: 0;
|
58
|
+
color: #999999 !important;
|
58
59
|
|
59
60
|
.v-list-item__icon {
|
60
61
|
margin-right: 18px !important;
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { adminConfig } from '../config/AdminConfig'
|
2
2
|
|
3
3
|
class AuthPlugin {
|
4
4
|
install (Vue) {
|
5
|
-
const authService =
|
5
|
+
const authService = adminConfig.authService
|
6
6
|
const $auth = {
|
7
7
|
account: authService.getCurrentAccount(),
|
8
8
|
|
package/src-admin/bootstrap.js
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
import './config/event-bus'
|
2
|
-
import './config/components'
|
3
|
-
import './directives'
|
4
|
-
|
5
|
-
import { authPlugin } from '@a-admin/plugins/AuthPlugin'
|
6
|
-
import { translationPlugin } from '@a-admin/plugins/translation/TranslationPlugin'
|
7
|
-
import { apiResourcesPlugin } from '@a-vue/plugins/api-resources/ApiResourcesPlugin'
|
8
|
-
import { hasOptionsPlugin } from '@a-vue/plugins/has-options/HasOptionsPlugin'
|
9
|
-
import { timeout } from '@a-vue/utils/timeout'
|
10
|
-
import Vue from 'vue'
|
11
|
-
|
12
|
-
import { appConfig } from './config/AppConfig'
|
13
|
-
import routeConfigPlugin from './config/routing'
|
14
|
-
import vuetify from './config/vuetify'
|
15
|
-
|
16
|
-
Vue.use(apiResourcesPlugin)
|
17
|
-
Vue.use(hasOptionsPlugin)
|
18
|
-
Vue.use(translationPlugin)
|
19
|
-
|
20
|
-
Vue.config.productionTip = false
|
21
|
-
|
22
|
-
export async function bootstrap ({ apis, models, routing, authService, getTranslations, app, components }) {
|
23
|
-
appConfig.authService = authService
|
24
|
-
appConfig.app = app
|
25
|
-
appConfig.components = components
|
26
|
-
|
27
|
-
if (authService) {
|
28
|
-
const authenticated = await authService.authenticate()
|
29
|
-
if (!authenticated) {
|
30
|
-
return
|
31
|
-
}
|
32
|
-
Vue.use(authPlugin)
|
33
|
-
}
|
34
|
-
|
35
|
-
const splash = new Vue({
|
36
|
-
vuetify,
|
37
|
-
el: '#splash',
|
38
|
-
template: '<splash />',
|
39
|
-
components: {
|
40
|
-
Splash: components.Splash
|
41
|
-
}
|
42
|
-
})
|
43
|
-
|
44
|
-
if (authService) {
|
45
|
-
await authService.init()
|
46
|
-
}
|
47
|
-
|
48
|
-
apiResourcesPlugin.register(models, apis)
|
49
|
-
|
50
|
-
routing(routeConfigPlugin)
|
51
|
-
const router = await routeConfigPlugin.getRouter()
|
52
|
-
|
53
|
-
await apiResourcesPlugin.schemasLoaded()
|
54
|
-
|
55
|
-
if (getTranslations) {
|
56
|
-
const translations = await getTranslations(apiResourcesPlugin.apiResources)
|
57
|
-
translationPlugin.setTranslations(translations.models)
|
58
|
-
}
|
59
|
-
|
60
|
-
// routeConfigPlugin.dumpRoutes()
|
61
|
-
// routeConfigPlugin.dumbBreadcrumbs()
|
62
|
-
|
63
|
-
timeout(() => {
|
64
|
-
new Vue({
|
65
|
-
vuetify,
|
66
|
-
router,
|
67
|
-
el: '#app',
|
68
|
-
template: '<start :splash="splash" />',
|
69
|
-
data: {
|
70
|
-
splash
|
71
|
-
}
|
72
|
-
})
|
73
|
-
}, 300)
|
74
|
-
}
|