luci-base: uci: fixed reorder bug where missed deletes caused off-by-one
authorPaul Donald <[email protected]>
Mon, 25 Nov 2024 20:26:35 +0000 (21:26 +0100)
committerPaul Donald <[email protected]>
Mon, 25 Nov 2024 20:26:35 +0000 (21:26 +0100)
Signed-off-by: Paul Donald <[email protected]>
modules/luci-base/htdocs/luci-static/resources/uci.js

index e52c184e51f2dc9bb7dc6c661e066d573dfbc0c5..35110c0227b4b8fc73a8c2765475ac99e8e32653 100644 (file)
@@ -153,6 +153,7 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ {
        reorderSections: function() {
                var v = this.state.values,
                    n = this.state.creates,
+                   d = this.state.deletes,
                    r = this.state.reorder,
                    tasks = [];
 
@@ -166,10 +167,16 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ {
                for (var c in r) {
                        var o = [ ];
 
+                       // skip deletes within re-orders
+                       if (d[c])
+                               continue;
+
+                       // push creates
                        if (n[c])
                                for (var s in n[c])
                                        o.push(n[c][s]);
 
+                       // push values
                        for (var s in v[c])
                                o.push(v[c][s]);