diff options
author | Jo-Philipp Wich <jo@mein.io> | 2023-02-04 21:03:51 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2023-02-04 21:03:51 +0100 |
commit | 6fe34990265a02dac20f7b352e4039a90fed45ca (patch) | |
tree | 4b2f6060e891b5c26383c9239126703eff25043f /modules | |
parent | 30fa6bcc66118e3c60e8f5b1b77b6a68b5b89328 (diff) |
luci-base: form.js: fix GridSection modals in JSONMap instances
Since grid section edit modals construct a new Map instance internally,
we must take care of using the correct map constructor type for the
internal copy in order to end up with the correct data provider.
Ensure that the extended option modal of GridSection instances uses a
JSONMap when the grid section's owner map is a JSONMap to avoid stray
uci related errors.
Ref: https://forum.openwrt.org/t/luci-save-apply/149658/5
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/form.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index df0a63a4a1..4edfc7e135 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -3211,8 +3211,14 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p return (stackedMap ? activeMap.save(null, true) : Promise.resolve()).then(L.bind(function() { section_id = sref['.name']; - var m = new CBIMap(parent.config, null, null), - s = m.section(CBINamedSection, section_id, this.sectiontype); + var m; + + if (parent instanceof CBIJSONMap) + m = new CBIJSONMap(parent.data.data, null, null); + else + m = new CBIMap(parent.config, null, null); + + var s = m.section(CBINamedSection, section_id, this.sectiontype); m.parent = parent; m.section = section_id; |