diff options
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/uci.js')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/uci.js | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/uci.js b/modules/luci-base/htdocs/luci-static/resources/uci.js index f381e0b649..e6582b3e2c 100644 --- a/modules/luci-base/htdocs/luci-static/resources/uci.js +++ b/modules/luci-base/htdocs/luci-static/resources/uci.js @@ -31,44 +31,50 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ { object: 'uci', method: 'get', params: [ 'config' ], - expect: { values: { } } + expect: { values: { } }, + reject: true }), - callOrder: rpc.declare({ object: 'uci', method: 'order', - params: [ 'config', 'sections' ] + params: [ 'config', 'sections' ], + reject: true }), callAdd: rpc.declare({ object: 'uci', method: 'add', params: [ 'config', 'type', 'name', 'values' ], - expect: { section: '' } + expect: { section: '' }, + reject: true }), callSet: rpc.declare({ object: 'uci', method: 'set', - params: [ 'config', 'section', 'values' ] + params: [ 'config', 'section', 'values' ], + reject: true }), callDelete: rpc.declare({ object: 'uci', method: 'delete', - params: [ 'config', 'section', 'options' ] + params: [ 'config', 'section', 'options' ], + reject: true }), callApply: rpc.declare({ object: 'uci', method: 'apply', - params: [ 'timeout', 'rollback' ] + params: [ 'timeout', 'rollback' ], + reject: true }), callConfirm: rpc.declare({ object: 'uci', - method: 'confirm' + method: 'confirm', + reject: true }), @@ -547,9 +553,13 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ { c[conf][sid] = {}; /* undelete option */ - if (d[conf] && d[conf][sid]) + if (d[conf] && d[conf][sid]) { d[conf][sid] = d[conf][sid].filter(function(o) { return o !== opt }); + if (d[conf][sid].length == 0) + delete d[conf][sid]; + } + c[conf][sid][opt] = val; } else { @@ -784,22 +794,22 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ { if (n) for (var conf in n) { for (var sid in n[conf]) { - var r = { + var p = { config: conf, values: { } }; for (var k in n[conf][sid]) { if (k == '.type') - r.type = n[conf][sid][k]; + p.type = n[conf][sid][k]; else if (k == '.create') - r.name = n[conf][sid][k]; + p.name = n[conf][sid][k]; else if (k.charAt(0) != '.') - r.values[k] = n[conf][sid][k]; + p.values[k] = n[conf][sid][k]; } snew.push(n[conf][sid]); - tasks.push(self.callAdd(r.config, r.type, r.name, r.values)); + tasks.push(self.callAdd(p.config, p.type, p.name, p.values)); } pkgs[conf] = true; |