feat: add pending to role filter (#14013)

* feat: add pending to role filter

* fix: logic

* chore: remove log

---------

Co-authored-by: Udit Takkar <udit222001@gmail.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
This commit is contained in:
Amit Sharma
2024-03-08 15:09:45 +00:00
committed by GitHub
co-authored by Udit Takkar Udit Takkar
parent e45ee8fab3
commit 3babfa7cf3
@@ -207,6 +207,12 @@ export function UserListTable() {
);
},
filterFn: (rows, id, filterValue) => {
if (filterValue.includes("PENDING")) {
if (filterValue.length === 1) return !rows.original.accepted;
else return !rows.original.accepted || filterValue.includes(rows.getValue(id));
}
// Show only the selected roles
return filterValue.includes(rows.getValue(id));
},
},
@@ -224,7 +230,10 @@ export function UserListTable() {
data-testid2={`member-${username}-pending`}
variant="red"
className="text-xs"
data-testid={`email-${email.replace("@", "")}-pending`}>
data-testid={`email-${email.replace("@", "")}-pending`}
onClick={() => {
table.getColumn("role")?.setFilterValue(["PENDING"]);
}}>
Pending
</Badge>
)}
@@ -351,6 +360,7 @@ export function UserListTable() {
{ label: "Owner", value: "OWNER" },
{ label: "Admin", value: "ADMIN" },
{ label: "Member", value: "MEMBER" },
{ label: "Pending", value: "PENDING" },
],
},
{