luci-mod-network: reset bridge VLANs on cancelling modal dialog

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit bb3269945c)
This commit is contained in:
Jo-Philipp Wich 2021-06-12 22:54:51 +02:00
parent 7f15982c25
commit 973e80e97e
2 changed files with 8 additions and 1 deletions

View file

@ -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));
};

View file

@ -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);
};