summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipeline_new/index.js
blob: ff4f677654e7538e10e3b0415c5bc1c08c94efab (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
38
39
40
import Vue from 'vue';
import PipelineNewForm from './components/pipeline_new_form.vue';

export default () => {
  const el = document.getElementById('js-new-pipeline');
  const {
    projectId,
    pipelinesPath,
    configVariablesPath,
    refParam,
    varParam,
    fileParam,
    refNames,
    settingsLink,
    maxWarnings,
  } = el?.dataset;

  const variableParams = JSON.parse(varParam);
  const fileParams = JSON.parse(fileParam);
  const refs = JSON.parse(refNames);

  return new Vue({
    el,
    render(createElement) {
      return createElement(PipelineNewForm, {
        props: {
          projectId,
          pipelinesPath,
          configVariablesPath,
          refParam,
          variableParams,
          fileParams,
          refs,
          settingsLink,
          maxWarnings: Number(maxWarnings),
        },
      });
    },
  });
};