@afeefa/vue-app 0.0.106 → 0.0.108
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.108
|
package/package.json
CHANGED
package/src-admin/bootstrap.js
CHANGED
@@ -2,6 +2,7 @@ import './config/event-bus'
|
|
2
2
|
import './config/components'
|
3
3
|
import './directives'
|
4
4
|
|
5
|
+
import { hasRightsPlugin } from '@a-admin/plugins/translation/HasRightsPlugin'
|
5
6
|
import { translationPlugin } from '@a-admin/plugins/translation/TranslationPlugin'
|
6
7
|
import { apiResourcesPlugin } from '@a-vue/plugins/api-resources/ApiResourcesPlugin'
|
7
8
|
import { hasOptionsPlugin } from '@a-vue/plugins/has-options/HasOptionsPlugin'
|
@@ -44,6 +45,8 @@ export async function bootstrap ({ apis, models, routing, authService, getTransl
|
|
44
45
|
}
|
45
46
|
|
46
47
|
if (authService) {
|
48
|
+
Vue.use(hasRightsPlugin)
|
49
|
+
|
47
50
|
authService.initApp(router)
|
48
51
|
}
|
49
52
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Component, Vue } from '@a-vue'
|
1
|
+
import { Component, Watch, Vue } from '@a-vue'
|
2
2
|
|
3
3
|
Component.registerHooks([
|
4
4
|
'beforeRouteEnter',
|
@@ -36,39 +36,36 @@ function load (route) {
|
|
36
36
|
|
37
37
|
@Component
|
38
38
|
export class DataRouteMixin extends Vue {
|
39
|
-
drm_isLoaded = false
|
40
|
-
|
41
39
|
async beforeRouteEnter (to, from, next) {
|
42
40
|
routerHookCalled = true
|
43
41
|
const result = await load(to)
|
44
|
-
|
45
42
|
next(vm => {
|
46
43
|
if (result !== false) {
|
47
44
|
vm.drm_onLoad(result)
|
48
|
-
vm.drm_isLoaded = true
|
49
45
|
}
|
50
46
|
routerHookCalled = false
|
51
47
|
})
|
52
48
|
}
|
53
49
|
|
54
|
-
/**
|
55
|
-
* triggered both, if route name or route params change
|
56
|
-
@Watch('$route.params')
|
57
|
-
async routeParamsChanged () {
|
58
|
-
if (routerHookCalled) {
|
59
|
-
return
|
60
|
-
}
|
61
50
|
|
62
|
-
|
63
|
-
|
51
|
+
// watches (if defined) route idKey and reloads data if changed
|
52
|
+
@Watch('drm_id')
|
53
|
+
async routeParamsChanged () {
|
54
|
+
if (routerHookCalled) {
|
55
|
+
return
|
56
|
+
}
|
57
|
+
|
58
|
+
const result = await load(this.$route)
|
59
|
+
|
60
|
+
if (result !== false) {
|
61
|
+
this.drm_onLoad(result)
|
62
|
+
}
|
63
|
+
}
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
}
|
70
|
-
}
|
71
|
-
*/
|
65
|
+
// return route config idKey
|
66
|
+
get drm_id () {
|
67
|
+
return this.$route.params[this.$routeDefinition.idKey]
|
68
|
+
}
|
72
69
|
|
73
70
|
drm_onLoad (result) {
|
74
71
|
onLoadCallback(this, result)
|
@@ -0,0 +1,15 @@
|
|
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()
|