From 3c658bdc98741bbe09822388c77a7d0f864dd9b1 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 25 Jan 2024 17:44:57 +0100 Subject: [PATCH 1/3] JNG-5440 export function --- .../src/pages/actions/ExportAction.fragment.hbs | 12 ++++++++++++ pom.xml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 judo-ui-react/src/main/resources/actor/src/pages/actions/ExportAction.fragment.hbs diff --git a/judo-ui-react/src/main/resources/actor/src/pages/actions/ExportAction.fragment.hbs b/judo-ui-react/src/main/resources/actor/src/pages/actions/ExportAction.fragment.hbs new file mode 100644 index 00000000..ffdb1da8 --- /dev/null +++ b/judo-ui-react/src/main/resources/actor/src/pages/actions/ExportAction.fragment.hbs @@ -0,0 +1,12 @@ +{{# if action.targetDataElement }} +const {{ simpleActionDefinitionName action.actionDefinition }} = async (queryCustomizer: {{ classDataName action.targetDataElement.target 'QueryCustomizer' }}) => { +{{ else }} +const {{ simpleActionDefinitionName action.actionDefinition }} = async (queryCustomizer: {{ classDataName (getReferenceClassType page) 'QueryCustomizer' }}) => { +{{/ if }} + try { + setIsLoading(true); + alert('Not yet implemented'); + } finally { + setIsLoading(false); + } +} diff --git a/pom.xml b/pom.xml index 36e84362..22fa6aa7 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ 18.14.2 8.9.2 - 1.1.0.20240125_122611_cdc894e1_feature_JNG_5152_nested_create + 1.1.0.20240125_150630_5eaece91_feature_JNG_5440_export_function 1.0.0.20231009_184136_321053b3_develop 1.0.0.20240125_123625_72e1a464_feature_JNG_5152_nested_create From aa1077543b6513dfa01598917c54343d598091ff Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 25 Jan 2024 18:30:29 +0100 Subject: [PATCH 2/3] JNG-5440 start export function --- .../model/ActionGroupTest-ui.model | 37 ++++++++ .../model/ActionGroupTestPro-ui.model | 37 ++++++++ .../src/containers/components/table.tsx.hbs | 90 ++++++++++--------- .../pages/actions/ExportAction.fragment.hbs | 1 + 4 files changed, 122 insertions(+), 43 deletions(-) diff --git a/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model b/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model index 302a29b7..e93402fd 100644 --- a/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model +++ b/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model @@ -83,6 +83,7 @@ + @@ -752,6 +753,10 @@ + + + + @@ -907,6 +912,10 @@ + + + + @@ -1231,6 +1240,10 @@ + + + + @@ -1515,6 +1528,10 @@ + + + + @@ -1686,6 +1703,10 @@ + + + + @@ -1808,6 +1829,10 @@ + + + + @@ -1924,6 +1949,10 @@ + + + + @@ -2358,6 +2387,10 @@ + + + + @@ -2560,6 +2593,10 @@ + + + + diff --git a/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model b/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model index 302a29b7..e93402fd 100644 --- a/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model +++ b/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model @@ -83,6 +83,7 @@ + @@ -752,6 +753,10 @@ + + + + @@ -907,6 +912,10 @@ + + + + @@ -1231,6 +1240,10 @@ + + + + @@ -1515,6 +1528,10 @@ + + + + @@ -1686,6 +1703,10 @@ + + + + @@ -1808,6 +1829,10 @@ + + + + @@ -1924,6 +1949,10 @@ + + + + @@ -2358,6 +2387,10 @@ + + + + @@ -2560,6 +2593,10 @@ + + + + diff --git a/judo-ui-react/src/main/resources/actor/src/containers/components/table.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/containers/components/table.tsx.hbs index 0860a856..61cc27dc 100644 --- a/judo-ui-react/src/main/resources/actor/src/containers/components/table.tsx.hbs +++ b/judo-ui-react/src/main/resources/actor/src/containers/components/table.tsx.hbs @@ -95,13 +95,17 @@ export interface {{ componentName table }}ActionDefinitions { {{ simpleActionDefinitionName actionDefinition }}?: (queryCustomizer: {{ classDataName (getReferenceClassType table) 'QueryCustomizer' }}) => Promise<{{ classDataName (getReferenceClassType table) 'Stored' }}[]>; get{{ firstToUpper table.relationName }}Mask?: () => string; {{ else }} - {{# if actionDefinition.isSelectorRangeAction }} - {{ simpleActionDefinitionName actionDefinition }}?: (queryCustomizer: {{ classDataName (getReferenceClassType table) 'QueryCustomizer' }}) => Promise<{{ classDataName (getReferenceClassType table) 'Stored' }}[]>; + {{# if actionDefinition.isExportAction }} + {{ simpleActionDefinitionName actionDefinition }}?: (queryCustomizer: {{ classDataName (getReferenceClassType table) 'QueryCustomizer' }}) => Promise; {{ else }} - {{# if actionDefinition.isBulk }} - {{ simpleActionDefinitionName actionDefinition }}?: (selectedRows: {{ classDataName (getReferenceClassType table) 'Stored' }}[]) => Promise>; + {{# if actionDefinition.isSelectorRangeAction }} + {{ simpleActionDefinitionName actionDefinition }}?: (queryCustomizer: {{ classDataName (getReferenceClassType table) 'QueryCustomizer' }}) => Promise<{{ classDataName (getReferenceClassType table) 'Stored' }}[]>; {{ else }} - {{ simpleActionDefinitionName actionDefinition }}?: ({{# if actionDefinition.targetType }}target: {{ classDataName actionDefinition.targetType 'Stored' }}{{/ if }}) => Promise; + {{# if actionDefinition.isBulk }} + {{ simpleActionDefinitionName actionDefinition }}?: (selectedRows: {{ classDataName (getReferenceClassType table) 'Stored' }}[]) => Promise>; + {{ else }} + {{ simpleActionDefinitionName actionDefinition }}?: ({{# if actionDefinition.targetType }}target: {{ classDataName actionDefinition.targetType 'Stored' }}{{/ if }}) => Promise; + {{/ if }} {{/ if }} {{/ if }} {{/ if }} @@ -656,46 +660,46 @@ export function {{ componentName table }}(props: {{ componentName table }}Props) variant={ {{{ variantForButton button }}} } onClick={ async () => { {{# if button.actionDefinition.isFilterAction }} - const filterResults = await actions.{{ simpleActionDefinitionName actionDefinition }}!('{{ createId button }}', filterOptions, filterModel, filters); - {{# if isUseInlineColumnFilters }} - if (filterResults.model) { - handleFilterModelChange({ - ...filterResults.model!, - }); - } - {{ else }} - if (Array.isArray(filterResults.filters)) { - handleFiltersChange([...filterResults.filters!]); - } - {{/ if }} - {{ else }} - const processedQueryCustomizer = { - ...processQueryCustomizer(queryCustomizer), - {{# if (getRefreshActionDefinitionForTable table) }} - _mask: actions.get{{ firstToUpper table.relationName }}Mask ? actions.get{{ firstToUpper table.relationName }}Mask() : queryCustomizer._mask, + const filterResults = await actions.{{ simpleActionDefinitionName actionDefinition }}!('{{ createId button }}', filterOptions, filterModel, filters); + {{# if isUseInlineColumnFilters }} + if (filterResults.model) { + handleFilterModelChange({ + ...filterResults.model!, + }); + } + {{ else }} + if (Array.isArray(filterResults.filters)) { + handleFiltersChange([...filterResults.filters!]); + } {{/ if }} - }; - {{# if actionDefinition.isRefreshAction }} - await actions.{{ simpleActionDefinitionName actionDefinition }}!(processedQueryCustomizer); - {{ else }} - {{# if actionDefinition.isSelectorRangeAction }} - await actions.{{ simpleActionDefinitionName actionDefinition }}!(processedQueryCustomizer); {{ else }} - {{# if actionDefinition.isBulk }} - const { result: bulkResult } = await actions.{{ simpleActionDefinitionName actionDefinition }}!(selectedRows.current); - if (bulkResult === 'submit') { - handleOnSelection([]); // not resetting on refreshes because refreshes would always remove selections... - } - {{ else }} - {{# if actionDefinition.isClearAction }} - await actions.{{ simpleActionDefinitionName actionDefinition }}!(); - handleOnSelection([]); - {{ else }} - await actions.{{ simpleActionDefinitionName actionDefinition }}!(); - {{/ if }} - {{/ if }} - {{/ if }} - {{/ if }} + const processedQueryCustomizer = { + ...processQueryCustomizer(queryCustomizer), + {{# if (getRefreshActionDefinitionForTable table) }} + _mask: actions.get{{ firstToUpper table.relationName }}Mask ? actions.get{{ firstToUpper table.relationName }}Mask() : queryCustomizer._mask, + {{/ if }} + }; + {{# or actionDefinition.isRefreshAction actionDefinition.isExportAction }} + await actions.{{ simpleActionDefinitionName actionDefinition }}!(processedQueryCustomizer); + {{ else }} + {{# if actionDefinition.isSelectorRangeAction }} + await actions.{{ simpleActionDefinitionName actionDefinition }}!(processedQueryCustomizer); + {{ else }} + {{# if actionDefinition.isBulk }} + const { result: bulkResult } = await actions.{{ simpleActionDefinitionName actionDefinition }}!(selectedRows.current); + if (bulkResult === 'submit') { + handleOnSelection([]); // not resetting on refreshes because refreshes would always remove selections... + } + {{ else }} + {{# if actionDefinition.isClearAction }} + await actions.{{ simpleActionDefinitionName actionDefinition }}!(); + handleOnSelection([]); + {{ else }} + await actions.{{ simpleActionDefinitionName actionDefinition }}!(); + {{/ if }} + {{/ if }} + {{/ if }} + {{/ or }} {{/ if }} } } disabled={ {{{ tableToolbarButtonDisabledConditions button table container }}} } diff --git a/judo-ui-react/src/main/resources/actor/src/pages/actions/ExportAction.fragment.hbs b/judo-ui-react/src/main/resources/actor/src/pages/actions/ExportAction.fragment.hbs index ffdb1da8..f17013a2 100644 --- a/judo-ui-react/src/main/resources/actor/src/pages/actions/ExportAction.fragment.hbs +++ b/judo-ui-react/src/main/resources/actor/src/pages/actions/ExportAction.fragment.hbs @@ -5,6 +5,7 @@ const {{ simpleActionDefinitionName action.actionDefinition }} = async (queryCus {{/ if }} try { setIsLoading(true); + console.log(queryCustomizer); alert('Not yet implemented'); } finally { setIsLoading(false); From bf8b1d23db38efaa550c709ca75e0b5b1fdb0c53 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 25 Jan 2024 18:46:40 +0100 Subject: [PATCH 3/3] JNG-5440 update model --- .../ActionGroupTest/model/ActionGroupTest-ui.model | 5 +++++ .../ActionGroupTestPro/model/ActionGroupTestPro-ui.model | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model b/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model index e93402fd..0d87d352 100644 --- a/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model +++ b/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model @@ -106,6 +106,7 @@ + @@ -1326,6 +1327,10 @@ + + + + diff --git a/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model b/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model index e93402fd..0d87d352 100644 --- a/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model +++ b/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model @@ -106,6 +106,7 @@ + @@ -1326,6 +1327,10 @@ + + + +