diff options
Diffstat (limited to 'addons/web/static/src')
3 files changed, 64 insertions, 8 deletions
diff --git a/addons/web/static/src/js/public/public_crash_manager.js b/addons/web/static/src/js/public/public_crash_manager.js new file mode 100644 index 00000000000..450753e51ad --- /dev/null +++ b/addons/web/static/src/js/public/public_crash_manager.js @@ -0,0 +1,33 @@ +odoo.define('web.PublicCrashManager', function (require) { +"use strict"; + +const core = require('web.core'); +const CrashManager = require('web.CrashManager').CrashManager; + +const PublicCrashManager = CrashManager.extend({ + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + + /** + * @override + */ + _displayWarning(message, title, subtitle, options) { + this.displayNotification({ + ...options, + title, + message, + subtitle, + sticky: true, + }); + }, +}); + +core.serviceRegistry.add('crash_manager', PublicCrashManager); + +return { + CrashManager: PublicCrashManager, +}; + +}); diff --git a/addons/web/static/src/js/services/crash_manager.js b/addons/web/static/src/js/services/crash_manager.js index 90c04df7292..6baca444788 100644 --- a/addons/web/static/src/js/services/crash_manager.js +++ b/addons/web/static/src/js/services/crash_manager.js @@ -249,12 +249,7 @@ var CrashManager = AbstractService.extend({ var message = error.data ? error.data.message : error.message; var title = _.str.capitalize(error.type) || _t("Oops Something went wrong !"); var subtitle = error.data ? error.data.title : error.title; - this.displayNotification(_.extend({ - title: title, - message: message, - subtitle: subtitle, - sticky: true, - }, options)); + return this._displayWarning(message, title, subtitle, options); }, show_error: function (error) { if (!active) { @@ -311,6 +306,27 @@ var CrashManager = AbstractService.extend({ data: {debug: ""} }); }, + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + + /** + * @private + * @param {string} message + * @param {string} title + * @param {string} subtitle + * @param {Object} options + */ + _displayWarning: function (message, title, subtitle, options) { + return new WarningDialog(this, { + ...options, + title, + subtitle, + }, { + message, + }).open(); + }, }); /** @@ -385,8 +401,6 @@ core.crash_registry.add('504', function (cm) { }; }); -core.serviceRegistry.add('crash_manager', CrashManager); - return { CrashManager: CrashManager, ErrorDialog: ErrorDialog, diff --git a/addons/web/static/src/js/services/crash_manager_service.js b/addons/web/static/src/js/services/crash_manager_service.js new file mode 100644 index 00000000000..44182561a1b --- /dev/null +++ b/addons/web/static/src/js/services/crash_manager_service.js @@ -0,0 +1,9 @@ +odoo.define('crash_manager.service', function (require) { +'use strict'; + +const core = require('web.core'); +const CrashManager = require('web.CrashManager').CrashManager; + +core.serviceRegistry.add('crash_manager', CrashManager); + +}); |
