Skip to content

Commit 21bf766

Browse files
committed
Added info about EI Backend and Frontend connected servers on EiInfo page.
1 parent 3cc651e commit 21bf766

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

src/main/java/com/ericsson/ei/frontend/WebController.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public class WebController {
2929

3030
private String frontendServiceHost;
3131
private int frontendServicePort;
32-
32+
private String backendServerHost;
33+
private int backendServerPort;
3334

3435
@RequestMapping("/")
3536
public String greeting(Model model) {
@@ -61,8 +62,9 @@ public String testRules(Model model) {
6162
public String eiInfo(Model model) {
6263

6364
String frontendServiceUrl = String.format("http://%s:%d", frontendServiceHost, frontendServicePort);
64-
65-
model.addAttribute("frontendServiceUrl", frontendServiceUrl); // inject in DOM for AJAX etc
65+
model.addAttribute("frontendServiceUrl", frontendServiceUrl); // inject in DOM for AJAX etc
66+
String backendServerUrl = String.format("http://%s:%d", backendServerHost, backendServerPort);
67+
model.addAttribute("backendServerUrl", backendServerUrl);
6668

6769
return "eiInfo";
6870
}
@@ -102,5 +104,21 @@ public int getFrontendServicePort() {
102104
public void setFrontendServicePort(int frontendServicePort) {
103105
this.frontendServicePort = frontendServicePort;
104106
}
107+
108+
public String getBackendServerHost() {
109+
return backendServerHost;
110+
}
111+
112+
public void setBackendServerHost(String backendServerHost) {
113+
this.backendServerHost = backendServerHost;
114+
}
115+
116+
public int getBackendServerPort() {
117+
return backendServerPort;
118+
}
119+
120+
public void setBackendServerPort(int backendServerPort) {
121+
this.backendServerPort = backendServerPort;
122+
}
105123

106124
}

src/main/resources/static/js/eiInfo.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11

2+
3+
24
jQuery(document).ready(function() {
5+
6+
// Fetch injected URL from DOM
7+
var frontendServiceUrl = $('#frontendServiceUrl').text();
8+
var backendServerUrl = $('#backendServerUrl').text();
39

410
var body = document.getElementsByTagName('body')[0];
511

@@ -47,6 +53,24 @@ jQuery(document).ready(function() {
4753
tr.appendChild(tdValue);
4854
tbdy.appendChild(tr);
4955

56+
tr = document.createElement('tr');
57+
tdKey = document.createElement('td');
58+
tdKey.appendChild(document.createTextNode('EI RestApi Requests Via Server'));
59+
tr.appendChild(tdKey);
60+
tdValue = document.createElement('td');
61+
tdValue.appendChild(document.createTextNode(frontendServiceUrl));
62+
tr.appendChild(tdValue);
63+
tbdy.appendChild(tr);
64+
65+
tr = document.createElement('tr');
66+
tdKey = document.createElement('td');
67+
tdKey.appendChild(document.createTextNode('EI Backend Connected Server'));
68+
tr.appendChild(tdKey);
69+
tdValue = document.createElement('td');
70+
tdValue.appendChild(document.createTextNode(backendServerUrl));
71+
tr.appendChild(tdValue);
72+
tbdy.appendChild(tr);
73+
5074

5175
tbl.appendChild(tbdy);
5276
body.appendChild(tbl);

src/main/resources/templates/eiInfo.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
<body class="nav-link">
3434
<div class="hidden" id="frontendServiceUrl"
3535
th:text="${frontendServiceUrl}"></div>
36+
<div class="hidden" id="backendServerUrl"
37+
th:text="${backendServerUrl}"></div>
3638

3739
<script type="text/javascript" src="js/eiInfo.js"></script>
3840
</body>

0 commit comments

Comments
 (0)