summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects/settings/branch_rules/mount_branch_rules.js
blob: 89cfb1e1c8ec67c151d1d99c890d1b0b2562134d (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
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import View from './components/view/index.vue';

export default function mountBranchRules(el) {
  if (!el) {
    return null;
  }

  Vue.use(VueApollo);

  const apolloProvider = new VueApollo({
    defaultClient: createDefaultClient(),
  });

  const { projectPath, protectedBranchesPath, approvalRulesPath, statusChecksPath } = el.dataset;

  return new Vue({
    el,
    apolloProvider,
    provide: {
      projectPath,
      protectedBranchesPath,
      approvalRulesPath,
      statusChecksPath,
    },
    render(h) {
      return h(View);
    },
  });
}