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