luci-base: uci.js: merge changes when retrieving entire sections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
7d49508480
commit
ba4e214160
1 changed files with 22 additions and 2 deletions
|
@ -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;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue