Commit 1d30feef authored by Filipa Lacerda's avatar Filipa Lacerda

Changes after review

parent e89b6eea
/* eslint-disable no-new */
/* eslint-disable no-new, import/first */
/**
* Renders a deploy board.
*
......@@ -18,12 +18,12 @@
* for more information
*/
const Vue = require('vue');
const instanceComponent = require('./deploy_board_instance_component');
require('~/lib/utils/common_utils');
const Flash = require('~/flash');
import instanceComponent from './deploy_board_instance_component.js.es6';
import statusCodes from '~/lib/utils/http_status';
import Flash from '~/flash';
import '~/lib/utils/common_utils.js.es6';
module.exports = Vue.component('deploy_boards_components', {
module.exports = {
components: {
instanceComponent,
......@@ -63,13 +63,12 @@ module.exports = Vue.component('deploy_boards_components', {
this.isLoading = true;
const maxNumberOfRequests = 3;
const noContentStatus = 204;
// If the response is 204, we make 3 more requests.
gl.utils.backOff((next, stop) => {
this.service.getDeployBoard(this.environmentID)
.then((resp) => {
if (resp.status === noContentStatus) {
if (resp.status === statusCodes.NO_CONTENT) {
this.backOffRequestCounter = this.backOffRequestCounter += 1;
if (this.backOffRequestCounter < maxNumberOfRequests) {
......@@ -84,7 +83,7 @@ module.exports = Vue.component('deploy_boards_components', {
.catch(stop);
})
.then((resp) => {
if (resp.status === noContentStatus) {
if (resp.status === statusCodes.NO_CONTENT) {
this.hasError = true;
return resp;
}
......@@ -126,7 +125,7 @@ module.exports = Vue.component('deploy_boards_components', {
<div class="js-deploy-board deploy-board">
<div v-if="isLoading">
<i class="fa fa-spinner fa-spin"></i>
<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>
</div>
<div v-if="canRenderDeployBoard">
......@@ -175,4 +174,4 @@ module.exports = Vue.component('deploy_boards_components', {
</div>
</div>
`,
});
};
......@@ -10,7 +10,7 @@
const Vue = require('vue');
module.exports = Vue.component('deploy_board_instance_component', {
module.exports = {
props: {
......@@ -48,4 +48,4 @@ module.exports = Vue.component('deploy_board_instance_component', {
data-placement="top">
</div>
`,
});
};
......@@ -89,7 +89,7 @@ module.exports = Vue.component('environment-component', {
this.isLoading = true;
return this.service.all()
return this.service.get()
.then(resp => ({
headers: resp.headers,
body: resp.json(),
......
......@@ -93,7 +93,7 @@ module.exports = Vue.component('environment-folder-view', {
this.isLoading = true;
return this.service.all()
return this.service.get()
.then(resp => ({
headers: resp.headers,
body: resp.json(),
......
......@@ -7,7 +7,7 @@ class EnvironmentsService {
this.deployBoard = Vue.resource('environments/{id}/status.json');
}
all() {
get() {
return this.environments.get();
}
......
/**
* exports HTTP status codes
*/
const statusCodes = {
NO_CONTENT: 204,
OK: 200,
};
export default statusCodes;
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