Skip to content

Commit

Permalink
JNG-5836 conditional table confirmations (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg authored Jul 29, 2024
1 parent 8eb6dde commit 218ed89
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ public static MaskEntry getMaskForTable(Table table, PageDefinition pageDefiniti
.collect(Collectors.toSet());
columnAttributeNames.addAll(table.getAdditionalMaskAttributes().stream().map(NamedElement::getName).collect(Collectors.toSet()));
mask.addPrimitives(columnAttributeNames);
if (table.getRowActionButtonGroup() != null) {
mask.addPrimitives(table.getRowActionButtonGroup().getButtons().stream()
.filter(b -> b.getConfirmation() != null && b.getConfirmation().getConfirmationCondition() != null)
.map(b -> b.getConfirmation().getConfirmationCondition().getName())
.collect(Collectors.toSet()));
}
if (table.isIsEager() && counter < 5) {
// table items can be potentially opened, therefore we need the target's attributes as well
Button openPageButton = table.getRowActionButtonGroup().getButtons().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,9 @@ public static boolean displayTableHeading(Table table, PageContainer container)
public static boolean shouldRenderConfirmationCondition(Button button) {
return button.getConfirmation() != null && button.getConfirmation().getConfirmationCondition() != null;
}

public static boolean isParameterOpenerButton(Button button) {
ActionDefinition actionDefinition = button.getActionDefinition();
return actionDefinition.getIsOpenOperationInputFormAction() || actionDefinition.getIsOpenOperationInputSelectorAction();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ export function {{ componentName table }}(props: {{ componentName table }}Props)
{{/ if }}
disabled: (row: {{ classDataName (getReferenceClassType table) 'Stored' }}, isLoading: boolean, getSelectedRows: () => {{# with (getReferenceClassType table) as |classType| }}{{# if classType.isMapped }}{{ classDataName (getReferenceClassType table) 'Stored' }}[]{{ else }}{{ classDataName (getReferenceClassType table) '' }}[]{{/ if }}{{/ with }}, ownerdata?: any): boolean => {{{ tableRowButtonDisabledConditions button table container }}},
action: actions.{{ simpleActionDefinitionName button.actionDefinition }} ? async (rowData) => {
{{> actor/src/fragments/container/action-call-confirm-check.fragment.hbs button=button dataParam='rowData' }}
{{# unless (isParameterOpenerButton button) }}
{{> actor/src/fragments/container/action-call-confirm-check.fragment.hbs button=button dataParam='rowData' }}
{{/ unless }}
await actions.{{ simpleActionDefinitionName button.actionDefinition }}!(rowData{{# if button.actionDefinition.isOpenPageAction }}, isDraft{{/ if }});
} : undefined,
},
Expand Down

0 comments on commit 218ed89

Please sign in to comment.