Skip to content

Commit

Permalink
[REF] web, website, website_forum, *: remove crash manager from frontend
Browse files Browse the repository at this point in the history
*: test_website

In a previous commit, the new services and environment were made
available in the frontend. This now allows errors to be handled by the
new error service, and makes the legacy crash manager redundant. This
commit removes it.

Part of odoo#72675

Related: odoo/enterprise#19258
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
  • Loading branch information
sdegueldre committed Jul 14, 2021
1 parent 95504aa commit 57ba855
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 454 deletions.
4 changes: 2 additions & 2 deletions addons/test_website/static/tests/tours/error_views.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ tour.register('test_error_website', {
trigger: 'a[href="/test_internal_error_json"]',
}, {
content: "rpc error 500 modal is an ErrorDialog",
extra_trigger: 'div.o_dialog_error.modal-body div.alert.alert-warning',
trigger: 'button.btn.btn-primary[type="button"]',
extra_trigger: 'div.o_dialog_error.modal-content div.alert.alert-warning',
trigger: '.modal-footer button.btn.btn-primary',
},
// HTTP ERROR
{
Expand Down
3 changes: 3 additions & 0 deletions addons/web/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
# TODO: split debug files correctly when converting frontend debug
# manager so we don't need action-service and stuff
('remove', 'web/static/src/core/debug/**/*'),
'web/static/src/public/error_notifications.js',

'web/static/src/legacy/scss/base_frontend.scss',
'web/static/src/legacy/scss/lazyloader.scss',
Expand All @@ -219,6 +220,8 @@
'web/static/src/legacy/js/public/public_root.js',
'web/static/src/legacy/js/public/public_root_instance.js',
'web/static/src/legacy/js/public/public_widget.js',
'web/static/src/legacy/legacy_promise_error_handler.js',
'web/static/src/legacy/legacy_rpc_error_handler.js',

('include', 'web.frontend_legacy'),
],
Expand Down
20 changes: 13 additions & 7 deletions addons/web/static/src/core/errors/error_dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ import { capitalize } from "../utils/strings";
const { hooks } = owl;
const { useState } = hooks;

const odooExceptionTitleMap = new Map();

odooExceptionTitleMap.set("odoo.exceptions.AccessDenied", _lt("Access Denied"));
odooExceptionTitleMap.set("odoo.exceptions.AccessError", _lt("Access Error"));
odooExceptionTitleMap.set("odoo.exceptions.MissingError", _lt("Missing Record"));
odooExceptionTitleMap.set("odoo.exceptions.UserError", _lt("User Error"));
odooExceptionTitleMap.set("odoo.exceptions.ValidationError", _lt("Validation Error"));
export const odooExceptionTitleMap = new Map(
Object.entries({
"odoo.addons.base.models.ir_mail_server.MailDeliveryException": _lt(
"MailDeliveryException"
),
"odoo.exceptions.AccessDenied": _lt("Access Denied"),
"odoo.exceptions.MissingError": _lt("Missing Record"),
"odoo.exceptions.UserError": _lt("User Error"),
"odoo.exceptions.ValidationError": _lt("Validation Error"),
"odoo.exceptions.AccessError": _lt("Access Error"),
"odoo.exceptions.Warning": _lt("Warning")
})
);

// -----------------------------------------------------------------------------
// Generic Error Dialog
Expand Down
16 changes: 8 additions & 8 deletions addons/web/static/src/core/notifications/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ Notification.props = {
return (
typeof m === "string" || (typeof m === "object" && typeof m.toString === "function")
);
},
}
},
title: { type: [String, Boolean], optional: true },
title: { type: [String, Boolean, { toString: Function }], optional: true },
type: {
type: String,
optional: true,
validate: (t) => ["warning", "danger", "success", "info"].includes(t),
validate: (t) => ["warning", "danger", "success", "info"].includes(t)
},
messageIsHtml: { type: Boolean, optional: true },
className: { type: String, optional: true },
Expand All @@ -58,15 +58,15 @@ Notification.props = {
name: { type: String },
icon: { type: String, optional: true },
primary: { type: Boolean, optional: true },
onClick: Function,
},
},
onClick: Function
}
}
},
onClose: { type: Function, optional: true },
onClose: { type: Function, optional: true }
};
Notification.defaultProps = {
buttons: [],
className: "",
messageIsHtml: false,
type: "warning",
type: "warning"
};
Loading

0 comments on commit 57ba855

Please sign in to comment.