Commit b5d72807 authored by Filipa Lacerda's avatar Filipa Lacerda Committed by Toon Claes

Make a new request every 1second after we receive the latest if the cpmpletion is under 100

parent cecdaaca
/* eslint-disable no-new */ /* eslint-disable no-new, no-undef */
/* global Flash */ /* global Flash */
/** /**
* Renders a deploy board. * Renders a deploy board.
...@@ -67,6 +67,26 @@ export default { ...@@ -67,6 +67,26 @@ export default {
}, },
created() { created() {
this.getDeployBoard();
},
updated() {
// While board is not complete we need to request new data from the server.
// Let's make sure we are not making any request at the moment
// and that we only make this request if the latest response was not 204.
if (!this.isLoading &&
!this.hasError &&
this.deployBoardData.completion &&
this.deployBoardData.completion < 100) {
// let's wait 1s and make the request again
setTimeout(() => {
this.getDeployBoard();
}, 1000);
}
},
methods: {
getDeployBoard() {
this.isLoading = true; this.isLoading = true;
const maxNumberOfRequests = 3; const maxNumberOfRequests = 3;
...@@ -109,6 +129,7 @@ export default { ...@@ -109,6 +129,7 @@ export default {
new Flash('An error occurred while fetching the deploy board.', 'alert'); new Flash('An error occurred while fetching the deploy board.', 'alert');
}); });
}, },
},
computed: { computed: {
canRenderDeployBoard() { canRenderDeployBoard() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment