Commit 73809c3d authored by Łukasz Nowak's avatar Łukasz Nowak

erp5_web_monitoring: Avoid redirection in render

It's a workaround for issue in monitor resulting with infinite recursion after
clicking delete button.
parent 1b6dcf48
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
redirect_options = { redirect_options = {
jio_key: result.data.rows[0].id jio_key: result.data.rows[0].id
}; };
return gadget.redirect({"command": "index", options: redirect_options}); return gadget.redirectByJob({"command": "index", options: redirect_options});
} }
redirect_options = { redirect_options = {
extended_search: gadget.state.query extended_search: gadget.state.query
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
} else if (gadget.state.portal_type === "promise") { } else if (gadget.state.portal_type === "promise") {
redirect_options.page = "ojsm_status_list"; redirect_options.page = "ojsm_status_list";
} }
return gadget.redirect({"command": "display", options: redirect_options}); return gadget.redirectByJob({"command": "display", options: redirect_options});
}); });
} }
...@@ -75,6 +75,9 @@ ...@@ -75,6 +75,9 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareJob("redirectByJob", function (options) {
return this.redirect(options);
})
.declareMethod("triggerSubmit", function () { .declareMethod("triggerSubmit", function () {
var argument_list = arguments; var argument_list = arguments;
return this.getDeclaredGadget('form_view') return this.getDeclaredGadget('form_view')
...@@ -146,7 +149,7 @@ ...@@ -146,7 +149,7 @@
page: 'ojsm_dispatch' page: 'ojsm_dispatch'
}) })
.push(function () { .push(function () {
return gadget.redirect({command: 'change', options: { return gadget.redirectByJob({command: 'change', options: {
page: "ojsm_erp5_configurator", page: "ojsm_erp5_configurator",
type: "erp5" type: "erp5"
}}); }});
......
...@@ -12,7 +12,9 @@ ...@@ -12,7 +12,9 @@
.declareAcquiredMethod("jio_remove", "jio_remove") .declareAcquiredMethod("jio_remove", "jio_remove")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting") .declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted') .declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareJob("redirectByJob", function (options) {
return this.redirect(options);
})
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
...@@ -24,7 +26,7 @@ ...@@ -24,7 +26,7 @@
return gadget.notifySubmitted({message: "Document Deleted", status: "success"}); return gadget.notifySubmitted({message: "Document Deleted", status: "success"});
}) })
.push(function () { .push(function () {
return gadget.redirect({command: 'change', options: { return gadget.redirectByJob({command: 'change', options: {
page: options.return_url || 'settings_configurator' page: options.return_url || 'settings_configurator'
}}); }});
}); });
......
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting") .declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting") .declareAcquiredMethod("setSetting", "setSetting")
.declareJob("redirectByJob", function (options) {
return this.redirect(options);
})
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
return this.updateHeader({ return this.updateHeader({
...@@ -30,7 +32,7 @@ ...@@ -30,7 +32,7 @@
// reset redirections // reset redirections
return gadget.setSetting("sync_redirect_options", undefined) return gadget.setSetting("sync_redirect_options", undefined)
.push(function () { .push(function () {
return gadget.redirect({ return gadget.redirectByJob({
"command": "display", "command": "display",
"options": redirect_options "options": redirect_options
}); });
...@@ -44,7 +46,7 @@ ...@@ -44,7 +46,7 @@
} }
}) })
.push(function () { .push(function () {
return gadget.redirect({ return gadget.redirectByJob({
"command": "display", "command": "display",
"options": redirect_options "options": redirect_options
}); });
......
...@@ -195,6 +195,9 @@ ...@@ -195,6 +195,9 @@
.declareMethod("triggerSubmit", function (event) { .declareMethod("triggerSubmit", function (event) {
return this.element.querySelector('form button[type="submit"]').click(); return this.element.querySelector('form button[type="submit"]').click();
}) })
.declareJob("redirectByJob", function (options) {
return this.redirect(options);
})
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this, var gadget = this,
last_sync_time, last_sync_time,
...@@ -207,7 +210,7 @@ ...@@ -207,7 +210,7 @@
if (options.url) { if (options.url) {
// backward compatibility redirect to add opml // backward compatibility redirect to add opml
options.page = "ojsm_opml_add"; options.page = "ojsm_opml_add";
return gadget.redirect({"command": "change", "options": options}); return gadget.redirectByJob({"command": "change", "options": options});
} }
return new RSVP.Queue() return new RSVP.Queue()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment