summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/commit/pipelines/pipelines_table.js.es6
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/commit/pipelines/pipelines_table.js.es6')
-rw-r--r--app/assets/javascripts/commit/pipelines/pipelines_table.js.es621
1 files changed, 12 insertions, 9 deletions
diff --git a/app/assets/javascripts/commit/pipelines/pipelines_table.js.es6 b/app/assets/javascripts/commit/pipelines/pipelines_table.js.es6
index ce0dbd4d56b..e7c6c063413 100644
--- a/app/assets/javascripts/commit/pipelines/pipelines_table.js.es6
+++ b/app/assets/javascripts/commit/pipelines/pipelines_table.js.es6
@@ -6,9 +6,8 @@ window.Vue.use(require('vue-resource'));
require('../../lib/utils/common_utils');
require('../../vue_shared/vue_resource_interceptor');
require('../../vue_shared/components/pipelines_table');
-require('../../vue_realtime_listener/index');
require('./pipelines_service');
-require('./pipelines_store');
+const PipelineStore = require('./pipelines_store');
/**
*
@@ -41,7 +40,7 @@ require('./pipelines_store');
data() {
const pipelinesTableData = document.querySelector('#commit-pipeline-table-view').dataset;
const svgsData = document.querySelector('.pipeline-svgs').dataset;
- const store = new gl.commits.pipelines.PipelinesStore();
+ const store = new PipelineStore();
// Transform svgs DOMStringMap to a plain Object.
const svgsObject = gl.utils.DOMStringMapToObject(svgsData);
@@ -56,15 +55,14 @@ require('./pipelines_store');
},
/**
- * When the component is created the service to fetch the data will be
- * initialized with the correct endpoint.
+ * When the component is about to be mounted, tell the service to fetch the data
*
* A request to fetch the pipelines will be made.
* In case of a successfull response we will store the data in the provided
* store, in case of a failed response we need to warn the user.
*
*/
- created() {
+ beforeMount() {
const pipelinesService = new gl.commits.pipelines.PipelinesService(this.endpoint);
this.isLoading = true;
@@ -72,7 +70,6 @@ require('./pipelines_store');
.then(response => response.json())
.then((json) => {
this.store.storePipelines(json);
- this.store.startTimeAgoLoops.call(this, Vue);
this.isLoading = false;
})
.catch(() => {
@@ -81,9 +78,15 @@ require('./pipelines_store');
});
},
+ beforeUpdate() {
+ if (this.state.pipelines.length && this.$children) {
+ PipelineStore.startTimeAgoLoops.call(this, Vue);
+ }
+ },
+
template: `
- <div>
- <div class="pipelines realtime-loading" v-if="isLoading">
+ <div class="pipelines">
+ <div class="realtime-loading" v-if="isLoading">
<i class="fa fa-spinner fa-spin"></i>
</div>