debian-mirror-gitlab/app/assets/javascripts/pipeline_new/index.js

47 lines
1 KiB
JavaScript
Raw Normal View History

2020-10-24 23:57:45 +05:30
import Vue from 'vue';
import PipelineNewForm from './components/pipeline_new_form.vue';
2021-02-22 17:27:13 +05:30
import formatRefs from './utils/format_refs';
2020-10-24 23:57:45 +05:30
export default () => {
const el = document.getElementById('js-new-pipeline');
const {
projectId,
pipelinesPath,
2021-01-03 14:25:43 +05:30
configVariablesPath,
2021-02-22 17:27:13 +05:30
defaultBranch,
2020-10-24 23:57:45 +05:30
refParam,
varParam,
fileParam,
2021-02-22 17:27:13 +05:30
branchRefs,
tagRefs,
2020-10-24 23:57:45 +05:30
settingsLink,
2020-11-24 15:15:51 +05:30
maxWarnings,
2020-10-24 23:57:45 +05:30
} = el?.dataset;
const variableParams = JSON.parse(varParam);
const fileParams = JSON.parse(fileParam);
2021-02-22 17:27:13 +05:30
const branches = formatRefs(JSON.parse(branchRefs), 'branch');
const tags = formatRefs(JSON.parse(tagRefs), 'tag');
2020-10-24 23:57:45 +05:30
return new Vue({
el,
render(createElement) {
return createElement(PipelineNewForm, {
props: {
projectId,
pipelinesPath,
2021-01-03 14:25:43 +05:30
configVariablesPath,
2021-02-22 17:27:13 +05:30
defaultBranch,
2020-10-24 23:57:45 +05:30
refParam,
variableParams,
fileParams,
2021-02-22 17:27:13 +05:30
branches,
tags,
2020-10-24 23:57:45 +05:30
settingsLink,
2020-11-24 15:15:51 +05:30
maxWarnings: Number(maxWarnings),
2020-10-24 23:57:45 +05:30
},
});
},
});
};