From: Jo-Philipp Wich Date: Sun, 5 Feb 2023 18:35:00 +0000 (+0100) Subject: luci-mod-network: interfaces.js: avoid stray empty device uci sections X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=9fb65ea103c83e951aba054d587751cf5699f59c;p=project%2Fluci.git 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 (cherry picked from commit c13ef9406c9c2e12c28d2065b342444af5e27c0b) --- 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 d44b0cf6d0..d0ffe02ee9 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 @@ -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); };