blob: 330d343b776e25d5acc82c62c6adbc4743d8d44c (
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 { parseRailsFormFields } from '~/lib/utils/forms';
import { parseBoolean } from '~/lib/utils/common_utils';
import GroupNameAndPath from './components/group_name_and_path.vue';
Vue.use(VueApollo);
export const initGroupNameAndPath = () => {
const elements = document.querySelectorAll('.js-group-name-and-path');
if (!elements.length) {
return;
}
elements.forEach((element) => {
const fields = parseRailsFormFields(element);
const { basePath, newSubgroup, mattermostEnabled } = element.dataset;
return new Vue({
el: element,
apolloProvider: new VueApollo({
defaultClient: createDefaultClient(),
}),
provide: {
fields,
basePath,
newSubgroup: parseBoolean(newSubgroup),
mattermostEnabled: parseBoolean(mattermostEnabled),
},
render(h) {
return h(GroupNameAndPath);
},
});
});
};
|