Skip to content

Commit 8cafd74

Browse files
Hide remove button of default backend instance (#111)
1 parent 184fc0a commit 8cafd74

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ jQuery(document).ready(function() {
22
var frontendServiceUrl = $('#frontendServiceUrl').text();
33
var frontendServiceBackEndPath = "/backend";
44
var sendbtn = document.getElementById('switcher').disabled = true;
5-
function singleInstanceModel(name, host, port, path, https, active) {
5+
function singleInstanceModel(name, host, port, path, https, active, defaultBackend) {
66
this.name = ko.observable(name),
77
this.host = ko.observable(host),
88
this.port = ko.observable(port),
99
this.path = ko.observable(path),
1010
this.https = ko.observable(https),
1111
this.active = ko.observable(active)
12+
this.defaultBackend = ko.observable(defaultBackend)
1213
}
1314
function multipleInstancesModel(data) {
1415
var self = this;
@@ -17,7 +18,7 @@ function multipleInstancesModel(data) {
1718
var json = JSON.parse(ko.toJSON(data));
1819
for(var i = 0; i < json.length; i++) {
1920
var obj = json[i];
20-
var instance = new singleInstanceModel(obj.name, obj.host, obj.port, obj.path, obj.https, obj.active);
21+
var instance = new singleInstanceModel(obj.name, obj.host, obj.port, obj.path, obj.https, obj.active, obj.defaultBackend);
2122
self.instances.push(instance);
2223
}
2324
self.checked = function(){

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
<td data-bind="text: port"></td>
3535
<td data-bind="text: path"></td>
3636
<td class="text-center"><input type="checkbox" disabled="disabled" data-bind="checked: https"/></td>
37-
<td class="text-center"><a href="#" data-bind="click: $parent.removeInstance, attr: { id: 'removeBtn' + $index()}">Remove</a></td>
37+
<td class="text-center"><a href="#" data-bind="click: $parent.removeInstance, attr: { id: 'removeBtn' + $index()},
38+
style:{visibility:($root.instances()[$index()].defaultBackend().valueOf() === true) ? 'hidden' : 'visible'}">Remove</a></td>
3839
</tr>
3940
</tbody>
4041
</table>

0 commit comments

Comments
 (0)