From 71b351add9c18eec1989d6cc5bedf0f12dbbab72 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 25 May 2021 13:08:38 -0700 Subject: [PATCH] Added customui device deselection. --- meshrelay.js | 8 ++------ views/default.handlebars | 6 +++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/meshrelay.js b/meshrelay.js index 7dc79f05..cd1862b1 100644 --- a/meshrelay.js +++ b/meshrelay.js @@ -295,12 +295,8 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { } } - // Check that both sides have websocket connections - if ((obj.ws == null) || (relayinfo.peer1.ws == null)) { - relayinfo.peer1.close(); - obj.close(); - return null; - } + // Check that both sides have websocket connections, this should never happen. + if ((obj.ws == null) || (relayinfo.peer1.ws == null)) { relayinfo.peer1.close(); obj.close(); return null; } // Connect to peer obj.peer = relayinfo.peer1; diff --git a/views/default.handlebars b/views/default.handlebars index a6c284ef..251be94a 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1608,6 +1608,7 @@ if (typeof info.action == 'string') { if (info.action == 'event') { meshserver.send({ action: 'uicustomevent', section: section, element: id.substring(4), selectedDevices: selectedDevices, logmsg: info.logmsg }); } if (info.action.startsWith('dialog:')) { showCustomUiDialog(info.action.substring(7), { section: section, element: id.substring(4), selectedDevices: selectedDevices }); } + if (info.deselectdevices) { for (var i = 0; i < elements.length; i++) { elements[i].checked = false; } checkedNodeids = {}; p1updateInfo(); } } } if ((section == 'devicebuttons') || (section == 'desktopbuttons') || (section == 'terminalbuttons') || (section == 'filesbuttons')) { @@ -1657,6 +1658,10 @@ } } meshserver.send(t); + if (dialog.deselectdevices) { + var elements = document.getElementsByClassName('DeviceCheckbox') + for (var i = 0; i < elements.length; i++) { elements[i].checked = false; } checkedNodeids = {}; p1updateInfo(); + } } function adjustPanels() { @@ -14357,7 +14362,6 @@ } function notificationSelectedEx(n, id) { - console.log(n); if (n.nodeid != null) { if (n.tag == 'desktop') gotoDevice(n.nodeid, 12); // Desktop else if (n.tag == 'terminal') gotoDevice(n.nodeid, 11); // Terminal