diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-03-29 22:29:36 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-03-29 22:35:50 +0200 |
commit | ba4e214160619e27b88a3929c76a1a01c9c1b1e2 (patch) | |
tree | 92d0d75e19ac95b6bc667e06634b6a6b2913667b /modules/luci-base/htdocs/luci-static/resources | |
parent | 7d49508480446febe4ed0de929f83ea923c98324 (diff) |
luci-base: uci.js: merge changes when retrieving entire sections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/uci.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/uci.js b/modules/luci-base/htdocs/luci-static/resources/uci.js index cbaeb8c080..41e902c5fe 100644 --- a/modules/luci-base/htdocs/luci-static/resources/uci.js +++ b/modules/luci-base/htdocs/luci-static/resources/uci.js @@ -489,8 +489,28 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ { } /* requested an entire section */ - if (v[conf]) - return v[conf][sid]; + if (v[conf]) { + /* check whether entire section was deleted */ + if (d[conf] && d[conf][sid] === true) + return null; + + var s = v[conf][sid] || null; + + if (s) { + /* merge changes */ + if (c[conf] && c[conf][sid]) + for (var opt in c[conf][sid]) + if (c[conf][sid][opt] != null) + s[opt] = c[conf][sid][opt]; + + /* merge deletions */ + if (d[conf] && d[conf][sid]) + for (var opt in d[conf][sid]) + delete s[opt]; + } + + return s; + } return null; }, |