Skip to content

Commit

Permalink
🐛 Filter credentials by createUser property (#2006)
Browse files Browse the repository at this point in the history
Drop conditional rendering as it clashes with column type definitions:
the dynamic column is interpreted as optional property which is not
allowed by the current typing in the table hooks.

Resolves: https://issues.redhat.com/browse/MTA-3143

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
Co-authored-by: Ian Bolton <[email protected]>
  • Loading branch information
rszwajko and ibolton336 authored Jul 11, 2024
1 parent 7d24ba1 commit fc7f23c
Showing 1 changed file with 17 additions and 29 deletions.
46 changes: 17 additions & 29 deletions client/src/app/pages/identities/identities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ export const Identities: React.FC = () => {
description: t("terms.description"),
type: t("terms.type"),

//TODO: Enable conditional rendering for createdBy column
// ...(isAuthRequired && { createdBy: t("terms.createdBy") }
// ? { createdBy: t("terms.createdBy") }
// : {}),
createdBy: t("terms.createdBy"),
},
isFilterEnabled: true,
isSortEnabled: true,
Expand Down Expand Up @@ -182,29 +179,25 @@ export const Identities: React.FC = () => {
return item.kind || "";
},
},
//TODO: Enable conditional rendering for createdBy column
// ...(isAuthRequired
// ? [
// {
// categoryKey: "createdBy",
// title: "Created By",
// type: FilterType.search,
// placeholderText: "Filter by created by User...",
// getItemValue: (item: Identity) => {
// return item.createUser || "";
// },
// } as const,
// ]
// : []),
{
categoryKey: "createdBy",
title: t("terms.createdBy"),
type: FilterType.search,
placeholderText: t("actions.filterBy", {
what: t("terms.createdBy") + "...",
}),
getItemValue: (item: Identity) => {
return item.createUser || "";
},
},
],
initialItemsPerPage: 10,
sortableColumns: ["name", "type"],
sortableColumns: ["name", "type", "createdBy"],
initialSort: { columnKey: "name", direction: "asc" },
getSortValues: (item) => ({
name: item?.name || "",
type: item?.kind || "",
//TODO: Enable conditional rendering for createdBy column
// ...(isAuthRequired && { createdBy: item?.createUser } ? { createdBy: item?.createUser } : {}),
createdBy: item?.createUser || "",
}),
isLoading: isFetching,
});
Expand Down Expand Up @@ -275,10 +268,7 @@ export const Identities: React.FC = () => {
{...getThProps({ columnKey: "description" })}
/>
<Th width={25} {...getThProps({ columnKey: "type" })} />

{/*
//TODO: Enable conditional rendering for createdBy column
<Th {...getThProps({ columnKey: "createdBy" })} /> */}
<Th {...getThProps({ columnKey: "createdBy" })} />
</TableHeaderContentWithControls>
</Tr>
</Thead>
Expand Down Expand Up @@ -340,14 +330,12 @@ export const Identities: React.FC = () => {
>
{typeFormattedString?.value}
</Td>
{/*
Todo: Enable conditional rendering for createdBy column
<Td
width={10}
{...getTdProps({ columnKey: "createdBy" })}
>
{identity.createdBy}
</Td> */}
{identity.createUser}
</Td>
<AppTableActionButtons
isDeleteEnabled={
trackers.some(
Expand Down

0 comments on commit fc7f23c

Please sign in to comment.