Commit 21c6cc68 authored by Filipa Lacerda's avatar Filipa Lacerda

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

parent 97437e88
...@@ -49,6 +49,11 @@ module.exports = { ...@@ -49,6 +49,11 @@ module.exports = {
type: Number, type: Number,
required: true, required: true,
}, },
endpoint: {
type: String,
required: true,
},
}, },
data() { data() {
...@@ -66,7 +71,7 @@ module.exports = { ...@@ -66,7 +71,7 @@ module.exports = {
// 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.endpoint)
.then((resp) => { .then((resp) => {
if (resp.status === statusCodes.NO_CONTENT) { if (resp.status === statusCodes.NO_CONTENT) {
this.backOffRequestCounter = this.backOffRequestCounter += 1; this.backOffRequestCounter = this.backOffRequestCounter += 1;
......
...@@ -99,7 +99,8 @@ module.exports = Vue.component('environment-table-component', { ...@@ -99,7 +99,8 @@ module.exports = Vue.component('environment-table-component', {
:store="store" :store="store"
:service="service" :service="service"
:environmentID="model.id" :environmentID="model.id"
:deployBoardData="model.deployBoardData"> :deployBoardData="model.deployBoardData"
:endpoint="model.rollout_status_path">
</deploy-board> </deploy-board>
</td> </td>
</tr> </tr>
......
/* eslint-disable class-methods-use-this*/
const Vue = require('vue'); const Vue = require('vue');
class EnvironmentsService { class EnvironmentsService {
constructor(endpoint) { constructor(endpoint) {
this.environments = Vue.resource(endpoint); this.environments = Vue.resource(endpoint);
this.deployBoard = Vue.resource('environments/{id}/status.json');
} }
get() { get() {
return this.environments.get(); return this.environments.get();
} }
getDeployBoard(environmentID) { getDeployBoard(endpoint) {
return this.deployBoard.get({ id: environmentID }); return Vue.http.get(endpoint);
} }
} }
......
...@@ -30,6 +30,7 @@ describe('Deploy Board', () => { ...@@ -30,6 +30,7 @@ describe('Deploy Board', () => {
service: this.service, service: this.service,
deployBoardData: deployBoardMockData, deployBoardData: deployBoardMockData,
environmentID: 1, environmentID: 1,
endpoint: 'endpoint',
}, },
}).$mount(); }).$mount();
}); });
...@@ -96,6 +97,7 @@ describe('Deploy Board', () => { ...@@ -96,6 +97,7 @@ describe('Deploy Board', () => {
service: this.service, service: this.service,
deployBoardData: {}, deployBoardData: {},
environmentID: 1, environmentID: 1,
endpoint: 'endpoint',
}, },
}).$mount(); }).$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