feat: Add save confirmation modal when leaving sharing modal (#4683)

This commit is contained in:
Alex Grozav
2022-11-22 13:03:15 +02:00
committed by GitHub
parent 249b7eba15
commit 173badc4e0
2 changed files with 24 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
:eventBus="modalBus"
:name="WORKFLOW_SHARE_MODAL_KEY"
:center="true"
:beforeClose="onCloseModal"
>
<template #content>
<div :class="$style.container">
@@ -242,6 +243,25 @@ export default mixins(
this.onRemoveSharee(user.id);
}
},
async onCloseModal() {
if (this.isDirty) {
const shouldSave = await this.confirmMessage(
this.$locale.baseText(
'workflows.shareModal.saveBeforeClose.message',
),
this.$locale.baseText('workflows.shareModal.saveBeforeClose.title'),
'warning',
this.$locale.baseText('workflows.shareModal.saveBeforeClose.confirmButtonText'),
this.$locale.baseText('workflows.shareModal.saveBeforeClose.cancelButtonText'),
);
if (shouldSave) {
return await this.onSave();
}
}
return true;
},
async loadUsers() {
await this.usersStore.fetchUsers();
},