Skip to content

Commit 39fdd8d

Browse files
author
Daan Hoogland
committed
backwards compatible response
1 parent aea997f commit 39fdd8d

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

api/src/main/java/org/apache/cloudstack/api/response/RouterHealthCheckResultResponse.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ public class RouterHealthCheckResultResponse extends BaseResponse {
3636
private String checkType;
3737

3838
@SerializedName(ApiConstants.SUCCESS)
39-
@Param(description = "result of the health check")
40-
private RouterHealthStatus result;
39+
@Param(description = "result of the health check if available")
40+
private boolean result;
41+
42+
@SerializedName(ApiConstants.STATUS)
43+
@Param(description = "the result of the health check in enum form: {SUCCESS, FAILURE, WARNING, UNKNOWN}")
44+
private RouterHealthStatus state;
4145

4246
@SerializedName(ApiConstants.LAST_UPDATED)
4347
@Param(description = "the date this VPC was created")
@@ -55,10 +59,14 @@ public String getCheckType() {
5559
return checkType;
5660
}
5761

58-
public RouterHealthStatus getResult() {
62+
public Boolean getResult() {
5963
return result;
6064
}
6165

66+
public RouterHealthStatus getState() {
67+
return state;
68+
}
69+
6270
public Date getLastUpdated() {
6371
return lastUpdated;
6472
}
@@ -75,10 +83,14 @@ public void setCheckType(String checkType) {
7583
this.checkType = checkType;
7684
}
7785

78-
public void setResult(RouterHealthStatus result) {
86+
public void setResult(Boolean result) {
7987
this.result = result;
8088
}
8189

90+
public void setState(RouterHealthStatus state) {
91+
this.state = state;
92+
}
93+
8294
public void setLastUpdated(Date lastUpdated) {
8395
this.lastUpdated = lastUpdated;
8496
}

server/src/main/java/com/cloud/api/ApiResponseHelper.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5100,7 +5100,17 @@ public List<RouterHealthCheckResultResponse> createHealthCheckResponse(VirtualMa
51005100
healthCheckResponse.setObjectName("routerhealthchecks");
51015101
healthCheckResponse.setCheckName(hcResult.getCheckName());
51025102
healthCheckResponse.setCheckType(hcResult.getCheckType());
5103-
healthCheckResponse.setResult(hcResult.getCheckResult());
5103+
switch (hcResult.getCheckResult()) {
5104+
case SUCCESS:
5105+
healthCheckResponse.setResult(true);
5106+
break;
5107+
case FAILED:
5108+
healthCheckResponse.setResult(false);
5109+
break;
5110+
default:
5111+
// no result if not definite
5112+
}
5113+
healthCheckResponse.setState(hcResult.getCheckResult());
51045114
healthCheckResponse.setLastUpdated(hcResult.getLastUpdateTime());
51055115
healthCheckResponse.setDetails(hcResult.getParsedCheckDetails());
51065116
responses.add(healthCheckResponse);

ui/src/views/infra/routers/RouterHealthCheck.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
size="large">
3636
<template #bodyCell="{ column, record }">
3737
<template v-if="column.key === 'status'">
38-
<status class="status" :text="record.success" displayText />
38+
<status class="status" :text="record.status" displayText />
3939
</template>
4040
</template>
4141
</a-table>
@@ -113,7 +113,7 @@ export default {
113113
},
114114
{
115115
key: 'status',
116-
dataIndex: 'success',
116+
dataIndex: 'status',
117117
title: this.$t('label.router.health.check.success')
118118
},
119119
{

0 commit comments

Comments
 (0)