[FIX] website: remove loader when installing "new content" module fails

Before this commit, if installing a new module from the "new content"
modal would fail, the "Building your website" gif was not removed.
This commit removes it when the installation fails.

task-2687506

closes odoo/odoo#95955

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Younn Olivier
2022-07-18 18:41:29 +02:00
parent 204d26e76a
commit 06807ebdf8
@@ -152,10 +152,7 @@ export class NewContentModal extends Component {
});
}
async installModule(id, redirectUrl, moduleName) {
this.website.showLoader({
title: sprintf(this.env._t("Building your %s"), moduleName),
});
async installModule(id, redirectUrl) {
await this.orm.silent.call(
'ir.module.module',
'button_immediate_install',
@@ -190,9 +187,13 @@ export class NewContentModal extends Component {
}
return el;
});
this.website.showLoader({
title: sprintf(this.env._t("Building your %s"), name),
});
try {
await this.installModule(id, element.redirectUrl, name);
await this.installModule(id, element.redirectUrl);
} catch (error) {
this.website.hideLoader();
// Update the NewContentElement with failure icon and text.
this.state.newContentElements = this.state.newContentElements.map(el => {
if (el.moduleXmlId === element.moduleXmlId) {