From bb3269945c7f189e1d1de1e7979d79d30a860b03 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 12 Jun 2021 22:54:51 +0200 Subject: [PATCH] luci-mod-network: reset bridge VLANs on cancelling modal dialog Signed-off-by: Jo-Philipp Wich --- .../htdocs/luci-static/resources/tools/network.js | 3 +++ .../htdocs/luci-static/resources/view/network/interfaces.js | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js b/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js index 67aecf262c..8ba259e2c9 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js @@ -922,6 +922,9 @@ return baseclass.extend({ s.getOption('vlan_filtering').updateDefaultValue(s.section); + s.map.addedVLANs = s.map.addedVLANs || []; + s.map.addedVLANs.push(section_id); + return this.redraw(); }, this)); }; 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 7e9eadf788..694d43141f 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 @@ -1302,7 +1302,7 @@ return view.extend({ nettools.addDeviceOptions(s, dev, isNew); }; - s.handleModalCancel = function(/* ... */) { + s.handleModalCancel = function(map /*, ... */) { var name = uci.get('network', this.addedSection, 'name') uci.sections('network', 'bridge-vlan', function(bvs) { @@ -1310,6 +1310,10 @@ return view.extend({ uci.remove('network', bvs['.name']); }); + if (map.addedVLANs) + for (var i = 0; i < map.addedVLANs.length; i++) + uci.remove('network', map.addedVLANs[i]); + return form.GridSection.prototype.handleModalCancel.apply(this, arguments); }; -- 2.30.2