Skip to content

Commit

Permalink
Merge pull request #2573 from abilpraju-aot/bugfix/FWF-4332
Browse files Browse the repository at this point in the history
updated permission for listing page
  • Loading branch information
arun-s-aot authored Feb 12, 2025
2 parents d7639b0 + 23e06f8 commit 07c5133
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion forms-flow-web/src/routes/Design/Forms/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ const List = React.memo((props) => {
</div>
) : (
<div>
{createDesigns && (
{(
<div className="d-md-flex justify-content-between align-items-center pb-3 flex-wrap">
<div className="d-md-flex align-items-center p-0 search-box input-group input-group width-25">
<CustomSearch
Expand Down
27 changes: 13 additions & 14 deletions forms-flow-web/src/routes/Design/Process/ProcessTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ import {
setBpmSort,
setDmnSort
} from "../../../actions/processActions";
import userRoles from "../../../constants/permissions";

const ProcessTable = React.memo(() => {
const { viewType } = useParams();
const isBPMN = viewType === "subflow";
const dispatch = useDispatch();
const { t } = useTranslation();
const { createDesigns } = userRoles();
const ProcessContents = isBPMN
? {
processType: "BPMN",
Expand All @@ -40,7 +42,7 @@ const ProcessTable = React.memo(() => {
refreshAriaLabel: "Refresh the Process list (BPMN)",
message: "No subflows have been found. Create a new subflow by clicking \"New BPMN\" button in the top right."
}
: {
: {
processType: "DMN",
extension: ".dmn",
filterDataTestId: "Process-list-filter-dmn",
Expand Down Expand Up @@ -115,9 +117,9 @@ const ProcessTable = React.memo(() => {
)
);
};

const handleFilterIconClick = () => {
setShowSortModal(true);
setShowSortModal(true);
};

const handleSortModalClose = () => {
Expand All @@ -135,8 +137,8 @@ const ProcessTable = React.memo(() => {
setIsLoading(false);
setShowSortModal(false);
};


const handleRefresh = () => {
fetchProcesses();
};
Expand All @@ -145,7 +147,7 @@ const ProcessTable = React.memo(() => {
useEffect(() => {
fetchProcesses();
}, [dispatch, currentState, tenantKey,searchTextBPMN,searchTextDMN, isBPMN,sortConfig]);

//Update api call when search field is empty
useEffect(() => {
if (!search.trim()) {
Expand All @@ -160,22 +162,19 @@ const ProcessTable = React.memo(() => {
sortOrder: sortConfig[key]?.sortOrder === "asc" ? "desc" : "asc",
},
};

// Reset all other sort keys to default (ascending)
// Reset all other sort keys to default (ascending)
Object.keys(sortConfig).forEach((sortKey) => {
if (sortKey !== key && sortKey !== "activeKey") {
newSortConfig[sortKey] = { sortOrder: "asc" };
}
});

if (isBPMN) {
dispatch(setBpmSort(newSortConfig));
} else {
dispatch(setDmnSort(newSortConfig));
}
};


const handleSearch = () => {
setSearchLoading(true);
if (isBPMN) {
Expand Down Expand Up @@ -251,7 +250,7 @@ const ProcessTable = React.memo(() => {
onClick: showImportModal,
},
];

return (
<>
<div className="d-md-flex justify-content-between align-items-center pb-3 flex-wrap">
Expand Down Expand Up @@ -282,14 +281,14 @@ const ProcessTable = React.memo(() => {
refreshDataTestId={ProcessContents.refreshDataTestId}
refreshAriaLabel={ProcessContents.refreshAriaLabel}
/>
<CustomButton
{createDesigns && (<CustomButton
variant="primary"
size="sm"
label={t(`New ${ProcessContents.processType}`)}
onClick={handleCreateProcess}
dataTestid={`create-${ProcessContents.processType}-button`}
ariaLabel={` Create ${ProcessContents.processType}`}
/>
/>)}
</div>
</div>
<LoadingOverlay active={isLoading} spinner text={t("Loading...")}>
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-web/src/routes/Design/Process/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DesignerProcessRoute = ({ component: Component, ...rest }) => (
<Route
{...rest}
render={(props) => {
if (user.includes('create_designs')) {
if (user.some(i => i === "create_designs" || i === "view_designs")) {
return <Component {...props} />;
} else {
return <AccessDenied userRoles={user} />;
Expand Down

0 comments on commit 07c5133

Please sign in to comment.