提交 2b9a9e37 编写于 作者: R Regis

prep for testing - update all pipeline api response attributes

上级 fa1a99a1
/* global Vue, VueResource, gl */
/* eslint-disable no-bitwise*/
/* eslint-disable no-bitwise, no-plusplus*/
//= require vue-resource
......
......@@ -33,7 +33,7 @@
</a>
<ul class="dropdown-menu dropdown-menu-align-right">
<li v-for='action in pipeline.details.manual_actions'>
<a rel="nofollow" data-method="post" :href='action.url'>
<a rel="nofollow" data-method="post" :href='action.url' title="Manual build">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 11" class="icon-play">
<path
fill-rule="evenodd"
......@@ -83,7 +83,7 @@
<a
v-if='pipeline.cancel_url'
class="btn btn-remove has-tooltip"
title=""
title="Cancel"
rel="nofollow"
data-method="post"
:href='pipeline.cancel_url'
......
......@@ -28,6 +28,15 @@
gl.PipelineStore = class {
fetchDataLoop(Vue, pageNum, url) {
Vue.activeResources = 0;
const resourceChecker = () => {
if (Vue.activeResources === 0) {
Vue.activeResources = 1;
} else {
Vue.activeResources += 1;
}
};
const goFetch = () =>
this.$http.get(`${url}?page=${pageNum}`)
.then((response) => {
......@@ -36,6 +45,7 @@
Vue.set(this, 'pipelines', res.pipelines);
Vue.set(this, 'count', res.count);
this.pageRequest = false;
Vue.activeResources -= 1;
}, () => new Flash(
'Something went wrong on our end.'
));
......@@ -45,15 +55,22 @@
.then((response) => {
const res = JSON.parse(response.body);
const p = new PipelineUpdater(this.pipelines);
Vue.set(this, 'updatedAt', res.updated_at);
Vue.set(this, 'pipelines', p.updatePipelines(res));
Vue.set(this, 'count', res.count);
Vue.activeResources -= 1;
}, () => new Flash(
'Something went wrong on our end.'
));
resourceChecker();
goFetch();
this.intervalId = setInterval(() => {
if (this.updatedAt) goUpdate();
if (this.updatedAt) {
resourceChecker();
goUpdate();
}
}, 3000);
window.onbeforeunload = function removePipelineInterval() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册