-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
131 lines (109 loc) · 4.34 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.common with an alias.
import Vue from 'vue';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import App from './app.vue';
import Vue2Filters from 'vue2-filters';
import router from './router';
import * as config from './shared/config/config';
import * as bootstrapVueConfig from './shared/config/config-bootstrap-vue';
import JhiItemCountComponent from './shared/jhi-item-count.vue';
import JhiSortIndicatorComponent from './shared/sort/jhi-sort-indicator.vue';
import InfiniteLoading from 'vue-infinite-loading';
import AuditsService from './admin/audits/audits.service';
import HealthService from './admin/health/health.service';
import MetricsService from './admin/metrics/metrics.service';
import LogsService from './admin/logs/logs.service';
import ActivateService from './account/activate/activate.service';
import RegisterService from './account/register/register.service';
import UserManagementService from '@/admin/user-management/user-management.service';
import LoginService from './account/login.service';
import AccountService from './account/account.service';
import '../content/scss/vendor.scss';
import AlertService from '@/shared/alert/alert.service';
import ConfigurationService from '@/admin/configuration/configuration.service';
// PrimeVue imports
import 'primevue/resources/themes/saga-blue/theme.css';
import 'primevue/resources/primevue.min.css';
import 'primeicons/primeicons.css';
import 'primeflex/primeflex.css';
// Bootstrap-Vue imports
import { BButton } from 'bootstrap-vue';
import { VBToggle } from 'bootstrap-vue';
import { BListGroup } from 'bootstrap-vue';
import { BListGroupItem } from 'bootstrap-vue';
import { BDropdown } from 'bootstrap-vue';
import { BDropdownItemButton } from 'bootstrap-vue';
import { BFormGroup } from 'bootstrap-vue';
import vClickOutside from 'v-click-outside';
import titleMixin from './mixins/titleMixin';
/* tslint:disable */
// jhipster-needle-add-entity-service-to-main-import - JHipster will import entities services here
/* tslint:enable */
Vue.config.productionTip = false;
config.initVueApp(Vue);
config.initFortAwesome(Vue);
bootstrapVueConfig.initBootstrapVue(Vue);
Vue.use(vClickOutside);
Vue.use(Vue2Filters);
Vue.component('font-awesome-icon', FontAwesomeIcon);
Vue.component('jhi-item-count', JhiItemCountComponent);
Vue.component('jhi-sort-indicator', JhiSortIndicatorComponent);
Vue.component('infinite-loading', InfiniteLoading);
// Bootstrap-Vue components
Vue.component('b-button', BButton);
Vue.component('b-list-group', BListGroup);
Vue.component('b-list-group-item', BListGroupItem);
Vue.component('b-dropdown', BDropdown);
Vue.component('b-dropdown-item-button', BDropdownItemButton);
Vue.component('b-form-group', BFormGroup);
Vue.mixin(titleMixin);
// Note: Vue automatically prefixes the directive name with 'v-'
Vue.directive('b-toggle', VBToggle);
const store = config.initVueXStore(Vue);
const alertService = new AlertService(store);
const loginService = new LoginService();
const accountService = new AccountService(store, router);
router.beforeEach((to, from, next) => {
if (!to.matched.length) {
next('/not-found');
}
if (to.meta && to.meta.authorities && to.meta.authorities.length > 0) {
accountService.hasAnyAuthorityAndCheckAuth(to.meta.authorities).then(value => {
if (!value) {
sessionStorage.setItem('requested-url', to.fullPath);
next('/forbidden');
} else {
next();
}
});
} else {
// no authorities, so just proceed
next();
}
});
/* tslint:disable */
new Vue({
el: '#app',
components: { App },
template: '<App/>',
router,
provide: {
loginService: () => loginService,
activateService: () => new ActivateService(),
registerService: () => new RegisterService(),
userService: () => new UserManagementService(),
auditsService: () => new AuditsService(),
healthService: () => new HealthService(),
configurationService: () => new ConfigurationService(),
logsService: () => new LogsService(),
metricsService: () => new MetricsService(),
alertService: () => alertService,
// jhipster-needle-add-entity-service-to-main - JHipster will import entities services here
accountService: () => accountService,
},
store,
data: {
noUnderscore: false,
},
});