luci-mod-network: interfaces.js: avoid stray empty device uci sections

Ensure that just created uci device sections are removed if the edit
option modal is cancelled without saving. This prevents empty, but
harmless `config device` sections from being created on a subsequent
Save & Apply operation.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2023-02-05 19:35:00 +01:00
parent 4c304ce332
commit c13ef9406c

View file

@ -1347,6 +1347,9 @@ return view.extend({
for (var i = 0; i < map.addedVLANs.length; i++)
uci.remove('network', map.addedVLANs[i]);
if (this.addedSection)
uci.remove('network', this.addedSection);
return form.GridSection.prototype.handleModalCancel.apply(this, arguments);
};