debian-mirror-gitlab/app/assets/javascripts/crm/contacts/bundle.js

56 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-01-26 12:08:38 +05:30
import { GlToast } from '@gitlab/ui';
2021-12-11 22:18:48 +05:30
import Vue from 'vue';
import VueApollo from 'vue-apollo';
2022-01-26 12:08:38 +05:30
import VueRouter from 'vue-router';
2021-12-11 22:18:48 +05:30
import createDefaultClient from '~/lib/graphql';
2022-08-27 11:52:29 +05:30
import { parseBoolean } from '~/lib/utils/common_utils';
2021-12-11 22:18:48 +05:30
import CrmContactsRoot from './components/contacts_root.vue';
2022-01-26 12:08:38 +05:30
import routes from './routes';
2021-12-11 22:18:48 +05:30
Vue.use(VueApollo);
2022-01-26 12:08:38 +05:30
Vue.use(VueRouter);
Vue.use(GlToast);
2021-12-11 22:18:48 +05:30
export default () => {
const el = document.getElementById('js-crm-contacts-app');
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
if (!el) {
return false;
}
2022-08-27 11:52:29 +05:30
const {
basePath,
groupFullPath,
groupIssuesPath,
canAdminCrmContact,
groupId,
textQuery,
} = el.dataset;
2022-01-26 12:08:38 +05:30
const router = new VueRouter({
base: basePath,
mode: 'history',
routes,
});
2021-12-11 22:18:48 +05:30
return new Vue({
el,
2022-01-26 12:08:38 +05:30
router,
2021-12-11 22:18:48 +05:30
apolloProvider,
2022-08-27 11:52:29 +05:30
provide: {
groupFullPath,
groupIssuesPath,
canAdminCrmContact: parseBoolean(canAdminCrmContact),
groupId,
textQuery,
},
2021-12-11 22:18:48 +05:30
render(createElement) {
return createElement(CrmContactsRoot);
},
});
};