From: Jo-Philipp Wich Date: Fri, 22 Oct 2021 17:17:42 +0000 (+0200) Subject: luci-mod-network: remove related bridge-vlan sections on deleting device X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4d3de0e1bbfb0b5323293facb45260fa6ce38e5b;p=project%2Fluci.git luci-mod-network: remove related bridge-vlan sections on deleting device Signed-off-by: Jo-Philipp Wich (cherry picked from commit 216767f420a92468b865a5ef301a1e94283dcb0e) --- 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 9a9282c034..117be2c7c1 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 @@ -1309,6 +1309,20 @@ return view.extend({ return form.GridSection.prototype.handleModalCancel.apply(this, arguments); }; + s.handleRemove = function(section_id /*, ... */) { + var name = uci.get('network', section_id, 'name'), + type = uci.get('network', section_id, 'type'); + + if (name != null && type == 'bridge') { + uci.sections('network', 'bridge-vlan', function(bvs) { + if (bvs.device == name) + uci.remove('network', bvs['.name']); + }); + } + + return form.GridSection.prototype.handleRemove.apply(this, arguments); + }; + function getDevice(section_id) { var m = section_id.match(/^dev:(.+)$/), name = m ? m[1] : uci.get('network', section_id, 'name');