Commit 958c0a2c authored by Jacob Schatz's avatar Jacob Schatz

Refactor pipelines show for webpack bundle tag removal

parent 296a4e68
import Vue from 'vue';
import Flash from '../../../../flash';
import PipelinesMediator from '../../../../pipelines/pipeline_details_mediatior';
import pipelineGraph from '../../../../pipelines/components/graph/graph_component.vue';
import pipelineHeader from '../../../../pipelines/components/header_component.vue';
import eventHub from '../../../../pipelines/event_hub';
import initPipelines from '../init_pipelines';
document.addEventListener('DOMContentLoaded', initPipelines);
document.addEventListener('DOMContentLoaded', () => {
const dataset = document.querySelector('.js-pipeline-details-vue').dataset;
const mediator = new PipelinesMediator({ endpoint: dataset.endpoint });
mediator.fetchPipeline();
initPipelines();
// eslint-disable-next-line
new Vue({
el: '#js-pipeline-graph-vue',
components: {
pipelineGraph,
},
data() {
return {
mediator,
};
},
render(createElement) {
return createElement('pipeline-graph', {
props: {
isLoading: this.mediator.state.isLoading,
pipeline: this.mediator.store.state.pipeline,
},
});
},
});
// 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) {
this.mediator.service.postAction(action.path)
.then(() => this.mediator.refreshPipeline())
.catch(() => new Flash('An error occurred while making the request.'));
},
},
render(createElement) {
return createElement('pipeline-header', {
props: {
isLoading: this.mediator.state.isLoading,
pipeline: this.mediator.store.state.pipeline,
},
});
},
});
});
......@@ -13,4 +13,3 @@
- content_for :page_specific_javascripts do
= webpack_bundle_tag('common_vue')
= webpack_bundle_tag('pipelines_details')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment