summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/packages_and_registries/dependency_proxy/index.js
blob: 74444d2c7ec7ce678eb4b1d499253440e22280c3 (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
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import app from '~/packages_and_registries/dependency_proxy/app.vue';
import { apolloProvider } from '~/packages_and_registries/dependency_proxy/graphql';
import Translate from '~/vue_shared/translate';

Vue.use(Translate);

export const initDependencyProxyApp = () => {
  const el = document.getElementById('js-dependency-proxy');
  if (!el) {
    return null;
  }
  const { groupPath, groupId, noManifestsIllustration, canClearCache, settingsPath } = el.dataset;
  return new Vue({
    el,
    apolloProvider,
    provide: {
      groupPath,
      groupId,
      noManifestsIllustration,
      canClearCache: parseBoolean(canClearCache),
      settingsPath,
    },
    render(createElement) {
      return createElement(app);
    },
  });
};