diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-04-28 09:46:22 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-04-28 09:47:08 +0200 |
commit | 17ffc84a2903c2354543cd0fb575a82e36e076fd (patch) | |
tree | 17d6eca0d34c73f9ee41fb12f238ecc6f3814034 | |
parent | a8d85ed71a14c85bbfca0532bb721f5f89a39845 (diff) |
luci-base: form.js: allow secondary configs to fail loading
Ref: https://forum.openwrt.org/t/luci-rpc-error/61760
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/form.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 9e0a80ad33..987640f000 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -531,12 +531,15 @@ var CBIMap = CBIAbstractElement.extend(/** @lends LuCI.form.Map.prototype */ { * an error. */ load: function() { - var doCheckACL = (!(this instanceof CBIJSONMap) && this.readonly == null); + var doCheckACL = (!(this instanceof CBIJSONMap) && this.readonly == null), + loadTasks = [ doCheckACL ? callSessionAccess('uci', this.config, 'write') : true ], + configs = this.parsechain || [ this.config ]; - return Promise.all([ - doCheckACL ? callSessionAccess('uci', this.config, 'write') : true, - this.data.load(this.parsechain || [ this.config ]) - ]).then(L.bind(function(res) { + loadTasks.push.apply(loadTasks, configs.map(L.bind(function(config, i) { + return i ? L.resolveDefault(this.data.load(config)) : this.data.load(config); + }, this))); + + return Promise.all(loadTasks).then(L.bind(function(res) { if (res[0] === false) this.readonly = true; |