summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/deploy_tokens/index.js
blob: 334c9930f4b63c3dc03c99449a4a7fad384bb657 (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
import Vue from 'vue';
import NewDeployToken from './components/new_deploy_token.vue';

export default function initDeployTokens() {
  const el = document.getElementById('js-new-deploy-token');

  if (el == null) return null;

  const {
    createNewTokenPath,
    deployTokensHelpUrl,
    containerRegistryEnabled,
    packagesRegistryEnabled,
    tokenType,
  } = el.dataset;
  return new Vue({
    el,
    components: {
      NewDeployToken,
    },
    render(createElement) {
      return createElement(NewDeployToken, {
        props: {
          createNewTokenPath,
          deployTokensHelpUrl,
          containerRegistryEnabled: containerRegistryEnabled !== undefined,
          packagesRegistryEnabled: packagesRegistryEnabled !== undefined,
          tokenType,
        },
      });
    },
  });
}