summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--applications/luci-app-wireguard/htdocs/luci-static/resources/view/wireguard/status.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/applications/luci-app-wireguard/htdocs/luci-static/resources/view/wireguard/status.js b/applications/luci-app-wireguard/htdocs/luci-static/resources/view/wireguard/status.js
index 25d5df9ffb..b9c756de98 100644
--- a/applications/luci-app-wireguard/htdocs/luci-static/resources/view/wireguard/status.js
+++ b/applications/luci-app-wireguard/htdocs/luci-static/resources/view/wireguard/status.js
@@ -74,19 +74,26 @@ function generatePeerRows(peers) {
var peerData = parsePeerData(peer);
var iconSrc = getTunnelIcon(peer.latest_handshake);
- peerRows.push(E('div', {
+ peerRows.push(E('tr', {
'class': 'tr cbi-section-table-row'
}, [
- E('div', {
+ E('td', {
'class': 'td peer-name',
'style': 'width: 25%; font-size: 0.9rem;'
}, peer.name),
- E('div', { 'class': 'td', 'data-section-id': peer.name },
+ E('td', { 'class': 'td', 'data-section-id': peer.name },
generatePeerTable(peerData, iconSrc)
)
]));
});
+ if (!peerRows.length) {
+ peerRows.push(
+ E('tr', { 'class': 'tr placeholder' },
+ E('td', { 'class': 'td' },
+ E('em', _('No peer information available')))));
+ }
+
return peerRows;
}
@@ -124,6 +131,7 @@ return view.extend({
load: function () {
return callGetWgInstances();
},
+
poll_status: function (nodes, ifaces) {
Object.keys(ifaces).forEach(function (ifaceName) {
var iface = ifaces[ifaceName];
@@ -164,6 +172,7 @@ return view.extend({
});
});
},
+
render: function (ifaces) {
var m, s, o, ss;
@@ -171,6 +180,7 @@ return view.extend({
m.tabbed = true;
var ifaceNames = Object.keys(ifaces);
+
for (var i = ifaceNames.length - 1; i >= 0; i--) {
var ifaceName = ifaceNames[i];
var iface = ifaces[ifaceName];
@@ -193,13 +203,16 @@ return view.extend({
ss.render = L.bind(function (view, section_id) {
return E('div', { 'class': 'cbi-section' }, [
E('h3', _('Peers')),
- E('div', { 'class': 'table cbi-section-table' },
+ E('table', { 'class': 'table cbi-section-table' },
generatePeerRows(this.peers))
]);
}, iface, this);
}
return m.render().then(L.bind(function (m, nodes) {
+ if (!ifaceNames.length)
+ nodes.appendChild(E('p', {}, E('em', _('No WireGuard interfaces configured.'))));
+
poll.add(L.bind(function () {
return callGetWgInstances().then(
L.bind(this.poll_status, this, nodes)
@@ -208,6 +221,7 @@ return view.extend({
return nodes;
}, this, m));
},
+
handleReset: null,
handleSaveApply: null,
handleSave: null