blob: 5815245506c1bcf5035dd084756f9df9e34fe583 (
plain)
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
|
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import { cacheConfig, resolvers } from '~/ci/catalog/graphql/settings';
import GlobalCatalog from './global_catalog.vue';
import CiResourcesPage from './components/pages/ci_resources_page.vue';
import { createRouter } from './router';
export const initCatalog = (selector = '#js-ci-cd-catalog') => {
const el = document.querySelector(selector);
if (!el) {
return null;
}
const { dataset } = el;
const { ciCatalogPath } = dataset;
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(resolvers, cacheConfig),
});
return new Vue({
el,
name: 'GlobalCatalog',
router: createRouter(ciCatalogPath, CiResourcesPage),
apolloProvider,
provide: {
ciCatalogPath,
},
render(h) {
return h(GlobalCatalog);
},
});
};
|