mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
hide pending approval filter in oss
This commit is contained in:
@@ -82,12 +82,16 @@ export default function UserDevicesTable({ userClients }: ClientTableProps) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
|
||||||
const formatFingerprintInfo = (fingerprint: ClientRow["fingerprint"]): string => {
|
const formatFingerprintInfo = (
|
||||||
|
fingerprint: ClientRow["fingerprint"]
|
||||||
|
): string => {
|
||||||
if (!fingerprint) return "";
|
if (!fingerprint) return "";
|
||||||
const parts: string[] = [];
|
const parts: string[] = [];
|
||||||
|
|
||||||
if (fingerprint.platform) {
|
if (fingerprint.platform) {
|
||||||
parts.push(`${t("platform")}: ${formatPlatform(fingerprint.platform)}`);
|
parts.push(
|
||||||
|
`${t("platform")}: ${formatPlatform(fingerprint.platform)}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (fingerprint.deviceModel) {
|
if (fingerprint.deviceModel) {
|
||||||
parts.push(`${t("deviceModel")}: ${fingerprint.deviceModel}`);
|
parts.push(`${t("deviceModel")}: ${fingerprint.deviceModel}`);
|
||||||
@@ -562,6 +566,49 @@ export default function UserDevicesTable({ userClients }: ClientTableProps) {
|
|||||||
return baseColumns;
|
return baseColumns;
|
||||||
}, [hasRowsWithoutUserId, t]);
|
}, [hasRowsWithoutUserId, t]);
|
||||||
|
|
||||||
|
const statusFilterOptions = useMemo(() => {
|
||||||
|
const allOptions = [
|
||||||
|
{
|
||||||
|
id: "active",
|
||||||
|
label: t("active"),
|
||||||
|
value: "active"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "pending",
|
||||||
|
label: t("pendingApproval"),
|
||||||
|
value: "pending"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "denied",
|
||||||
|
label: t("deniedApproval"),
|
||||||
|
value: "denied"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "archived",
|
||||||
|
label: t("archived"),
|
||||||
|
value: "archived"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "blocked",
|
||||||
|
label: t("blocked"),
|
||||||
|
value: "blocked"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
if (build === "oss") {
|
||||||
|
return allOptions.filter((option) => option.value !== "pending");
|
||||||
|
}
|
||||||
|
|
||||||
|
return allOptions;
|
||||||
|
}, [t]);
|
||||||
|
|
||||||
|
const statusFilterDefaultValues = useMemo(() => {
|
||||||
|
if (build === "oss") {
|
||||||
|
return ["active"];
|
||||||
|
}
|
||||||
|
return ["active", "pending"];
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{selectedClient && !selectedClient.userId && (
|
{selectedClient && !selectedClient.userId && (
|
||||||
@@ -604,33 +651,7 @@ export default function UserDevicesTable({ userClients }: ClientTableProps) {
|
|||||||
label: t("status") || "Status",
|
label: t("status") || "Status",
|
||||||
multiSelect: true,
|
multiSelect: true,
|
||||||
displayMode: "calculated",
|
displayMode: "calculated",
|
||||||
options: [
|
options: statusFilterOptions,
|
||||||
{
|
|
||||||
id: "active",
|
|
||||||
label: t("active"),
|
|
||||||
value: "active"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "pending",
|
|
||||||
label: t("pendingApproval"),
|
|
||||||
value: "pending"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "denied",
|
|
||||||
label: t("deniedApproval"),
|
|
||||||
value: "denied"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "archived",
|
|
||||||
label: t("archived"),
|
|
||||||
value: "archived"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "blocked",
|
|
||||||
label: t("blocked"),
|
|
||||||
value: "blocked"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
filterFn: (
|
filterFn: (
|
||||||
row: ClientRow,
|
row: ClientRow,
|
||||||
selectedValues: (string | number | boolean)[]
|
selectedValues: (string | number | boolean)[]
|
||||||
@@ -639,7 +660,7 @@ export default function UserDevicesTable({ userClients }: ClientTableProps) {
|
|||||||
const rowArchived = row.archived;
|
const rowArchived = row.archived;
|
||||||
const rowBlocked = row.blocked;
|
const rowBlocked = row.blocked;
|
||||||
const approvalState = row.approvalState;
|
const approvalState = row.approvalState;
|
||||||
const isActive = !rowArchived && !rowBlocked;
|
const isActive = !rowArchived && !rowBlocked && approvalState !== "pending" && approvalState !== "denied";
|
||||||
|
|
||||||
if (selectedValues.includes("active") && isActive)
|
if (selectedValues.includes("active") && isActive)
|
||||||
return true;
|
return true;
|
||||||
@@ -665,7 +686,7 @@ export default function UserDevicesTable({ userClients }: ClientTableProps) {
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
defaultValues: ["active", "pending"] // Default to showing active clients
|
defaultValues: statusFilterDefaultValues
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user