From 6dfa7330b778715d5e6c4a3830aac95883055eb9 Mon Sep 17 00:00:00 2001 From: abilpraju-aot Date: Wed, 7 Aug 2024 03:51:12 -0700 Subject: [PATCH 1/3] updated the multi-tenanc condition --- .../ServiceFlow/list/sort/CreateNewFilter.js | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js b/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js index 6b1a1e4fad..5a5bf953f0 100644 --- a/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js +++ b/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js @@ -115,7 +115,7 @@ export default function CreateNewFilterDrawer({ const [selectedForm, setSelectedForm] = useState(null); const [taskVariablesKeys, setTaskVariablesKeys] = useState({}); const [processLoading, setProcessLoading] = useState(false); - const loginedUserRoles = useSelector((state) => state.user.roles || []); + //const loginedUserRoles = useSelector((state) => state.user.roles || []); const [overlayGroupShow, setOverlayGroupShow] = useState(false); const [overlayUserShow, setOverlayUserShow] = useState(false); @@ -398,7 +398,7 @@ export default function CreateNewFilterDrawer({ processDefinitionKey: definitionKeyId, candidateGroup: MULTITENANCY_ENABLED && candidateGroup - ? tenantKey + "-" + candidateGroup + ? tenantKey + "-" + trimFirstSlash(candidateGroup) : candidateGroup, assignee: assignee, includeAssignedTasks: @@ -420,6 +420,7 @@ export default function CreateNewFilterDrawer({ isTasksForCurrentUserGroupsEnabled: isTasksForCurrentUserGroupsEnabled, isMyTasksEnabled: isMyTasksEnabled, }; + /** * If a form is selected, set the formId property in the data object * to the id of the selected form. @@ -544,18 +545,30 @@ export default function CreateNewFilterDrawer({ })); }, [userList]); + const removeTenantKey = (value, tenantkey) => { + const tenantKeyCheck = value.match(`${tenantkey}-`); + if ( + tenantKeyCheck && + tenantKeyCheck[0].toLowerCase() === `${tenantkey.toLowerCase()}-` + ) { + return value.replace(`${tenantkey.toLowerCase()}-`, ""); + } else { + return false; + } + }; + const candidateOptions = useMemo(() => { return MULTITENANCY_ENABLED - ? loginedUserRoles.map((role) => ({ - value: role, - label: role, + ? candidateGroups.map((group) => ({ + value: removeTenantKey(group, tenantKey), + label: removeTenantKey(group, tenantKey), })) : candidateGroups.map((group) => ({ value: trimFirstSlash(group), label: group, })); - }, [candidateGroups, loginedUserRoles, MULTITENANCY_ENABLED]); - + }, [candidateGroups, MULTITENANCY_ENABLED]); + const handleAssignee = (selectedOption) => { setAssignee(selectedOption ? selectedOption.value : null); }; From ba942626ce6537feb631e3b3d8876b38bb8a0d6b Mon Sep 17 00:00:00 2001 From: abilpraju-aot Date: Wed, 7 Aug 2024 22:36:50 -0700 Subject: [PATCH 2/3] updated condition --- .../ServiceFlow/list/sort/CreateNewFilter.js | 13 +------------ forms-flow-web/src/helper/helper.js | 3 ++- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js b/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js index 5a5bf953f0..1ceb8f8d1c 100644 --- a/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js +++ b/forms-flow-web/src/components/ServiceFlow/list/sort/CreateNewFilter.js @@ -53,6 +53,7 @@ import { import { fetchAllForms } from "../../../../apiManager/services/bpmFormServices"; import { fetchUserList } from "../../../../apiManager/services/bpmTaskServices"; import { filterSelectOptionByLabel } from "../../../../helper/helper"; +import { removeTenantKey } from "../../../../helper/helper"; const initialValueOfTaskAttribute = { applicationId: true, @@ -544,18 +545,6 @@ export default function CreateNewFilterDrawer({ label: `${user.username}`, })); }, [userList]); - - const removeTenantKey = (value, tenantkey) => { - const tenantKeyCheck = value.match(`${tenantkey}-`); - if ( - tenantKeyCheck && - tenantKeyCheck[0].toLowerCase() === `${tenantkey.toLowerCase()}-` - ) { - return value.replace(`${tenantkey.toLowerCase()}-`, ""); - } else { - return false; - } - }; const candidateOptions = useMemo(() => { return MULTITENANCY_ENABLED diff --git a/forms-flow-web/src/helper/helper.js b/forms-flow-web/src/helper/helper.js index 1f37bea0b6..1c7803e5bf 100644 --- a/forms-flow-web/src/helper/helper.js +++ b/forms-flow-web/src/helper/helper.js @@ -19,9 +19,10 @@ const addTenantkey = (value, tenantkey) => { const removeTenantKey = (value, tenantkey) => { const tenantKeyCheck = value.match(`${tenantkey}-`); if ( - tenantKeyCheck && + tenantKeyCheck && tenantKeyCheck.length && tenantKeyCheck[0].toLowerCase() === `${tenantkey.toLowerCase()}-` ) { + console.log("hit inside"); return value.replace(`${tenantkey.toLowerCase()}-`, ""); } else { return false; From 867a1ce9f35f6f4d75bf8526c4522d2d1ca7bb08 Mon Sep 17 00:00:00 2001 From: abilpraju-aot Date: Wed, 7 Aug 2024 23:08:44 -0700 Subject: [PATCH 3/3] remove console --- forms-flow-web/src/helper/helper.js | 1 - 1 file changed, 1 deletion(-) diff --git a/forms-flow-web/src/helper/helper.js b/forms-flow-web/src/helper/helper.js index 1c7803e5bf..35ca433034 100644 --- a/forms-flow-web/src/helper/helper.js +++ b/forms-flow-web/src/helper/helper.js @@ -22,7 +22,6 @@ const removeTenantKey = (value, tenantkey) => { tenantKeyCheck && tenantKeyCheck.length && tenantKeyCheck[0].toLowerCase() === `${tenantkey.toLowerCase()}-` ) { - console.log("hit inside"); return value.replace(`${tenantkey.toLowerCase()}-`, ""); } else { return false;