luci-base: form.js: reuse JSONMap data provider in GridSection modals

Reuse the same data provider as the parent JSONMap instance in order
to avoid inadvertently mangling the form data when saving the modal
edit dialog.

Fixes: bb9ede238a ("luci-base: form.js: reuse JSONMap data provider in GridSection modals")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2023-02-04 22:15:42 +01:00
parent 6fe3499026
commit dd47f3f674

View file

@ -3213,10 +3213,13 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p
var m; var m;
if (parent instanceof CBIJSONMap) if (parent instanceof CBIJSONMap) {
m = new CBIJSONMap(parent.data.data, null, null); m = new CBIJSONMap(null, null, null);
else m.data = parent.data;
}
else {
m = new CBIMap(parent.config, null, null); m = new CBIMap(parent.config, null, null);
}
var s = m.section(CBINamedSection, section_id, this.sectiontype); var s = m.section(CBINamedSection, section_id, this.sectiontype);