diff options
Diffstat (limited to 'app/assets/javascripts/ci/pipeline_new/index.js')
-rw-r--r-- | app/assets/javascripts/ci/pipeline_new/index.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/app/assets/javascripts/ci/pipeline_new/index.js b/app/assets/javascripts/ci/pipeline_new/index.js new file mode 100644 index 00000000000..71c76aeab36 --- /dev/null +++ b/app/assets/javascripts/ci/pipeline_new/index.js @@ -0,0 +1,61 @@ +import Vue from 'vue'; +import VueApollo from 'vue-apollo'; +import createDefaultClient from '~/lib/graphql'; +import PipelineNewForm from './components/pipeline_new_form.vue'; +import { resolvers } from './graphql/resolvers'; + +const mountPipelineNewForm = (el) => { + const { + // provide/inject + projectRefsEndpoint, + + // props + defaultBranch, + fileParam, + maxWarnings, + pipelinesPath, + projectId, + projectPath, + refParam, + settingsLink, + varParam, + } = el.dataset; + + const variableParams = JSON.parse(varParam); + const fileParams = JSON.parse(fileParam); + + Vue.use(VueApollo); + + const apolloProvider = new VueApollo({ + defaultClient: createDefaultClient(resolvers), + }); + + return new Vue({ + el, + apolloProvider, + provide: { + projectRefsEndpoint, + }, + render(createElement) { + return createElement(PipelineNewForm, { + props: { + defaultBranch, + fileParams, + maxWarnings: Number(maxWarnings), + pipelinesPath, + projectId, + projectPath, + refParam, + settingsLink, + variableParams, + }, + }); + }, + }); +}; + +export default () => { + const el = document.getElementById('js-new-pipeline'); + + mountPipelineNewForm(el); +}; |