From 216767f420a92468b865a5ef301a1e94283dcb0e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 22 Oct 2021 19:17:42 +0200 Subject: [PATCH] luci-mod-network: remove related bridge-vlan sections on deleting device Signed-off-by: Jo-Philipp Wich --- .../resources/view/network/interfaces.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 5cc7186124..371d82770e 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 @@ -1314,6 +1314,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'); -- 2.30.2