From 86187d8f9cf38cb46e40847269c66b07fea6ed1f Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Fri, 26 Jan 2024 16:59:45 +0100 Subject: [PATCH] JNG-5442 fix validator generation errors (#307) --- .../hu/blackbelt/judo/ui/generator/react/UiActionsHelper.java | 4 ++-- .../src/main/resources/actor/src/dialogs/index.tsx.hbs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiActionsHelper.java b/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiActionsHelper.java index bbc88483..dd1a7f13 100644 --- a/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiActionsHelper.java +++ b/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiActionsHelper.java @@ -446,8 +446,8 @@ public static String actionTargetPageName(Action action) { return pageName(action.getTargetPageDefinition()); } - public static boolean createNestedValidation(RelationType relationType) { - return relationType != null && (relationType.getIsCreateValidatable() || (relationType.getIsMemberTypeTransient() && !relationType.getTarget().isIsMapped())); + public static boolean createNestedValidation(RelationType relationType, PageDefinition pageDefinition) { + return pageDefinition.getContainer().isForm() && relationType != null && (relationType.getIsCreateValidatable() || (relationType.getIsMemberTypeTransient() && !relationType.getTarget().isIsMapped())); } public static boolean skipNestedValidationBody(PageDefinition pageDefinition) { diff --git a/judo-ui-react/src/main/resources/actor/src/dialogs/index.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/dialogs/index.tsx.hbs index 18e729ee..e6761bd6 100644 --- a/judo-ui-react/src/main/resources/actor/src/dialogs/index.tsx.hbs +++ b/judo-ui-react/src/main/resources/actor/src/dialogs/index.tsx.hbs @@ -284,7 +284,7 @@ export default function {{ pageName page }}(props: {{ pageName page }}Props) { {{/ if }} }; {{# each page.container.links as |link| }} - {{# if (createNestedValidation link.relationType) }} + {{# if (createNestedValidation link.relationType page) }} const validate{{ firstToUpper link.relationType.name }} = async (linkData: {{ classDataName link.relationType.target '' }}): Promise => { {{# if link.relationType.isCreateValidatable }} await {{ getServiceImplForPage page }}.validateCreate({{# unless page.dataElement.isAccess }}ownerData, {{/ unless }}{ @@ -302,7 +302,7 @@ export default function {{ pageName page }}(props: {{ pageName page }}Props) { {{/ if }} {{/ each }} {{# each page.container.tables as |table| }} - {{# if (createNestedValidation table.relationType) }} + {{# if (createNestedValidation table.relationType page) }} const validate{{ firstToUpper table.relationType.name }} = async (tableData: {{ classDataName table.relationType.target '' }}): Promise => { {{# if table.relationType.isCreateValidatable }} await {{ getServiceImplForPage page }}.validateCreate({{# unless page.dataElement.isAccess }}ownerData, {{/ unless }}{