@afeefa/vue-app 0.0.108 → 0.0.110
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/.afeefa/package/release/version.txt +1 -1
- package/package.json +1 -1
- package/src/components/AModal.vue +6 -5
- package/src-admin/bootstrap.js +17 -10
- package/src-admin/components/App.vue +9 -8
- package/src-admin/components/routes/DataRouteMixin.js +2 -2
- package/src-admin/plugins/AuthPlugin.js +21 -0
- package/src-admin/plugins/translation/HasRightsPlugin.js +0 -15
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.110
|
package/package.json
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
<template #activator="{ on }">
|
15
15
|
<div
|
16
16
|
style="width: max-content;"
|
17
|
-
:class="
|
17
|
+
:class="activatorClass"
|
18
18
|
v-on="on"
|
19
19
|
>
|
20
20
|
<slot name="activator" />
|
@@ -56,7 +56,7 @@ import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
|
|
56
56
|
import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
|
57
57
|
|
58
58
|
@Component({
|
59
|
-
props: ['show', 'icon', 'title', 'beforeClose', '
|
59
|
+
props: ['show', 'icon', 'title', 'beforeClose', 'anchorPosition', 'screenCentered']
|
60
60
|
})
|
61
61
|
export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentWidthMixin, CancelOnEscMixin) {
|
62
62
|
modalId = randomCssClass(10)
|
@@ -121,7 +121,9 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentW
|
|
121
121
|
@Watch('modal')
|
122
122
|
modalChanged () {
|
123
123
|
if (this.modal) {
|
124
|
-
this.
|
124
|
+
if (!this.screenCentered) {
|
125
|
+
this.setPosition()
|
126
|
+
}
|
125
127
|
} else {
|
126
128
|
this.removeTransientAnchor()
|
127
129
|
}
|
@@ -204,13 +206,12 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentW
|
|
204
206
|
|
205
207
|
:deep(.v-dialog) {
|
206
208
|
position: absolute;
|
207
|
-
top: 0;
|
208
|
-
left: 0;
|
209
209
|
margin: 0;
|
210
210
|
|
211
211
|
transition: none;
|
212
212
|
|
213
213
|
&.v-fade-transition {
|
214
|
+
|
214
215
|
&-enter-active, &-leave, &-leave-to {
|
215
216
|
transition: opacity .3s ease;
|
216
217
|
}
|
package/src-admin/bootstrap.js
CHANGED
@@ -2,7 +2,7 @@ import './config/event-bus'
|
|
2
2
|
import './config/components'
|
3
3
|
import './directives'
|
4
4
|
|
5
|
-
import {
|
5
|
+
import { authPlugin } from '@a-admin/plugins/AuthPlugin'
|
6
6
|
import { translationPlugin } from '@a-admin/plugins/translation/TranslationPlugin'
|
7
7
|
import { apiResourcesPlugin } from '@a-vue/plugins/api-resources/ApiResourcesPlugin'
|
8
8
|
import { hasOptionsPlugin } from '@a-vue/plugins/has-options/HasOptionsPlugin'
|
@@ -20,12 +20,18 @@ Vue.use(translationPlugin)
|
|
20
20
|
Vue.config.productionTip = false
|
21
21
|
|
22
22
|
export async function bootstrap ({ apis, models, routing, authService, getTranslations, app, components }) {
|
23
|
-
apiResourcesPlugin.register(models, apis)
|
24
|
-
|
25
23
|
appConfig.authService = authService
|
26
24
|
appConfig.app = app
|
27
25
|
appConfig.components = components
|
28
26
|
|
27
|
+
if (authService) {
|
28
|
+
const authenticated = await authService.authenticate()
|
29
|
+
if (!authenticated) {
|
30
|
+
return
|
31
|
+
}
|
32
|
+
Vue.use(authPlugin)
|
33
|
+
}
|
34
|
+
|
29
35
|
const splash = new Vue({
|
30
36
|
vuetify,
|
31
37
|
el: '#splash',
|
@@ -35,8 +41,15 @@ export async function bootstrap ({ apis, models, routing, authService, getTransl
|
|
35
41
|
}
|
36
42
|
})
|
37
43
|
|
44
|
+
if (authService) {
|
45
|
+
await authService.init()
|
46
|
+
}
|
47
|
+
|
48
|
+
apiResourcesPlugin.register(models, apis)
|
49
|
+
|
38
50
|
routing(routeConfigPlugin)
|
39
51
|
const router = await routeConfigPlugin.getRouter()
|
52
|
+
|
40
53
|
await apiResourcesPlugin.schemasLoaded()
|
41
54
|
|
42
55
|
if (getTranslations) {
|
@@ -44,12 +57,6 @@ export async function bootstrap ({ apis, models, routing, authService, getTransl
|
|
44
57
|
translationPlugin.setTranslations(translations.models)
|
45
58
|
}
|
46
59
|
|
47
|
-
if (authService) {
|
48
|
-
Vue.use(hasRightsPlugin)
|
49
|
-
|
50
|
-
authService.initApp(router)
|
51
|
-
}
|
52
|
-
|
53
60
|
// routeConfigPlugin.dumpRoutes()
|
54
61
|
// routeConfigPlugin.dumbBreadcrumbs()
|
55
62
|
|
@@ -63,5 +70,5 @@ export async function bootstrap ({ apis, models, routing, authService, getTransl
|
|
63
70
|
splash
|
64
71
|
}
|
65
72
|
})
|
66
|
-
},
|
73
|
+
}, 300)
|
67
74
|
}
|
@@ -143,16 +143,10 @@ import '../styles.scss'
|
|
143
143
|
export default class App extends Vue {
|
144
144
|
drawer = true
|
145
145
|
isLoading = false
|
146
|
-
account = null
|
147
146
|
|
148
147
|
created () {
|
149
148
|
this.$events.on(LoadingEvent.START_LOADING, this.startLoading)
|
150
149
|
this.$events.on(LoadingEvent.STOP_LOADING, this.stopLoading)
|
151
|
-
|
152
|
-
if (this.hasAuthService) {
|
153
|
-
this.account = appConfig.authService.getAccount()
|
154
|
-
}
|
155
|
-
|
156
150
|
this.$emit('appLoaded')
|
157
151
|
}
|
158
152
|
|
@@ -164,6 +158,13 @@ export default class App extends Vue {
|
|
164
158
|
return appConfig.app.logo
|
165
159
|
}
|
166
160
|
|
161
|
+
get account () {
|
162
|
+
if (this.hasAuthService) {
|
163
|
+
return this.$auth.account
|
164
|
+
}
|
165
|
+
return null
|
166
|
+
}
|
167
|
+
|
167
168
|
get title () {
|
168
169
|
return appConfig.app.title
|
169
170
|
}
|
@@ -189,11 +190,11 @@ export default class App extends Vue {
|
|
189
190
|
}
|
190
191
|
|
191
192
|
get hasAuthService () {
|
192
|
-
return !!
|
193
|
+
return !!this.$auth
|
193
194
|
}
|
194
195
|
|
195
196
|
logout () {
|
196
|
-
|
197
|
+
this.$auth.logout()
|
197
198
|
}
|
198
199
|
}
|
199
200
|
</script>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Component,
|
1
|
+
import { Component, Vue, Watch } from '@a-vue'
|
2
2
|
|
3
3
|
Component.registerHooks([
|
4
4
|
'beforeRouteEnter',
|
@@ -50,7 +50,7 @@ export class DataRouteMixin extends Vue {
|
|
50
50
|
|
51
51
|
// watches (if defined) route idKey and reloads data if changed
|
52
52
|
@Watch('drm_id')
|
53
|
-
async
|
53
|
+
async drm_routeParamsChanged () {
|
54
54
|
if (routerHookCalled) {
|
55
55
|
return
|
56
56
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { appConfig } from '../config/AppConfig'
|
2
|
+
|
3
|
+
class AuthPlugin {
|
4
|
+
install (Vue) {
|
5
|
+
const authService = appConfig.authService
|
6
|
+
const $auth = {
|
7
|
+
account: authService.getCurrentAccount(),
|
8
|
+
|
9
|
+
hasRight: name => authService.currentAccountHasRight(name),
|
10
|
+
|
11
|
+
hasRole: name => authService.currentAccountHasRole(name),
|
12
|
+
|
13
|
+
logout: () => authService.forwardToLogoutEndpoint()
|
14
|
+
}
|
15
|
+
|
16
|
+
Vue.prototype.$auth = $auth
|
17
|
+
Vue.$auth = $auth
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
export const authPlugin = new AuthPlugin()
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { authService } from '@k-vue/auth/AuthService'
|
2
|
-
|
3
|
-
class HasRightsPlugin {
|
4
|
-
install (Vue) {
|
5
|
-
Vue.mixin({
|
6
|
-
created () {
|
7
|
-
this.$hasRight = name => {
|
8
|
-
return authService.currentAccountHasRight(name)
|
9
|
-
}
|
10
|
-
}
|
11
|
-
})
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
export const hasRightsPlugin = new HasRightsPlugin()
|