2017-09-10 17:25:29 +05:30
|
|
|
import Vue from 'vue';
|
2018-03-27 19:54:05 +05:30
|
|
|
import Flash from '~/flash';
|
|
|
|
import Translate from '~/vue_shared/translate';
|
|
|
|
import { __ } from '~/locale';
|
2019-07-07 11:18:12 +05:30
|
|
|
import pipelineGraph from 'ee_else_ce/pipelines/components/graph/graph_component.vue';
|
|
|
|
import GraphEEMixin from 'ee_else_ce/pipelines/mixins/graph_pipeline_bundle_mixin';
|
2018-03-27 19:54:05 +05:30
|
|
|
import PipelinesMediator from './pipeline_details_mediator';
|
2017-09-10 17:25:29 +05:30
|
|
|
import pipelineHeader from './components/header_component.vue';
|
|
|
|
import eventHub from './event_hub';
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
Vue.use(Translate);
|
|
|
|
|
|
|
|
export default () => {
|
2018-11-08 19:23:39 +05:30
|
|
|
const { dataset } = document.querySelector('.js-pipeline-details-vue');
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
const mediator = new PipelinesMediator({ endpoint: dataset.endpoint });
|
|
|
|
|
|
|
|
mediator.fetchPipeline();
|
|
|
|
|
|
|
|
// eslint-disable-next-line
|
|
|
|
new Vue({
|
|
|
|
el: '#js-pipeline-graph-vue',
|
2018-03-17 18:26:18 +05:30
|
|
|
components: {
|
|
|
|
pipelineGraph,
|
|
|
|
},
|
2019-07-07 11:18:12 +05:30
|
|
|
mixins: [GraphEEMixin],
|
2017-09-10 17:25:29 +05:30
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
mediator,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('pipeline-graph', {
|
|
|
|
props: {
|
|
|
|
isLoading: this.mediator.state.isLoading,
|
|
|
|
pipeline: this.mediator.store.state.pipeline,
|
2019-07-07 11:18:12 +05:30
|
|
|
mediator: this.mediator,
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
|
|
|
on: {
|
|
|
|
refreshPipelineGraph: this.requestRefreshPipelineGraph,
|
2019-07-07 11:18:12 +05:30
|
|
|
onClickTriggeredBy: (parentPipeline, pipeline) =>
|
|
|
|
this.clickTriggeredByPipeline(parentPipeline, pipeline),
|
|
|
|
onClickTriggered: (parentPipeline, pipeline) =>
|
|
|
|
this.clickTriggeredPipeline(parentPipeline, pipeline),
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
// eslint-disable-next-line
|
|
|
|
new Vue({
|
|
|
|
el: '#js-pipeline-header-vue',
|
2018-03-17 18:26:18 +05:30
|
|
|
components: {
|
|
|
|
pipelineHeader,
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
mediator,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
eventHub.$on('headerPostAction', this.postAction);
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
eventHub.$off('headerPostAction', this.postAction);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
postAction(action) {
|
2018-10-15 14:42:47 +05:30
|
|
|
this.mediator.service
|
|
|
|
.postAction(action.path)
|
2017-09-10 17:25:29 +05:30
|
|
|
.then(() => this.mediator.refreshPipeline())
|
2018-03-27 19:54:05 +05:30
|
|
|
.catch(() => Flash(__('An error occurred while making the request.')));
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('pipeline-header', {
|
|
|
|
props: {
|
|
|
|
isLoading: this.mediator.state.isLoading,
|
|
|
|
pipeline: this.mediator.store.state.pipeline,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
2018-03-27 19:54:05 +05:30
|
|
|
};
|