2021-12-07 10:15:03 -05:00
|
|
|
import { GlToast } from '@gitlab/ui';
|
2021-10-29 20:10:32 -04:00
|
|
|
import Vue from 'vue';
|
2021-11-15 16:14:31 -05:00
|
|
|
import VueApollo from 'vue-apollo';
|
2021-12-03 07:10:23 -05:00
|
|
|
import VueRouter from 'vue-router';
|
2021-11-15 16:14:31 -05:00
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2022-08-16 11:09:45 -04:00
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
2021-10-29 20:10:32 -04:00
|
|
|
import CrmContactsRoot from './components/contacts_root.vue';
|
2021-12-15 19:15:50 -05:00
|
|
|
import routes from './routes';
|
2021-10-29 20:10:32 -04:00
|
|
|
|
2021-11-15 16:14:31 -05:00
|
|
|
Vue.use(VueApollo);
|
2021-12-03 07:10:23 -05:00
|
|
|
Vue.use(VueRouter);
|
2021-12-07 10:15:03 -05:00
|
|
|
Vue.use(GlToast);
|
2021-11-15 16:14:31 -05:00
|
|
|
|
2021-10-29 20:10:32 -04:00
|
|
|
export default () => {
|
|
|
|
const el = document.getElementById('js-crm-contacts-app');
|
|
|
|
|
2021-11-15 16:14:31 -05:00
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(),
|
|
|
|
});
|
|
|
|
|
2021-10-29 20:10:32 -04:00
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-08-16 11:09:45 -04:00
|
|
|
const {
|
|
|
|
basePath,
|
|
|
|
groupFullPath,
|
|
|
|
groupIssuesPath,
|
|
|
|
canAdminCrmContact,
|
|
|
|
groupId,
|
|
|
|
textQuery,
|
|
|
|
} = el.dataset;
|
2021-12-03 07:10:23 -05:00
|
|
|
|
|
|
|
const router = new VueRouter({
|
|
|
|
base: basePath,
|
|
|
|
mode: 'history',
|
2021-12-15 19:15:50 -05:00
|
|
|
routes,
|
2021-12-03 07:10:23 -05:00
|
|
|
});
|
2021-12-03 01:10:53 -05:00
|
|
|
|
2021-10-29 20:10:32 -04:00
|
|
|
return new Vue({
|
|
|
|
el,
|
2021-12-03 07:10:23 -05:00
|
|
|
router,
|
2021-11-15 16:14:31 -05:00
|
|
|
apolloProvider,
|
2022-08-16 11:09:45 -04:00
|
|
|
provide: {
|
|
|
|
groupFullPath,
|
|
|
|
groupIssuesPath,
|
|
|
|
canAdminCrmContact: parseBoolean(canAdminCrmContact),
|
|
|
|
groupId,
|
|
|
|
textQuery,
|
|
|
|
},
|
2021-10-29 20:10:32 -04:00
|
|
|
render(createElement) {
|
|
|
|
return createElement(CrmContactsRoot);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|