Skip to content

Commit

Permalink
feat(Bpmnjs): Ensure that the user is fully informed about the conseq…
Browse files Browse the repository at this point in the history
…uences when deleting a task (#12702)

* feat(Bpmnjs): Override default action when deleting a task
  • Loading branch information
framitdavid authored Apr 24, 2024
1 parent 07edb5b commit 8f3eea8
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,33 @@ class SupportedContextPadProvider {
}

getContextPadEntries() {
const overrideDeleteEntry = (entries) => {
const deleteEntry = entries['delete'];
entries['delete'] = {
...deleteEntry,
action: {
click: function (event, element) {
if (element.type !== 'bpmn:Task') {
deleteEntry.action.click(event, element);
return;
}

const isConfirmed = confirm(
'Prosess-steget du vil slette kan være knyttet til en sidegruppe. Den kan inneholde visningsoppsett eller skjema du har satt opp. Hvis du sletter steget, sletter du også hele sidegruppen og alt som hører til.',
);

if (isConfirmed) {
deleteEntry.action.click(event, element);
}
},
},
};
};

return function (entries) {
// Should not be able to replace the entry
delete entries['replace'];
overrideDeleteEntry(entries);
return entries;
};
}
Expand Down

0 comments on commit 8f3eea8

Please sign in to comment.