Skip to content

Commit

Permalink
updated role based condition for filters (#2178)
Browse files Browse the repository at this point in the history
* updated role based condition for filters

* lint fix
  • Loading branch information
abilpraju-aot authored Aug 12, 2024
1 parent 78e6e1f commit 9572840
Showing 1 changed file with 31 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ const ServiceFlowFilterListDropDown = React.memo(
const { t } = useTranslation();
const tenantKey = useSelector((state) => state.tenants?.tenantId);
const redirectUrl = MULTITENANCY_ENABLED ? `/tenant/${tenantKey}/` : "/";
const { viewFilters } = userRoles();

const { viewFilters, createFilters, manageAllFilters } = userRoles();

const changeFilterSelection = (filter) => {
const selectedFilterItem = filterListItems.find(
Expand Down Expand Up @@ -72,14 +71,36 @@ const ServiceFlowFilterListDropDown = React.memo(
{filter?.name} {`(${filter.count || 0})`}
</span>
<button
onClick={() => {
handleFilter(filter?.id, editPermission);
}}
className="btn btn-link"
>
<i className={`me-1 fa fa-${editPermission ? "pencil" : (viewFilters ? `eye` : '')}`} />
<Translation>{(t) => t(editPermission ? `Edit` : (viewFilters ? `View` : ''))}</Translation>
</button>
onClick={() => {
handleFilter(
filter?.id,
(createFilters || manageAllFilters) && editPermission
);
}}
className="btn btn-link"
>
<i
className={`me-1 fa fa-${
(createFilters || manageAllFilters) && editPermission
? "pencil"
: viewFilters
? `eye`
: ""
}`}
/>
<Translation>
{(t) =>
t(
(createFilters || manageAllFilters) &&
editPermission
? `Edit`
: viewFilters
? `View`
: ""
)
}
</Translation>
</button>
</div>
</NavDropdown.Item>
);
Expand Down

0 comments on commit 9572840

Please sign in to comment.