luci-base: form.js: fix handling of array sections in JSONMap forms
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
2aeaa1e37b
commit
682f628ea6
1 changed files with 11 additions and 11 deletions
|
@ -27,17 +27,7 @@ var CBIJSONConfig = baseclass.extend({
|
||||||
if (!data.hasOwnProperty(sectiontype))
|
if (!data.hasOwnProperty(sectiontype))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (L.isObject(data[sectiontype])) {
|
if (Array.isArray(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])) {
|
|
||||||
for (var i = 0, index = 0; i < data[sectiontype].length; i++) {
|
for (var i = 0, index = 0; i < data[sectiontype].length; i++) {
|
||||||
var item = data[sectiontype][i],
|
var item = data[sectiontype][i],
|
||||||
anonymous, name;
|
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) {
|
section_ids.sort(L.bind(function(a, b) {
|
||||||
|
|
Loading…
Reference in a new issue