2020-10-24 23:57:45 +05:30
|
|
|
import Vue from 'vue';
|
2022-11-25 23:54:43 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2020-10-24 23:57:45 +05:30
|
|
|
import PipelineNewForm from './components/pipeline_new_form.vue';
|
2022-11-25 23:54:43 +05:30
|
|
|
import { resolvers } from './graphql/resolvers';
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
const mountPipelineNewForm = (el) => {
|
|
|
|
const {
|
|
|
|
// provide/inject
|
|
|
|
projectRefsEndpoint,
|
|
|
|
|
|
|
|
// props
|
|
|
|
defaultBranch,
|
2020-10-24 23:57:45 +05:30
|
|
|
fileParam,
|
2020-11-24 15:15:51 +05:30
|
|
|
maxWarnings,
|
2022-10-11 01:57:18 +05:30
|
|
|
pipelinesPath,
|
2023-05-27 22:25:52 +05:30
|
|
|
pipelinesEditorPath,
|
|
|
|
canViewPipelineEditor,
|
2022-10-11 01:57:18 +05:30
|
|
|
projectId,
|
2022-11-25 23:54:43 +05:30
|
|
|
projectPath,
|
2022-10-11 01:57:18 +05:30
|
|
|
refParam,
|
|
|
|
settingsLink,
|
|
|
|
varParam,
|
2022-07-16 23:28:13 +05:30
|
|
|
} = el.dataset;
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
const variableParams = JSON.parse(varParam);
|
|
|
|
const fileParams = JSON.parse(fileParam);
|
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(resolvers),
|
|
|
|
});
|
2022-10-11 01:57:18 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
return new Vue({
|
|
|
|
el,
|
2022-11-25 23:54:43 +05:30
|
|
|
apolloProvider,
|
2021-04-17 20:07:23 +05:30
|
|
|
provide: {
|
|
|
|
projectRefsEndpoint,
|
|
|
|
},
|
2020-10-24 23:57:45 +05:30
|
|
|
render(createElement) {
|
|
|
|
return createElement(PipelineNewForm, {
|
|
|
|
props: {
|
2021-02-22 17:27:13 +05:30
|
|
|
defaultBranch,
|
2020-10-24 23:57:45 +05:30
|
|
|
fileParams,
|
2020-11-24 15:15:51 +05:30
|
|
|
maxWarnings: Number(maxWarnings),
|
2022-10-11 01:57:18 +05:30
|
|
|
pipelinesPath,
|
2023-05-27 22:25:52 +05:30
|
|
|
pipelinesEditorPath,
|
|
|
|
canViewPipelineEditor,
|
2022-10-11 01:57:18 +05:30
|
|
|
projectId,
|
2022-11-25 23:54:43 +05:30
|
|
|
projectPath,
|
2022-10-11 01:57:18 +05:30
|
|
|
refParam,
|
|
|
|
settingsLink,
|
|
|
|
variableParams,
|
2020-10-24 23:57:45 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
2022-10-11 01:57:18 +05:30
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const el = document.getElementById('js-new-pipeline');
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
mountPipelineNewForm(el);
|
2022-10-11 01:57:18 +05:30
|
|
|
};
|