diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-06-14 16:41:02 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-06-14 16:41:49 +0200 |
commit | 682f628ea611d8d12a2a4b5925851f99c5a4bd20 (patch) | |
tree | d5c592d5db0f1f302c540e3e56b2ce80ff925738 /modules/luci-base | |
parent | 2aeaa1e37bab47746c48b4917f7b3247c096f258 (diff) |
luci-base: form.js: fix handling of array sections in JSONMap forms
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/form.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index c86f75785c..a50d457e21 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -27,17 +27,7 @@ var CBIJSONConfig = baseclass.extend({ if (!data.hasOwnProperty(sectiontype)) continue; - if (L.isObject(data[sectiontype])) { - this.data[sectiontype] = Object.assign(data[sectiontype], { - '.anonymous': false, - '.name': sectiontype, - '.type': sectiontype - }); - - section_ids.push(sectiontype); - num_sections++; - } - else if (Array.isArray(data[sectiontype])) { + if (Array.isArray(data[sectiontype])) { for (var i = 0, index = 0; i < data[sectiontype].length; i++) { var item = data[sectiontype][i], anonymous, name; @@ -65,6 +55,16 @@ var CBIJSONConfig = baseclass.extend({ }); } } + else if (L.isObject(data[sectiontype])) { + this.data[sectiontype] = Object.assign(data[sectiontype], { + '.anonymous': false, + '.name': sectiontype, + '.type': sectiontype + }); + + section_ids.push(sectiontype); + num_sections++; + } } section_ids.sort(L.bind(function(a, b) { |