This is an automated email from the ASF dual-hosted git repository. bhliva pushed a commit to branch DLAB-572 in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-572 by this push: new 87e5ba8 DLAB-572 added status to health status page in case of edge is not exist 87e5ba8 is described below commit 87e5ba85d42fe11c3285bc84ebc2c10dfc34cecc Author: bhliva <bohdan_hl...@epam.com> AuthorDate: Fri Apr 12 14:37:36 2019 +0300 DLAB-572 added status to health status page in case of edge is not exist --- .../main/java/com/epam/dlab/backendapi/dao/EnvDAO.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/EnvDAO.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/EnvDAO.java index 8d27fff..703586a 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/EnvDAO.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/EnvDAO.java @@ -153,29 +153,31 @@ public class EnvDAO extends BaseDAO { } /** - * Finds and returns the of computational resource. - * * @param user the name of user. * @param fullReport return full report if <b>true</b> otherwise common status only. * @throws DlabException in case of any exception */ public HealthStatusPageDTO getHealthStatusPageDTO(String user, boolean fullReport) { - List<HealthStatusResource> listResource = new ArrayList<>(); + List<HealthStatusResource> listResource = new ArrayList<>(1); final HealthStatusPageDTO healthStatusPageDTO = new HealthStatusPageDTO() .withStatus(HealthStatusEnum.OK); - getEdgeNode(user).ifPresent(edge -> { - final String edgeStatus = edge.getString(EDGE_STATUS); + final Optional<Document> edgeNode = getEdgeNode(user); + if (edgeNode.isPresent()) { + final Document document = edgeNode.get(); + final String edgeStatus = document.getString(EDGE_STATUS); if (UserInstanceStatus.RUNNING != UserInstanceStatus.of(edgeStatus)) { healthStatusPageDTO.withStatus(HealthStatusEnum.ERROR); } if (fullReport) { listResource.add(new HealthStatusResource() .withType("Edge Node") - .withResourceId(edge.getString(EDGE_PUBLIC_IP)) + .withResourceId(document.getString(EDGE_PUBLIC_IP)) .withStatus(edgeStatus)); } - }); + } else { + healthStatusPageDTO.withStatus(HealthStatusEnum.ERROR); + } return healthStatusPageDTO .withListResources(fullReport ? listResource : null); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org