Commit 2cb62a5f authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'deploy-boards-endpoint' into 'master'

Use rollout_status_path provided in environment to fetch the data instead of hardcoded endpoint

See merge request !1323
parents 75027d97 21c6cc68
......@@ -49,6 +49,11 @@ module.exports = {
type: Number,
required: true,
},
endpoint: {
type: String,
required: true,
},
},
data() {
......@@ -66,7 +71,7 @@ module.exports = {
// If the response is 204, we make 3 more requests.
gl.utils.backOff((next, stop) => {
this.service.getDeployBoard(this.environmentID)
this.service.getDeployBoard(this.endpoint)
.then((resp) => {
if (resp.status === statusCodes.NO_CONTENT) {
this.backOffRequestCounter = this.backOffRequestCounter += 1;
......
......@@ -99,7 +99,8 @@ module.exports = Vue.component('environment-table-component', {
:store="store"
:service="service"
:environmentID="model.id"
:deployBoardData="model.deployBoardData">
:deployBoardData="model.deployBoardData"
:endpoint="model.rollout_status_path">
</deploy-board>
</td>
</tr>
......
/* eslint-disable class-methods-use-this*/
const Vue = require('vue');
class EnvironmentsService {
constructor(endpoint) {
this.environments = Vue.resource(endpoint);
this.deployBoard = Vue.resource('environments/{id}/status.json');
}
get() {
return this.environments.get();
}
getDeployBoard(environmentID) {
return this.deployBoard.get({ id: environmentID });
getDeployBoard(endpoint) {
return Vue.http.get(endpoint);
}
}
......
......@@ -30,6 +30,7 @@ describe('Deploy Board', () => {
service: this.service,
deployBoardData: deployBoardMockData,
environmentID: 1,
endpoint: 'endpoint',
},
}).$mount();
});
......@@ -96,6 +97,7 @@ describe('Deploy Board', () => {
service: this.service,
deployBoardData: {},
environmentID: 1,
endpoint: 'endpoint',
},
}).$mount();
});
......
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