Skip to content

Commit 0986392

Browse files
author
eznedan
committed
CHANGE: checked to active
REMOVE: active from example
1 parent 1fb3ec3 commit 0986392

File tree

6 files changed

+10
-20
lines changed

6 files changed

+10
-20
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public ResponseEntity<String> switchBackEndInstance(Model model, HttpServletRequ
4949
utils.writeIntoFile();
5050
utils.parseBackEndInstancesFile();
5151
for (BackEndInformation backEndInformation : utils.getInformation()) {
52-
if (backEndInformation.isChecked()) {
52+
if (backEndInformation.isActive()) {
5353
utils.setBackEndProperties(backEndInformation);
5454
}
5555
}

src/main/java/com/ericsson/ei/frontend/model/BackEndInformation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ public class BackEndInformation {
5656
@Value("${ei.useSecureHttp}")
5757
private boolean https;
5858

59-
private boolean checked;
59+
private boolean active;
6060
}

src/main/java/com/ericsson/ei/frontend/utils/BackEndInstancesUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
public class BackEndInstancesUtils {
4343

4444
private static final Logger LOG = LoggerFactory.getLogger(BackEndInstancesUtils.class);
45-
private static final String PATH = "src/main/resources/EIBackendInstancesExample.json";
45+
private static final String PATH = "src/main/resources/EIBackendInstancesInformation.json";
4646

4747
@Value("${ei.backendServerHost}")
4848
private String host;
@@ -71,10 +71,10 @@ public void init() {
7171
if (!checkIfInstanceAlreadyExist(getCurrentInstance())) {
7272
instances.put(getCurrentInstance());
7373
}
74-
writeIntoFile();
7574
if (eiInstancesPath.equals("")) {
7675
setEiInstancesPath(PATH);
7776
}
77+
writeIntoFile();
7878
}
7979

8080
private JSONObject getCurrentInstance() {
@@ -84,7 +84,7 @@ private JSONObject getCurrentInstance() {
8484
instance.put("port", port);
8585
instance.put("path", path);
8686
instance.put("https", https);
87-
instance.put("checked", true);
87+
instance.put("active", true);
8888
return instance;
8989
}
9090

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
11
[
2-
{
3-
"path": "",
4-
"port": 8090,
5-
"name": "core",
6-
"host": "localhost",
7-
"checked": false,
8-
"https": false
9-
},
102
{
113
"path": "",
124
"port": "8091",
135
"name": "test",
146
"host": "localhost",
15-
"checked": false,
167
"https": false
178
},
189
{
1910
"path": "/eiffel",
2011
"port": "8091",
2112
"name": "source",
2213
"host": "localhost",
23-
"checked": false,
2414
"https": false
2515
}
2616
]

src/main/resources/static/js/switch-instances.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
jQuery(document).ready(function() {
2-
function singleInstanceModel(name, host, port, path, https, checked) {
2+
function singleInstanceModel(name, host, port, path, https, active) {
33
this.name = ko.observable(name),
44
this.host = ko.observable(host),
55
this.port = ko.observable(port),
66
this.path = ko.observable(path),
77
this.https = ko.observable(https),
8-
this.checked = ko.observable(checked)
8+
this.active = ko.observable(active)
99
}
1010
function multipleInstancesModel(data) {
1111
var self = this;
1212
self.instances = ko.observableArray();
1313
var json = JSON.parse(data);
1414
for(var i = 0; i < json.length; i++) {
1515
var obj = json[i];
16-
var instance = new singleInstanceModel(obj.name, obj.host, obj.port, obj.path, obj.https, obj.checked);
16+
var instance = new singleInstanceModel(obj.name, obj.host, obj.port, obj.path, obj.https, obj.active);
1717
self.instances.push(instance);
1818
}
1919
self.removeInstance = function() {
@@ -39,7 +39,7 @@ function multipleInstancesModel(data) {
3939
console.log(json);
4040
for(var i = 0; i < json.length; i++){
4141
var obj = json[i];
42-
if(obj.checked == true){
42+
if(obj.active == true){
4343
count++;
4444
}
4545
}

src/main/resources/templates/switch-backend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<tbody data-bind="foreach: instances">
2828
<tr>
2929
<td align="center"><input align="center" id="activeInstance" type="checkbox"
30-
data-bind="checked: checked"/></td>
30+
data-bind="checked: active"/></td>
3131
<td data-bind="text: name" align="center"></td>
3232
<td data-bind="text: host" align="center"></td>
3333
<td data-bind="text: port" align="center"></td>

0 commit comments

Comments
 (0)