Commit 00694ec9 authored by Filipa Lacerda's avatar Filipa Lacerda

Changes after review

parent cc5eb8a3
...@@ -62,14 +62,17 @@ module.exports = Vue.component('deploy_boards_components', { ...@@ -62,14 +62,17 @@ module.exports = Vue.component('deploy_boards_components', {
created() { created() {
this.isLoading = true; this.isLoading = true;
const maxNumberOfRequests = 3;
const noContentStatus = 204;
// If the response is 204, we make 3 more requests. // If the response is 204, we make 3 more requests.
gl.utils.backOff((next, stop) => { gl.utils.backOff((next, stop) => {
this.service.getDeployBoard(this.environmentID) this.service.getDeployBoard(this.environmentID)
.then((resp) => { .then((resp) => {
if (resp.status === 204) { if (resp.status === noContentStatus) {
this.backOffRequestCounter = this.backOffRequestCounter += 1; this.backOffRequestCounter = this.backOffRequestCounter += 1;
if (this.backOffRequestCounter < 3) { if (this.backOffRequestCounter < maxNumberOfRequests) {
next(); next();
} else { } else {
stop(resp); stop(resp);
...@@ -79,9 +82,9 @@ module.exports = Vue.component('deploy_boards_components', { ...@@ -79,9 +82,9 @@ module.exports = Vue.component('deploy_boards_components', {
} }
}) })
.catch(stop); .catch(stop);
}, Infinity) })
.then((resp) => { .then((resp) => {
if (resp.status === 204) { if (resp.status === noContentStatus) {
this.hasError = true; this.hasError = true;
return resp; return resp;
} }
...@@ -108,11 +111,10 @@ module.exports = Vue.component('deploy_boards_components', { ...@@ -108,11 +111,10 @@ module.exports = Vue.component('deploy_boards_components', {
instanceTitle() { instanceTitle() {
let title; let title;
if (this.deployBoardData.instances.length === 1) { if (this.deployBoardData.instances.length === 1) {
title = 'Instance'; title = 'Instance';
} } else {
if (this.deployBoardData.instances.length > 1) {
title = 'Instances'; title = 'Instances';
} }
......
...@@ -35,12 +35,13 @@ module.exports = Vue.component('deploy_board_instance_component', { ...@@ -35,12 +35,13 @@ module.exports = Vue.component('deploy_board_instance_component', {
computed: { computed: {
cssClass() { cssClass() {
return `deploy-board-instance deploy-board-instance-${this.status} has-tooltip`; return `deploy-board-instance-${this.status}`;
}, },
}, },
template: ` template: `
<div <div
class="deploy-board-instance has-tooltip"
:class="cssClass" :class="cssClass"
:data-title="tooltipText" :data-title="tooltipText"
data-toggle="tooltip" data-toggle="tooltip"
......
...@@ -63,6 +63,16 @@ module.exports = Vue.component('environment-component', { ...@@ -63,6 +63,16 @@ module.exports = Vue.component('environment-component', {
return gl.utils.convertPermissionToBoolean(this.canCreateEnvironment); return gl.utils.convertPermissionToBoolean(this.canCreateEnvironment);
}, },
/**
* Pagination should only be rendered when we have information about it and when the
* number of total pages is bigger than 1.
*
* @return {Boolean}
*/
shouldRenderPagination() {
return this.state.paginationInformation && this.state.paginationInformation.totalPages > 1;
},
}, },
/** /**
...@@ -193,8 +203,7 @@ module.exports = Vue.component('environment-component', { ...@@ -193,8 +203,7 @@ module.exports = Vue.component('environment-component', {
:service="service"> :service="service">
</environment-table> </environment-table>
<table-pagination <table-pagination v-if="shouldRenderPagination"
v-if="state.paginationInformation && state.paginationInformation.totalPages > 1"
:change="changePage" :change="changePage"
:pageInfo="state.paginationInformation"> :pageInfo="state.paginationInformation">
</table-pagination> </table-pagination>
......
...@@ -441,7 +441,7 @@ module.exports = Vue.component('environment-item', { ...@@ -441,7 +441,7 @@ module.exports = Vue.component('environment-item', {
<td> <td>
<span class="deploy-board-icon" <span class="deploy-board-icon"
v-if="model.hasDeployBoard" v-if="model.hasDeployBoard"
v-on:click="toggleDeployBoard(model)"> @click="toggleDeployBoard(model)">
<i v-show="!model.isDeployBoardVisible" <i v-show="!model.isDeployBoardVisible"
class="fa fa-caret-right" class="fa fa-caret-right"
......
...@@ -91,7 +91,7 @@ module.exports = Vue.component('environment-table-component', { ...@@ -91,7 +91,7 @@ module.exports = Vue.component('environment-table-component', {
:play-icon-svg="playIconSvg" :play-icon-svg="playIconSvg"
:terminal-icon-svg="terminalIconSvg" :terminal-icon-svg="terminalIconSvg"
:commit-icon-svg="commitIconSvg" :commit-icon-svg="commitIconSvg"
:toggleDeployBoard="toggleDeployBoard.bind(model)"></tr> :toggleDeployBoard="toggleDeployBoard"></tr>
<tr v-if="model.hasDeployBoard && model.isDeployBoardVisible" class="js-deploy-board-row"> <tr v-if="model.hasDeployBoard && model.isDeployBoardVisible" class="js-deploy-board-row">
<td colspan="6" class="deploy-board-container"> <td colspan="6" class="deploy-board-container">
......
...@@ -54,10 +54,7 @@ class EnvironmentsStore { ...@@ -54,10 +54,7 @@ class EnvironmentsStore {
if (env.size > 1) { if (env.size > 1) {
filtered = Object.assign(filtered, env, { isFolder: true, folderName: env.name }); filtered = Object.assign(filtered, env, { isFolder: true, folderName: env.name });
} } else if (env.size === 1 && env.rollout_status) {
// no folders items with `rollout_status` key can have a deploy board
if (env.size === 1 && env.rollout_status) {
filtered = Object.assign(filtered, env, { filtered = Object.assign(filtered, env, {
hasDeployBoard: true, hasDeployBoard: true,
isDeployBoardVisible: false, isDeployBoardVisible: false,
......
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