diff --git a/processes-webapp/src/main/webapp/vue-app/processes/components/Processes.vue b/processes-webapp/src/main/webapp/vue-app/processes/components/Processes.vue index 2af13de59..9c58f355d 100644 --- a/processes-webapp/src/main/webapp/vue-app/processes/components/Processes.vue +++ b/processes-webapp/src/main/webapp/vue-app/processes/components/Processes.vue @@ -45,50 +45,6 @@ - - - - - {{ message }} - - - - {{ messageActionLabel }} - - - - - { - this.alert = false; + this.closeAlert(); }); this.$root.$on('add-work', work => { this.addWork(work); @@ -304,8 +259,9 @@ export default { }); this.$root.$on('update-url-path', this.handleUpdateUrlPath); this.$root.$on('keep-work-draft', () => { - this.alert = false; + this.closeAlert(); }); + document.addEventListener('alert-message-dismissed', this.handleMessageClose); }, mounted() { window.setTimeout(() => { @@ -342,13 +298,15 @@ export default { this.deleteWorkDraftById(this.messageTargetModel); this.messageTargetModel = null; } - this.alert = false; }, handleMessageAction() { if (this.messageAction) { this.$root.$emit(this.messageAction); } }, + closeAlert() { + document.dispatchEvent(new CustomEvent('close-alert-message')); + }, handleUpdateUrlPath(data, path) { window.history.pushState(data, '', `${eXo.env.portal.context}/${eXo.env.portal.portalName}/processes${path}`); }, @@ -511,19 +469,16 @@ export default { }).finally(() => this.loading = false); }, displayMessage(alert) { - clearTimeout(this.messageTimer); - this.message = alert.message; - this.type = alert.type; - this.messageActionLabel = alert.messageActionLabel; - this.messageTargetModel = alert.messageTargetModel || null; this.messageAction = alert.messageAction || null; - this.alert = true; - this.messageTimer = setTimeout(() => { - if (this.alert) { - this.alert = false; - this.handleMessageClose(); + this.messageTargetModel = alert.messageTargetModel || null; + document.dispatchEvent(new CustomEvent('alert-message', { + detail: { + alertMessage: alert?.message, + alertType: alert?.type, + alertLinkText: alert?.messageActionLabel, + alertLinkCallback: this.messageAction && this.handleMessageAction || null, } - }, 5000); + })); }, addNewWorkFlow(workflow) { this.saving = true;