luci-mod-network: show stop button if interface start is pending

Currently, it is not possible to stop an interface from establishing a
connection when it is flageed as pending in the netifd. This situation
occurs when netifd tells a proto to establish a connection, but the
proto is executing a blocken binary. This situation occurs in the proto
'modemmanager' when it wants to register but cannot. The timeout is set to
'120' seconds. During this time, the establishment cannot be stopped via
LuCI because the disable button can not be clicked.

To fix this, the pending flag is also evaluated and the disable button
is displayed in this state as well.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert
2025-10-07 14:08:11 +02:00
parent 7b6b0d0139
commit b4d5ca66e9

View File

@@ -269,7 +269,8 @@ return view.extend({
stat = document.querySelector('[id="%s-ifc-status"]'.format(ifc.getName())), stat = document.querySelector('[id="%s-ifc-status"]'.format(ifc.getName())),
resolveZone = render_ifacebox_status(box, ifc), resolveZone = render_ifacebox_status(box, ifc),
disabled = ifc ? !ifc.isUp() : true, disabled = ifc ? !ifc.isUp() : true,
dynamic = ifc ? ifc.isDynamic() : false; dynamic = ifc ? ifc.isDynamic() : false,
pending = ifc ? ifc.isPending() : false;
if (dsc.hasAttribute('reconnect')) { if (dsc.hasAttribute('reconnect')) {
dom.content(dsc, E('em', _('Interface is starting...'))); dom.content(dsc, E('em', _('Interface is starting...')));
@@ -317,6 +318,10 @@ return view.extend({
btn1.disabled = true; btn1.disabled = true;
btn2.disabled = true; btn2.disabled = true;
} }
else if (pending === true) {
btn1.disabled = true;
btn2.disabled = false;
}
else if (disabled === true) { else if (disabled === true) {
btn1.disabled = false; btn1.disabled = false;
btn2.disabled = true; btn2.disabled = true;
@@ -500,7 +505,8 @@ return view.extend({
var tdEl = this.super('renderRowActions', [ section_id, _('Edit') ]), var tdEl = this.super('renderRowActions', [ section_id, _('Edit') ]),
net = this.networks.filter(function(n) { return n.getName() == section_id })[0], net = this.networks.filter(function(n) { return n.getName() == section_id })[0],
disabled = net ? !net.isUp() : true, disabled = net ? !net.isUp() : true,
dynamic = net ? net.isDynamic() : false; dynamic = net ? net.isDynamic() : false,
pending = net ? net.isPending() : false;
dom.content(tdEl.lastChild, [ dom.content(tdEl.lastChild, [
E('button', { E('button', {
@@ -529,6 +535,12 @@ return view.extend({
tdEl.lastChild.childNodes[2].disabled = true; tdEl.lastChild.childNodes[2].disabled = true;
tdEl.lastChild.childNodes[3].disabled = true; tdEl.lastChild.childNodes[3].disabled = true;
} }
else if(pending === true) {
tdEl.lastChild.childNodes[0].disabled = true;
tdEl.lastChild.childNodes[1].disabled = false;
tdEl.lastChild.childNodes[2].disabled = false;
tdEl.lastChild.childNodes[3].disabled = false;
}
else if (disabled === true){ else if (disabled === true){
tdEl.lastChild.childNodes[0].disabled = false; tdEl.lastChild.childNodes[0].disabled = false;
tdEl.lastChild.childNodes[1].disabled = true; tdEl.lastChild.childNodes[1].disabled = true;