diff --git a/src/components/JoinMarkupsModal/index.js b/src/components/JoinMarkupsModal/index.js index d79030a5..e1eb29ca 100644 --- a/src/components/JoinMarkupsModal/index.js +++ b/src/components/JoinMarkupsModal/index.js @@ -132,7 +132,7 @@ const JoinMarkupsModal = ({ perspectiveId, onClose }) => { if (Object.keys(markupDict).length < 2) { onClose(); - throw new Error("Please set markups in both fields of the table"); + window.logger.warn(getTranslation("Please set markups in both fields of the table")); } setMarkupDict(markupDict); @@ -156,7 +156,7 @@ const JoinMarkupsModal = ({ perspectiveId, onClose }) => { for (const group of Object.values(groupDict)) { const ids = group["markups"].map(markup => markup.id); if (ids.includes(firstTextRelation) && ids.includes(secondTextRelation) && group.type === typeRelation) { - setWarnMessage("Such group already exists."); + window.logger.warn(getTranslation("Such group already exists.")); return; } } @@ -173,7 +173,7 @@ const JoinMarkupsModal = ({ perspectiveId, onClose }) => { setSecondTextRelation(null); setTypeRelation(null); - setSuccessMessage("The group was successfully added."); + window.logger.suc(getTranslation("The group was successfully added.")); }, [firstTextRelation, secondTextRelation, typeRelation, groupDict]); const onDeleteRelation = useCallback(() => { @@ -194,7 +194,7 @@ const JoinMarkupsModal = ({ perspectiveId, onClose }) => { setSelectedRelations([]); setSelectedTotal(0); - setSuccessMessage("The group was successfully deleted."); + window.logger.suc(getTranslation("The group was successfully deleted.")); }, [groupDict, selectedRelations]); const onRelationSelect = (relation_id, checked) => { diff --git a/src/components/LexicalEntryCorp/Text.js b/src/components/LexicalEntryCorp/Text.js index 68143c88..e659fa34 100644 --- a/src/components/LexicalEntryCorp/Text.js +++ b/src/components/LexicalEntryCorp/Text.js @@ -51,7 +51,10 @@ const TextEntityContent = ({ const client = useApolloClient(); const [deleteMarkupGroup] = useMutation(deleteMarkupGroupMutation, { - onCompleted: data => refetchLexicalEntries(data.delete_markup_group.entry_ids, client) + onCompleted: data => { + refetchLexicalEntries(data.delete_markup_group.entry_ids, client); + window.logger.suc(getTranslation("Markup(s) with related groups were removed")); + } }); const getTranslation = useContext(TranslationContext); @@ -220,6 +223,12 @@ const TextEntityContent = ({ }); } else { update(entity, undefined, result); + + if (action === "create_markup") { + window.logger.suc(getTranslation("Markup was created")); + } else if (action === "delete_markup") { + window.logger.suc(getTranslation("Markup was deleted")); + } } setBrowserSelection(null); }; @@ -390,7 +399,7 @@ const TextEntityContent = ({ {marking.action === "create_markup" && (