From 936f4fff6735ab97341cdf1106d9799b2e283bec Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 22 Aug 2024 15:28:32 +0200 Subject: [PATCH 1/2] JNG-5889 bulk detect hidden by --- .../judo/ui/generator/react/UiPageContainerHelper.java | 9 +++++++++ .../judo/ui/generator/react/UiWidgetHelper.java | 5 +++++ .../actor/src/components/table/EagerTable.tsx.hbs | 2 +- .../actor/src/components/table/LazyTable.tsx.hbs | 2 +- .../actor/src/containers/components/table/index.tsx.hbs | 2 +- .../src/main/resources/actor/src/utilities/table.ts.hbs | 1 + 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiPageContainerHelper.java b/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiPageContainerHelper.java index 074942e3..7830c6ff 100644 --- a/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiPageContainerHelper.java +++ b/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiPageContainerHelper.java @@ -225,6 +225,15 @@ public static MaskEntry getMaskForTable(Table table, PageDefinition pageDefiniti } } + for (Button button: table.getTableActionButtonGroup().getButtons()) { + if (button.getHiddenBy() != null) { + mask.addPrimitives(button.getHiddenBy().getName()); + } + if (button.getEnabledBy() != null) { + mask.addPrimitives(button.getEnabledBy().getName()); + } + } + return mask; } diff --git a/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiWidgetHelper.java b/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiWidgetHelper.java index 37c7beb8..621d9edd 100644 --- a/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiWidgetHelper.java +++ b/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiWidgetHelper.java @@ -367,6 +367,11 @@ public static String tableButtonVisibilityConditions(Button button, Table table, result += "selectionModel.length > 0"; if (container.isView() && button.getActionDefinition().getIsCallOperationAction()) { return result + " && !editMode"; + } else if (button.getActionDefinition().getIsBulkCallOperationAction() && button.getHiddenBy() != null) { + if (container.isView()) { + result += " && !editMode"; + } + return result + " && selectedRows.every(s => !s." + button.getHiddenBy().getName() + ")"; } return result; } diff --git a/judo-ui-react/src/main/resources/actor/src/components/table/EagerTable.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/components/table/EagerTable.tsx.hbs index e6c9a04f..c0f23515 100644 --- a/judo-ui-react/src/main/resources/actor/src/components/table/EagerTable.tsx.hbs +++ b/judo-ui-react/src/main/resources/actor/src/components/table/EagerTable.tsx.hbs @@ -469,7 +469,7 @@ export function EagerTable ( { - toolBarActions.map( (toolBarAction: ToolBarActionProps) => actions[toolBarAction.name] && toolBarAction.enabled(data, selectionModel, ownerData, isFormUpdateable) ? ( + toolBarActions.map( (toolBarAction: ToolBarActionProps) => actions[toolBarAction.name] && toolBarAction.enabled(data, selectionModel, getSelectedRows(), ownerData, isFormUpdateable) ? (