2017-05-26 06:56:54 -04:00
|
|
|
import Vue from 'vue';
|
2018-02-16 07:07:04 -05:00
|
|
|
import Flash from '~/flash';
|
|
|
|
import Translate from '~/vue_shared/translate';
|
|
|
|
import { __ } from '~/locale';
|
2019-03-14 07:22:34 -04:00
|
|
|
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-02-16 07:07:04 -05:00
|
|
|
import PipelinesMediator from './pipeline_details_mediator';
|
2017-06-02 09:24:42 -04:00
|
|
|
import pipelineHeader from './components/header_component.vue';
|
|
|
|
import eventHub from './event_hub';
|
2017-05-26 06:56:54 -04:00
|
|
|
|
2018-02-16 07:07:04 -05:00
|
|
|
Vue.use(Translate);
|
|
|
|
|
2018-02-27 17:17:19 -05:00
|
|
|
export default () => {
|
2018-06-16 17:50:13 -04:00
|
|
|
const { dataset } = document.querySelector('.js-pipeline-details-vue');
|
2017-05-26 06:56:54 -04:00
|
|
|
|
|
|
|
const mediator = new PipelinesMediator({ endpoint: dataset.endpoint });
|
|
|
|
|
|
|
|
mediator.fetchPipeline();
|
|
|
|
|
2018-02-27 17:28:17 -05:00
|
|
|
// eslint-disable-next-line
|
|
|
|
new Vue({
|
|
|
|
el: '#js-pipeline-graph-vue',
|
|
|
|
components: {
|
|
|
|
pipelineGraph,
|
|
|
|
},
|
2019-03-14 07:22:34 -04:00
|
|
|
mixins: [GraphEEMixin],
|
2018-02-27 17:28:17 -05:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
mediator,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('pipeline-graph', {
|
|
|
|
props: {
|
|
|
|
isLoading: this.mediator.state.isLoading,
|
|
|
|
pipeline: this.mediator.store.state.pipeline,
|
2019-04-25 08:37:15 -04:00
|
|
|
mediator: this.mediator,
|
2018-05-15 11:55:07 -04:00
|
|
|
},
|
|
|
|
on: {
|
|
|
|
refreshPipelineGraph: this.requestRefreshPipelineGraph,
|
2019-03-14 07:22:34 -04:00
|
|
|
onClickTriggeredBy: (parentPipeline, pipeline) =>
|
|
|
|
this.clickTriggeredByPipeline(parentPipeline, pipeline),
|
|
|
|
onClickTriggered: (parentPipeline, pipeline) =>
|
|
|
|
this.clickTriggeredPipeline(parentPipeline, pipeline),
|
2018-02-27 17:28:17 -05:00
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
2017-05-26 06:56:54 -04:00
|
|
|
|
2018-02-27 17:28:17 -05:00
|
|
|
// eslint-disable-next-line
|
|
|
|
new Vue({
|
|
|
|
el: '#js-pipeline-header-vue',
|
|
|
|
components: {
|
|
|
|
pipelineHeader,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
mediator,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
eventHub.$on('headerPostAction', this.postAction);
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
eventHub.$off('headerPostAction', this.postAction);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
postAction(action) {
|
2018-04-20 10:43:58 -04:00
|
|
|
this.mediator.service
|
|
|
|
.postAction(action.path)
|
2018-02-27 17:28:17 -05:00
|
|
|
.then(() => this.mediator.refreshPipeline())
|
|
|
|
.catch(() => Flash(__('An error occurred while making the request.')));
|
2017-06-02 09:24:42 -04:00
|
|
|
},
|
2018-02-27 17:28:17 -05:00
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('pipeline-header', {
|
|
|
|
props: {
|
|
|
|
isLoading: this.mediator.state.isLoading,
|
|
|
|
pipeline: this.mediator.store.state.pipeline,
|
2017-06-02 09:24:42 -04:00
|
|
|
},
|
2018-02-27 17:28:17 -05:00
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
2018-02-27 17:17:19 -05:00
|
|
|
};
|