From 967eabde5149de460c57f596dc123a9a213b8a11 Mon Sep 17 00:00:00 2001
From: Ivan <8611739+IRBorisov@users.noreply.github.com>
Date: Thu, 1 Aug 2024 11:55:45 +0300
Subject: [PATCH] F: Improve RSForm UI for inherited cst
---
rsconcept/backend/apps/oss/views/oss.py | 2 +-
rsconcept/frontend/src/components/Icons.tsx | 2 ++
.../components/select/PickSubstitutions.tsx | 6 ++++++
.../components/select/SelectConstituenta.tsx | 2 +-
.../ManualsPage/items/HelpCstAttributes.tsx | 2 +-
.../pages/ManualsPage/items/HelpCstEditor.tsx | 1 -
.../pages/ManualsPage/items/HelpPortal.tsx | 2 +-
.../ManualsPage/items/HelpRSFormCard.tsx | 7 +++----
.../ManualsPage/items/HelpRSFormItems.tsx | 19 +++++++++++--------
.../ManualsPage/items/HelpRSLangCorrect.tsx | 3 +--
.../ManualsPage/items/HelpRSLangInterpret.tsx | 3 +--
.../items/HelpRSLangOperations.tsx | 7 +++----
.../pages/ManualsPage/items/HelpTermGraph.tsx | 14 ++++++++------
.../EditorConstituenta/EditorConstituenta.tsx | 2 +-
.../EditorConstituenta/FormConstituenta.tsx | 17 ++++++++++++-----
.../ToolbarConstituenta.tsx | 8 +++++++-
.../EditorRSFormCard/EditorLibraryItem.tsx | 2 +-
.../EditorRSFormCard/FormRSForm.tsx | 3 ++-
.../EditorRSFormCard/ToolbarVersioning.tsx | 16 ++++++++++++----
.../RSFormPage/EditorRSList/EditorRSList.tsx | 4 ++--
.../RSFormPage/EditorRSList/ToolbarRSList.tsx | 4 ++--
.../EditorTermGraph/EditorTermGraph.tsx | 6 +++---
.../EditorTermGraph/ToolbarTermGraph.tsx | 2 +-
.../RSFormPage/EditorTermGraph/ViewHidden.tsx | 9 ++++++++-
.../src/pages/RSFormPage/RSEditContext.tsx | 14 ++++++++++----
rsconcept/frontend/src/utils/labels.ts | 3 ++-
26 files changed, 102 insertions(+), 58 deletions(-)
diff --git a/rsconcept/backend/apps/oss/views/oss.py b/rsconcept/backend/apps/oss/views/oss.py
index e436ec9b..0a07471b 100644
--- a/rsconcept/backend/apps/oss/views/oss.py
+++ b/rsconcept/backend/apps/oss/views/oss.py
@@ -253,7 +253,7 @@ class OssViewSet(viewsets.GenericViewSet, generics.ListAPIView, generics.Retriev
if operation.result is not None:
can_edit = permissions.can_edit_item(request.user, operation.result)
- if can_edit:
+ if can_edit or operation.operation_type == m.OperationType.SYNTHESIS:
operation.result.alias = operation.alias
operation.result.title = operation.title
operation.result.comment = operation.comment
diff --git a/rsconcept/frontend/src/components/Icons.tsx b/rsconcept/frontend/src/components/Icons.tsx
index c9a507d1..f35f6252 100644
--- a/rsconcept/frontend/src/components/Icons.tsx
+++ b/rsconcept/frontend/src/components/Icons.tsx
@@ -63,6 +63,8 @@ export { IoLibrary as IconLibrary2 } from 'react-icons/io5';
export { BiDiamond as IconTemplates } from 'react-icons/bi';
export { GiHoneycomb as IconOSS } from 'react-icons/gi';
export { LuBaby as IconChild } from 'react-icons/lu';
+export { RiParentLine as IconParent } from 'react-icons/ri';
+export { TbOld as IconPredecessor } from 'react-icons/tb';
export { RiHexagonLine as IconRSForm } from 'react-icons/ri';
export { LuArchive as IconArchive } from 'react-icons/lu';
export { LuDatabase as IconDatabase } from 'react-icons/lu';
diff --git a/rsconcept/frontend/src/components/select/PickSubstitutions.tsx b/rsconcept/frontend/src/components/select/PickSubstitutions.tsx
index 46fa9a2d..3fc50fe4 100644
--- a/rsconcept/frontend/src/components/select/PickSubstitutions.tsx
+++ b/rsconcept/frontend/src/components/select/PickSubstitutions.tsx
@@ -110,6 +110,12 @@ function PickSubstitutions({
toast.error(errors.reuseOriginal);
return;
}
+ if (leftArgument === rightArgument) {
+ if ((deleteRight && rightCst?.is_inherited) || (!deleteRight && leftCst?.is_inherited)) {
+ toast.error(errors.substituteInherited);
+ return;
+ }
+ }
setSubstitutions(prev => [...prev, newSubstitution]);
setLeftCst(undefined);
setRightCst(undefined);
diff --git a/rsconcept/frontend/src/components/select/SelectConstituenta.tsx b/rsconcept/frontend/src/components/select/SelectConstituenta.tsx
index a1bd6631..9d7f99f0 100644
--- a/rsconcept/frontend/src/components/select/SelectConstituenta.tsx
+++ b/rsconcept/frontend/src/components/select/SelectConstituenta.tsx
@@ -32,7 +32,7 @@ function SelectConstituenta({
return (
items?.map(cst => ({
value: cst.id,
- label: `${cst.alias}: ${describeConstituenta(cst)}`
+ label: `${cst.alias}${cst.is_inherited ? '*' : ''}: ${describeConstituenta(cst)}`
})) ?? []
);
}, [items]);
diff --git a/rsconcept/frontend/src/pages/ManualsPage/items/HelpCstAttributes.tsx b/rsconcept/frontend/src/pages/ManualsPage/items/HelpCstAttributes.tsx
index a5ce1b41..34fbc591 100644
--- a/rsconcept/frontend/src/pages/ManualsPage/items/HelpCstAttributes.tsx
+++ b/rsconcept/frontend/src/pages/ManualsPage/items/HelpCstAttributes.tsx
@@ -1,6 +1,6 @@
import { HelpTopic } from '@/models/miscellaneous';
-import LinkTopic from '../../../components/ui/LinkTopic';
+import LinkTopic from '@/components/ui/LinkTopic';
function HelpCstAttributes() {
return (
diff --git a/rsconcept/frontend/src/pages/ManualsPage/items/HelpCstEditor.tsx b/rsconcept/frontend/src/pages/ManualsPage/items/HelpCstEditor.tsx
index 3b066e7e..a2a45cbb 100644
--- a/rsconcept/frontend/src/pages/ManualsPage/items/HelpCstEditor.tsx
+++ b/rsconcept/frontend/src/pages/ManualsPage/items/HelpCstEditor.tsx
@@ -74,7 +74,6 @@ function HelpCstEditor() {
+