diff --git a/app/assets/javascripts/vue_pipelines_index/status.js.es6 b/app/assets/javascripts/vue_pipelines_index/status.js.es6 index 2080db97dacbbea0d8305f475e3d769dacab14e5..88fead9c6513b3f4dd3bea66dc668f86d7eed880 100644 --- a/app/assets/javascripts/vue_pipelines_index/status.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/status.js.es6 @@ -18,7 +18,7 @@ }, detailsPath() { const { status } = this.pipeline.details; - return status.path ? status.path : '#'; + return status.details_path ? status.details_path : '#'; }, }, template: ` diff --git a/app/assets/javascripts/vue_pipelines_index/store.js.es6 b/app/assets/javascripts/vue_pipelines_index/store.js.es6 index d7ae9255e9a0f8455b26c352b2b4343632f5a8dd..96d960f93c5b3633114de6a3e677f4ec3135ce49 100644 --- a/app/assets/javascripts/vue_pipelines_index/store.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/store.js.es6 @@ -1,6 +1,8 @@ /* global gl, Flash */ /* eslint-disable no-param-reassign, no-underscore-dangle */ +/*= require vue_realtime_listener/index.js */ + ((gl) => { const pageValues = headers => ({ perPage: +headers['X-Per-Page'], @@ -49,21 +51,10 @@ startTimeLoops(); - const removeTimeIntervals = () => clearInterval(this.timeLoopInterval); - const startIntervalLoops = () => startTimeLoops(); - - const removeAll = () => { - removeTimeIntervals(); - window.removeEventListener('beforeunload', removeTimeIntervals); - window.removeEventListener('focus', startIntervalLoops); - window.removeEventListener('blur', removeTimeIntervals); - document.removeEventListener('page:fetch', removeAll); - }; + const removeIntervals = () => clearInterval(this.timeLoopInterval); + const startIntervals = () => startTimeLoops(); - window.addEventListener('beforeunload', removeTimeIntervals); - window.addEventListener('focus', startIntervalLoops); - window.addEventListener('blur', removeTimeIntervals); - document.addEventListener('page:fetch', removeAll); + gl.VueRealtimeListener(removeIntervals, startIntervals); } }; })(window.gl || (window.gl = {})); diff --git a/app/assets/javascripts/vue_realtime_listener/index.js.es6 b/app/assets/javascripts/vue_realtime_listener/index.js.es6 new file mode 100644 index 0000000000000000000000000000000000000000..72404c6f015fd17d818c936b3fa7c1f8f29406c6 --- /dev/null +++ b/app/assets/javascripts/vue_realtime_listener/index.js.es6 @@ -0,0 +1,16 @@ +(() => { + gl.VueRealtimeListener = (removeIntervals, startIntervals) => { + const removeAll = () => { + removeIntervals(); + window.removeEventListener('beforeunload', removeIntervals); + window.removeEventListener('focus', startIntervals); + window.removeEventListener('blur', removeIntervals); + document.removeEventListener('page:fetch', removeAll); + }; + + window.addEventListener('beforeunload', removeIntervals); + window.addEventListener('focus', startIntervals); + window.addEventListener('blur', removeIntervals); + document.addEventListener('page:fetch', removeAll); + }; +})(window.gl || (window.gl = {}));