luci-mod-network: remove related bridge-vlan sections on deleting device
authorJo-Philipp Wich <[email protected]>
Fri, 22 Oct 2021 17:17:42 +0000 (19:17 +0200)
committerJo-Philipp Wich <[email protected]>
Fri, 22 Oct 2021 17:18:27 +0000 (19:18 +0200)
Signed-off-by: Jo-Philipp Wich <[email protected]>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index 5cc7186124329873b5e06dc8ee98185744608335..371d82770efd395062635d037eb8c045dd35cbb7 100644 (file)
@@ -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');