luci-base: uci.js: merge changes when retrieving entire sections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ba4e214160
)
This commit is contained in:
parent
fc43d4d41c
commit
cb5cf7c08f
1 changed files with 22 additions and 2 deletions
|
@ -489,8 +489,28 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* requested an entire section */
|
/* requested an entire section */
|
||||||
if (v[conf])
|
if (v[conf]) {
|
||||||
return v[conf][sid];
|
/* 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;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue