summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/form.js
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-05-16 11:49:28 +0200
committerJo-Philipp Wich <jo@mein.io>2022-05-16 13:39:36 +0200
commit0c81e25faa9ff9cb6edec477d56145d70be87cf3 (patch)
treee1d9192ec605834287bd9415fbcc2d191ef86c79 /modules/luci-base/htdocs/luci-static/resources/form.js
parent818776451d96e8f1a187eafca4a5ebbf0770fbde (diff)
luci-base: form.js: reset parent maps on returning from nested section modal
The nested section modal might have changed values also covered/displayed by the parent map, so ensure to reload all parent maps in the current modal view stack to ensure that no stale values are shown on return. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/form.js')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index eb7a2572d4..6786d3d234 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -2994,10 +2994,20 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p
/** @private */
handleModalCancel: function(modalMap, ev) {
- var prevNode = this.getPreviousModalMap();
+ var prevNode = this.getPreviousModalMap(),
+ resetTasks = Promise.resolve();
if (prevNode) {
- var heading = prevNode.parentNode.querySelector('h4');
+ var heading = prevNode.parentNode.querySelector('h4'),
+ prevMap = dom.findClassInstance(prevNode);
+
+ while (prevMap) {
+ resetTasks = resetTasks
+ .then(L.bind(prevMap.load, prevMap))
+ .then(L.bind(prevMap.reset, prevMap));
+
+ prevMap = prevMap.parent;
+ }
prevNode.classList.add('flash');
prevNode.classList.remove('hidden');
@@ -3014,7 +3024,7 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p
ui.hideModal();
}
- return Promise.resolve();
+ return resetTasks;
},
/** @private */