summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-06-06 21:02:04 +0200
committerJo-Philipp Wich <jo@mein.io>2019-07-07 15:36:25 +0200
commitbf3bf6a8a971120148f24052a2699a32cae32730 (patch)
tree16a8f05ba5c23dd105a4a792cc81442141fca6f1 /modules/luci-base/htdocs/luci-static
parent4a0f8b55415b48d2d28475f3844558691ea891c5 (diff)
luci-base: form.js: prevent section creation on modal cbi save failure
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index 9351bae035..c4f3b8aece 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -120,7 +120,10 @@ var CBIMap = CBINode.extend({
.then(uci.save.bind(uci))
.then(this.load.bind(this))
.then(this.renderContents.bind(this))
- .catch(function() { alert('Cannot save due to invalid values') });
+ .catch(function(e) {
+ alert('Cannot save due to invalid values')
+ return Promise.reject();
+ });
},
reset: function() {
@@ -1049,13 +1052,14 @@ var CBITableSection = CBITypedSection.extend({
},
handleModalCancel: function(modalMap, ev) {
- L.ui.hideModal();
+ return Promise.resolve(L.ui.hideModal());
},
handleModalSave: function(modalMap, ev) {
- modalMap.save()
+ return modalMap.save()
.then(L.bind(this.map.reset, this.map))
- .then(L.ui.hideModal);
+ .then(L.ui.hideModal)
+ .catch(function() {});
},
renderMoreOptionsModal: function(section_id, ev) {
@@ -1139,8 +1143,8 @@ var CBIGridSection = CBITableSection.extend({
},
handleModalSave: function(/* ... */) {
- this.super('handleModalSave', arguments);
- this.addedSection = null;
+ return this.super('handleModalSave', arguments)
+ .then(L.bind(function() { this.addedSection = null }, this));
},
handleModalCancel: function(/* ... */) {
@@ -1151,7 +1155,7 @@ var CBIGridSection = CBITableSection.extend({
this.addedSection = null;
}
- this.super('handleModalCancel', arguments);
+ return this.super('handleModalCancel', arguments);
},
renderUCISection: function(section_id) {