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 8a55985f..3e5e1f33 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 @@ -214,6 +214,26 @@ public static String getDialogOpenParameters(PageDefinition pageDefinition) { return String.join(", ", result); } + public static String getFormOpenParameters(PageDefinition pageDefinition, Action action) { + List tokens = new ArrayList<>(); + + if (action.getActionDefinition().getTargetType() != null) { + tokens.add("target"); + } else { + if (pageDefinition.getContainer().isTable()) { + if (pageDefinition.getRelationType() != null && !pageDefinition.getRelationType().isIsAccess()) { + tokens.add("{ __signedIdentifier: signedIdentifier } as JudoIdentifiable"); + } else { + tokens.add("null as any"); + } + } else { + tokens.add("data"); + } + } + + return String.join(", ", tokens); + } + public static String getSelectorOpenActionParameters(Action action, PageContainer container) { List tokens = new ArrayList<>(); if (container.isTable()) { diff --git a/judo-ui-react/src/main/resources/actor/src/pages/actions/OpenFormAction.fragment.hbs b/judo-ui-react/src/main/resources/actor/src/pages/actions/OpenFormAction.fragment.hbs index a6cb7f80..4bfe3d63 100644 --- a/judo-ui-react/src/main/resources/actor/src/pages/actions/OpenFormAction.fragment.hbs +++ b/judo-ui-react/src/main/resources/actor/src/pages/actions/OpenFormAction.fragment.hbs @@ -1,5 +1,5 @@ const {{ simpleActionDefinitionName action.actionDefinition }} = async ({{# if action.actionDefinition.targetType }}target: {{ classDataName action.actionDefinition.targetType 'Stored' }}, templateDataOverride?: {{ classDataName action.actionDefinition.targetType '' }}{{/ if}}) => { - const { result, data: returnedData } = await open{{ pageName action.targetPageDefinition }}({{# if action.actionDefinition.targetType }}target{{ else }}data{{/ if }}); + const { result, data: returnedData } = await open{{ pageName action.targetPageDefinition }}({{{ getFormOpenParameters page action }}}); {{# with (getRefreshActionDefinitionForContainer page.container) as |actionDefinition| }} {{# if page.container.view }} if (result === 'submit' && !editMode) {