mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-08 05:56:38 +00:00
make client link work approval feed
This commit is contained in:
@@ -85,6 +85,7 @@ async function queryApprovals(
|
|||||||
email: users.email
|
email: users.email
|
||||||
},
|
},
|
||||||
clientName: clients.name,
|
clientName: clients.name,
|
||||||
|
niceId: clients.niceId,
|
||||||
deviceModel: fingerprints.deviceModel,
|
deviceModel: fingerprints.deviceModel,
|
||||||
fingerprintPlatform: fingerprints.platform,
|
fingerprintPlatform: fingerprints.platform,
|
||||||
fingerprintOsVersion: fingerprints.osVersion,
|
fingerprintOsVersion: fingerprints.osVersion,
|
||||||
@@ -165,7 +166,8 @@ async function queryApprovals(
|
|||||||
return {
|
return {
|
||||||
...rest,
|
...rest,
|
||||||
deviceName,
|
deviceName,
|
||||||
fingerprint
|
fingerprint,
|
||||||
|
niceId: approval.niceId || null
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,18 @@ import { toast } from "@app/hooks/useToast";
|
|||||||
import { createApiClient, formatAxiosError } from "@app/lib/api";
|
import { createApiClient, formatAxiosError } from "@app/lib/api";
|
||||||
import { getUserDisplayName } from "@app/lib/getUserDisplayName";
|
import { getUserDisplayName } from "@app/lib/getUserDisplayName";
|
||||||
import { cn } from "@app/lib/cn";
|
import { cn } from "@app/lib/cn";
|
||||||
import { formatFingerprintInfo, formatPlatform } from "@app/lib/formatDeviceFingerprint";
|
import { formatFingerprintInfo } from "@app/lib/formatDeviceFingerprint";
|
||||||
import {
|
import {
|
||||||
approvalFiltersSchema,
|
approvalFiltersSchema,
|
||||||
approvalQueries,
|
approvalQueries,
|
||||||
type ApprovalItem
|
type ApprovalItem
|
||||||
} from "@app/lib/queries";
|
} from "@app/lib/queries";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { ArrowRight, Ban, Check, Laptop, Smartphone, RefreshCw } from "lucide-react";
|
import { ArrowRight, Ban, Check, LaptopMinimal, RefreshCw } from "lucide-react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
||||||
import { Fragment, useActionState } from "react";
|
import { Fragment, useActionState } from "react";
|
||||||
import type { LucideIcon } from "lucide-react";
|
|
||||||
import { Badge } from "./ui/badge";
|
import { Badge } from "./ui/badge";
|
||||||
import { Button } from "./ui/button";
|
import { Button } from "./ui/button";
|
||||||
import { Card, CardHeader } from "./ui/card";
|
import { Card, CardHeader } from "./ui/card";
|
||||||
@@ -200,19 +199,19 @@ function ApprovalRequest({ approval, orgId, onSuccess }: ApprovalRequestProps) {
|
|||||||
|
|
||||||
{approval.type === "user_device" && (
|
{approval.type === "user_device" && (
|
||||||
<span className="inline-flex items-center gap-1">
|
<span className="inline-flex items-center gap-1">
|
||||||
{approval.deviceName ? (
|
{approval.deviceName ? (
|
||||||
<>
|
<>
|
||||||
{t("requestingNewDeviceApproval")}:{" "}
|
{t("requestingNewDeviceApproval")}:{" "}
|
||||||
{approval.clientId ? (
|
{approval.niceId ? (
|
||||||
<Link
|
<Link
|
||||||
href={`/${orgId}/settings/clients/user/${approval.clientId}/general`}
|
href={`/${orgId}/settings/clients/user/${approval.niceId}/general`}
|
||||||
className="text-primary hover:underline cursor-pointer"
|
className="text-primary hover:underline cursor-pointer"
|
||||||
>
|
>
|
||||||
{approval.deviceName}
|
{approval.deviceName}
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<span>{approval.deviceName}</span>
|
<span>{approval.deviceName}</span>
|
||||||
)}
|
)}
|
||||||
{approval.fingerprint && (
|
{approval.fingerprint && (
|
||||||
<InfoPopup>
|
<InfoPopup>
|
||||||
<div className="space-y-1 text-sm">
|
<div className="space-y-1 text-sm">
|
||||||
@@ -265,21 +264,6 @@ function ApprovalRequest({ approval, orgId, onSuccess }: ApprovalRequestProps) {
|
|||||||
{approval.decision === "denied" && (
|
{approval.decision === "denied" && (
|
||||||
<Badge variant="red">{t("denied")}</Badge>
|
<Badge variant="red">{t("denied")}</Badge>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{approval.clientId && (
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
className="gap-2"
|
|
||||||
asChild
|
|
||||||
>
|
|
||||||
<Link
|
|
||||||
href={`/${orgId}/settings/clients/user/${approval.clientId}/general`}
|
|
||||||
>
|
|
||||||
{t("viewDetails")}
|
|
||||||
<ArrowRight className="size-4 flex-none" />
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -334,6 +334,7 @@ export type ApprovalItem = {
|
|||||||
approvalId: number;
|
approvalId: number;
|
||||||
orgId: string;
|
orgId: string;
|
||||||
clientId: number | null;
|
clientId: number | null;
|
||||||
|
niceId: string | null;
|
||||||
decision: "pending" | "approved" | "denied";
|
decision: "pending" | "approved" | "denied";
|
||||||
type: "user_device";
|
type: "user_device";
|
||||||
user: {
|
user: {
|
||||||
|
|||||||
Reference in New Issue
Block a user