From f5c1e505266d921ab37592645d33b7c74e523aa0 Mon Sep 17 00:00:00 2001 From: Radoslaw Szwajkowski Date: Thu, 11 Jul 2024 15:28:45 +0200 Subject: [PATCH] Filter credentials by createUser property Drop conditional rendering as it clashes with column type definitions: the dynamic column is interpreted as optional property which is not allwed by the current typing in the table hooks. Co-authored-by: Ian Bolton Signed-off-by: Radoslaw Szwajkowski --- .../src/app/pages/identities/identities.tsx | 46 +++++++------------ 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/client/src/app/pages/identities/identities.tsx b/client/src/app/pages/identities/identities.tsx index b10f14ca52..0523076356 100644 --- a/client/src/app/pages/identities/identities.tsx +++ b/client/src/app/pages/identities/identities.tsx @@ -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, @@ -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, }); @@ -275,10 +268,7 @@ export const Identities: React.FC = () => { {...getThProps({ columnKey: "description" })} /> - - {/* - //TODO: Enable conditional rendering for createdBy column - */} + @@ -340,14 +330,12 @@ export const Identities: React.FC = () => { > {typeFormattedString?.value} - {/* - Todo: Enable conditional rendering for createdBy column - {identity.createdBy} - */} + {identity.createUser} +