From 80a0abb54fb91612ffa5ca55058a846b6e9a8c84 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Tue, 28 Oct 2025 17:36:53 +0100 Subject: [PATCH] luci-proto-wireguard: Hide the QR code parent dialogue button row via styling Previously, the render code attempted to add the class "hidden" to the button row, the button row which can have a persistent visibility style applied via CSS so the "hidden" class attribute was overridden. Set the style.display of the row instead which now hides the button row. Signed-off-by: Paul Donald --- .../resources/protocol/wireguard.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js index e1e1835c7b..fd516d7c75 100644 --- a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js +++ b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js @@ -832,8 +832,14 @@ return network.registerProtocol('wireguard', { }; return qrm.render().then(function(nodes) { - mapNode.classList.add('hidden'); - mapNode.nextElementSibling.classList.add('hidden'); + // stash the current dialogue style (visible) + const dStyle = mapNode.style; + // hide the current modal window + mapNode.style.display = 'none'; + // stash the current button row style (visible) + const bRowStyle = mapNode.nextElementSibling.style; + // hide the [ Dismiss | Save ] button row + mapNode.nextElementSibling.style.display = 'none'; headNode.appendChild(E('span', [ ' » ', _('Generate configuration') ])); mapNode.parentNode.appendChild(E([], [ @@ -844,10 +850,15 @@ return network.registerProtocol('wireguard', { E('button', { 'class': 'btn', 'click': function() { + // Remove QR code button (row) nodes.parentNode.removeChild(nodes.nextSibling); + // Remove QR code form nodes.parentNode.removeChild(nodes); - mapNode.classList.remove('hidden'); - mapNode.nextSibling.classList.remove('hidden'); + // unhide the WiFi modal dialogue + mapNode.style = dStyle; + // Revert button row style to visible again + mapNode.nextSibling.style = bRowStyle; + // Remove the H4 span (») title headNode.removeChild(headNode.lastChild); } }, [ _('Back to peer configuration') ]) -- 2.30.2