Commit e658ca96 authored by Clement Ho's avatar Clement Ho

Add initPipelineDetails to pipelines build path

parent eb08e1d1
...@@ -14,10 +14,10 @@ import CycleAnalyticsStore from './cycle_analytics_store'; ...@@ -14,10 +14,10 @@ import CycleAnalyticsStore from './cycle_analytics_store';
Vue.use(Translate); Vue.use(Translate);
document.addEventListener('DOMContentLoaded', () => { $(() => {
const OVERVIEW_DIALOG_COOKIE = 'cycle_analytics_help_dismissed'; const OVERVIEW_DIALOG_COOKIE = 'cycle_analytics_help_dismissed';
const cycleAnalyticsApp = new Vue({ gl.cycleAnalyticsApp = new Vue({
el: '#cycle-analytics', el: '#cycle-analytics',
name: 'CycleAnalytics', name: 'CycleAnalytics',
components: { components: {
......
import initPipelineDetails from '~/pipelines/pipeline_details_bundle';
import initPipelines from '../init_pipelines'; import initPipelines from '../init_pipelines';
document.addEventListener('DOMContentLoaded', initPipelines); document.addEventListener('DOMContentLoaded', () => {
initPipelines();
initPipelineDetails();
});
import initPipelineDetails from '~/pipelines/pipeline_details_bundle';
import Vue from 'vue';
import { __ } from '~/locale';
import Flash from '~/flash';
import PipelinesMediator from '~/pipelines/pipeline_details_mediator';
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'; import initPipelines from '../init_pipelines';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const dataset = document.querySelector('.js-pipeline-details-vue').dataset;
const mediator = new PipelinesMediator({ endpoint: dataset.endpoint });
mediator.fetchPipeline();
initPipelines(); initPipelines();
initPipelineDetails();
// 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,
},
});
},
});
}); });
...@@ -9,65 +9,71 @@ import eventHub from './event_hub'; ...@@ -9,65 +9,71 @@ import eventHub from './event_hub';
Vue.use(Translate); Vue.use(Translate);
document.addEventListener('DOMContentLoaded', () => { export default () => {
const dataset = document.querySelector('.js-pipeline-details-vue').dataset; const dataset = document.querySelector('.js-pipeline-details-vue').dataset;
const mediator = new PipelinesMediator({ endpoint: dataset.endpoint }); const mediator = new PipelinesMediator({ endpoint: dataset.endpoint });
mediator.fetchPipeline(); mediator.fetchPipeline();
// eslint-disable-next-line const pipelineGraphEl = document.querySelector('#js-pipeline-graph-vue');
new Vue({ if (pipelineGraphEl) {
el: '#js-pipeline-graph-vue', // eslint-disable-next-line
components: { new Vue({
pipelineGraph, el: pipelineGraphEl,
}, components: {
data() { pipelineGraph,
return { },
mediator, data() {
}; return {
}, mediator,
render(createElement) { };
return createElement('pipeline-graph', { },
props: { render(createElement) {
isLoading: this.mediator.state.isLoading, return createElement('pipeline-graph', {
pipeline: this.mediator.store.state.pipeline, props: {
}, isLoading: this.mediator.state.isLoading,
}); pipeline: this.mediator.store.state.pipeline,
}, },
}); });
},
});
}
// eslint-disable-next-line const pipelineHeaderEl = document.querySelector('#js-pipeline-header-vue');
new Vue({ if (pipelineHeaderEl) {
el: '#js-pipeline-header-vue', // eslint-disable-next-line
components: { new Vue({
pipelineHeader, el: pipelineHeaderEl,
}, components: {
data() { pipelineHeader,
return { },
mediator, 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(() => Flash(__('An error occurred while making the request.')));
}, },
}, created() {
render(createElement) { eventHub.$on('headerPostAction', this.postAction);
return createElement('pipeline-header', { },
props: { beforeDestroy() {
isLoading: this.mediator.state.isLoading, eventHub.$off('headerPostAction', this.postAction);
pipeline: this.mediator.store.state.pipeline, },
methods: {
postAction(action) {
this.mediator.service.postAction(action.path)
.then(() => this.mediator.refreshPipeline())
.catch(() => 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,
},
});
},
});
}
};
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