Remove unnecessary element checks

This commit is contained in:
Clement Ho 2018-02-27 16:28:17 -06:00
parent e658ca9665
commit c287c01821
1 changed files with 52 additions and 58 deletions

View File

@ -16,64 +16,58 @@ export default () => {
mediator.fetchPipeline(); mediator.fetchPipeline();
const pipelineGraphEl = document.querySelector('#js-pipeline-graph-vue'); // eslint-disable-next-line
if (pipelineGraphEl) { new Vue({
// eslint-disable-next-line el: '#js-pipeline-graph-vue',
new Vue({ components: {
el: pipelineGraphEl, pipelineGraph,
components: { },
pipelineGraph, data() {
}, return {
data() { mediator,
return { };
mediator, },
}; render(createElement) {
}, return createElement('pipeline-graph', {
render(createElement) { props: {
return createElement('pipeline-graph', { isLoading: this.mediator.state.isLoading,
props: { pipeline: this.mediator.store.state.pipeline,
isLoading: this.mediator.state.isLoading,
pipeline: this.mediator.store.state.pipeline,
},
});
},
});
}
const pipelineHeaderEl = document.querySelector('#js-pipeline-header-vue');
if (pipelineHeaderEl) {
// eslint-disable-next-line
new Vue({
el: pipelineHeaderEl,
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(() => Flash(__('An error occurred while making the request.')));
}, },
});
},
});
// 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(() => Flash(__('An error occurred while making the request.')));
}, },
render(createElement) { },
return createElement('pipeline-header', { render(createElement) {
props: { return createElement('pipeline-header', {
isLoading: this.mediator.state.isLoading, props: {
pipeline: this.mediator.store.state.pipeline, isLoading: this.mediator.state.isLoading,
}, pipeline: this.mediator.store.state.pipeline,
}); },
}, });
}); },
} });
}; };