Added customui device deselection.

Ylian Saint-Hilaire committed May 25, 2021 at 13:08 UTC 71b351add9c18eec1989d6cc5bedf0f12dbbab72
2 files changed +7 -7
meshrelay.js
+2 -6
@@ -295,12 +295,8 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
295 }
296 }
297
298 - // Check that both sides have websocket connections
299 - if ((obj.ws == null) || (relayinfo.peer1.ws == null)) {
300 - relayinfo.peer1.close();
301 - obj.close();
302 - return null;
303 - }
298 + // Check that both sides have websocket connections, this should never happen.
299 + if ((obj.ws == null) || (relayinfo.peer1.ws == null)) { relayinfo.peer1.close(); obj.close(); return null; }
300
301 // Connect to peer
302 obj.peer = relayinfo.peer1;
views/default.handlebars
+5 -1
@@ -1608,6 +1608,7 @@
1608 if (typeof info.action == 'string') {
1609 if (info.action == 'event') { meshserver.send({ action: 'uicustomevent', section: section, element: id.substring(4), selectedDevices: selectedDevices, logmsg: info.logmsg }); }
1610 if (info.action.startsWith('dialog:')) { showCustomUiDialog(info.action.substring(7), { section: section, element: id.substring(4), selectedDevices: selectedDevices }); }
1611 + if (info.deselectdevices) { for (var i = 0; i < elements.length; i++) { elements[i].checked = false; } checkedNodeids = {}; p1updateInfo(); }
1612 }
1613 }
1614 if ((section == 'devicebuttons') || (section == 'desktopbuttons') || (section == 'terminalbuttons') || (section == 'filesbuttons')) {
@@ -1657,6 +1658,10 @@
1658 }
1659 }
1660 meshserver.send(t);
1661 + if (dialog.deselectdevices) {
1662 + var elements = document.getElementsByClassName('DeviceCheckbox')
1663 + for (var i = 0; i < elements.length; i++) { elements[i].checked = false; } checkedNodeids = {}; p1updateInfo();
1664 + }
1665 }
1666
1667 function adjustPanels() {
@@ -14357,7 +14362,6 @@
14362 }
14363
14364 function notificationSelectedEx(n, id) {
14360 - console.log(n);
14365 if (n.nodeid != null) {
14366 if (n.tag == 'desktop') gotoDevice(n.nodeid, 12); // Desktop
14367 else if (n.tag == 'terminal') gotoDevice(n.nodeid, 11); // Terminal