From ed2c7f896568f97016ed0543c568266847efe67e Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 6 Oct 2025 13:05:10 +0200 Subject: [PATCH] luci-mod-network: make state of interface more clear In the current source, it is difficult to see when the disable button should be shown or not. This commit adjusts this and moves the handling to an if else statement, so that it can be easily seen. Signed-off-by: Florian Eckert --- .../resources/view/network/interfaces.js | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index 696d324da6..f7e092e49a 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -489,13 +489,11 @@ return view.extend({ 'class': 'cbi-button cbi-button-neutral reconnect', 'click': iface_updown.bind(this, true, section_id), 'title': _('Reconnect this interface'), - 'disabled': dynamic ? 'disabled' : null }, _('Restart')), E('button', { 'class': 'cbi-button cbi-button-neutral down', 'click': iface_updown.bind(this, false, section_id), 'title': _('Shutdown this interface'), - 'disabled': (dynamic || disabled) ? 'disabled' : null }, _('Stop')), tdEl.lastChild.firstChild, tdEl.lastChild.lastChild @@ -503,13 +501,27 @@ return view.extend({ if (!dynamic && net && !uci.get('network', net.getName())) { tdEl.lastChild.childNodes[0].disabled = true; + tdEl.lastChild.childNodes[1].disabled = true; tdEl.lastChild.childNodes[2].disabled = true; tdEl.lastChild.childNodes[3].disabled = true; } - - if (dynamic) { - //disable the 'Edit' button on dynamic interfaces + else if(dynamic === true) { + tdEl.lastChild.childNodes[0].disabled = true; + tdEl.lastChild.childNodes[1].disabled = true; tdEl.lastChild.childNodes[2].disabled = true; + tdEl.lastChild.childNodes[3].disabled = true; + } + else if (disabled === true){ + tdEl.lastChild.childNodes[0].disabled = false; + tdEl.lastChild.childNodes[1].disabled = true; + tdEl.lastChild.childNodes[2].disabled = false; + tdEl.lastChild.childNodes[3].disabled = false; + } + else { + tdEl.lastChild.childNodes[0].disabled = false; + tdEl.lastChild.childNodes[1].disabled = false; + tdEl.lastChild.childNodes[2].disabled = false; + tdEl.lastChild.childNodes[3].disabled = false; } return tdEl; -- 2.30.2