summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2018-02-14 15:39:59 -0500
committerJacob Schatz <jschatz@gitlab.com>2018-02-23 15:40:18 -0500
commit958c0a2c45d7b7e7c2fbb49feb59ff5c00fd2005 (patch)
tree917f4364b672f4c51b24f203e13464935e8ce97a
parent296a4e6825a3528917bb385123cdf62ae3d1944e (diff)
downloadgitlab-ce-958c0a2c45d7b7e7c2fbb49feb59ff5c00fd2005.tar.gz
Refactor pipelines show for webpack bundle tag removal
-rw-r--r--app/assets/javascripts/pages/projects/pipelines/show/index.js71
-rw-r--r--app/views/projects/pipelines/show.html.haml1
2 files changed, 70 insertions, 2 deletions
diff --git a/app/assets/javascripts/pages/projects/pipelines/show/index.js b/app/assets/javascripts/pages/projects/pipelines/show/index.js
index fbe9824c34b..c02c8631bb2 100644
--- a/app/assets/javascripts/pages/projects/pipelines/show/index.js
+++ b/app/assets/javascripts/pages/projects/pipelines/show/index.js
@@ -1,3 +1,72 @@
+
+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,
+ },
+ });
+ },
+ });
+});
diff --git a/app/views/projects/pipelines/show.html.haml b/app/views/projects/pipelines/show.html.haml
index 2174154b207..ffb0ae95f9b 100644
--- a/app/views/projects/pipelines/show.html.haml
+++ b/app/views/projects/pipelines/show.html.haml
@@ -13,4 +13,3 @@
- content_for :page_specific_javascripts do
= webpack_bundle_tag('common_vue')
- = webpack_bundle_tag('pipelines_details')