mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-31 09:45:45 +02:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7098963d6 | |||
| f015fb592b | |||
| c099167905 | |||
| e0a8721207 |
@@ -91,6 +91,7 @@ export default async function Page(props: {
|
|||||||
let loginIdps: LoginFormIDP[] = [];
|
let loginIdps: LoginFormIDP[] = [];
|
||||||
let lastUsedIdpForSmartLogin: (LoginFormIDP & { orgId?: string }) | null =
|
let lastUsedIdpForSmartLogin: (LoginFormIDP & { orgId?: string }) | null =
|
||||||
null;
|
null;
|
||||||
|
|
||||||
if (!useSmartLogin) {
|
if (!useSmartLogin) {
|
||||||
// Load IdPs for DashboardLoginForm (OSS or org-only IdP mode)
|
// Load IdPs for DashboardLoginForm (OSS or org-only IdP mode)
|
||||||
if (build === "oss" || env.app.identityProviderMode !== "org") {
|
if (build === "oss" || env.app.identityProviderMode !== "org") {
|
||||||
@@ -117,12 +118,12 @@ export default async function Page(props: {
|
|||||||
`/idp/${persistedData.idpId}`
|
`/idp/${persistedData.idpId}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const idp = idpRes.data.data.idp;
|
const res = idpRes.data.data;
|
||||||
|
|
||||||
lastUsedIdpForSmartLogin = {
|
lastUsedIdpForSmartLogin = {
|
||||||
idpId: idp.idpId,
|
idpId: res.idp.idpId,
|
||||||
name: idp.name,
|
name: res.idp.name,
|
||||||
variant: idp.type,
|
variant: res.idpOidcConfig?.variant ?? res.idp.type,
|
||||||
orgId: persistedData.orgId,
|
orgId: persistedData.orgId,
|
||||||
lastUsed: true
|
lastUsed: true
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -114,59 +114,52 @@ export default function IdpLoginButtons({
|
|||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
{params.get("gotoapp") ? (
|
{params.get("gotoapp") ? (
|
||||||
<>
|
<Button
|
||||||
<Button
|
type="button"
|
||||||
type="button"
|
className="w-full"
|
||||||
className="w-full"
|
onClick={() => {
|
||||||
onClick={() => {
|
goToApp();
|
||||||
goToApp();
|
}}
|
||||||
}}
|
>
|
||||||
>
|
{t("continueToApplication")}
|
||||||
{t("continueToApplication")}
|
</Button>
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
idps.map((idp) => {
|
||||||
{idps.map((idp) => {
|
const effectiveType =
|
||||||
const effectiveType =
|
idp.variant || idp.name.toLowerCase();
|
||||||
idp.variant || idp.name.toLowerCase();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="w-full relative" key={idp.idpId}>
|
||||||
className="w-full relative"
|
<Button
|
||||||
key={idp.idpId}
|
key={idp.idpId}
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
className="w-full inline-flex items-center space-x-2 after:absolute after:inset-0 after:z-10"
|
||||||
|
onClick={() => {
|
||||||
|
startTransition(() =>
|
||||||
|
loginWithIdp(idp.idpId)
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
disabled={loading}
|
||||||
|
loading={loading}
|
||||||
>
|
>
|
||||||
<Button
|
<IdpTypeIcon
|
||||||
key={idp.idpId}
|
type={effectiveType}
|
||||||
type="button"
|
size={16}
|
||||||
variant="outline"
|
/>
|
||||||
className="w-full inline-flex items-center space-x-2 after:absolute after:inset-0 after:z-10"
|
<span>{idp.name}</span>
|
||||||
onClick={() => {
|
</Button>
|
||||||
startTransition(() =>
|
|
||||||
loginWithIdp(idp.idpId)
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
disabled={loading}
|
|
||||||
loading={loading}
|
|
||||||
>
|
|
||||||
<IdpTypeIcon
|
|
||||||
type={effectiveType}
|
|
||||||
size={16}
|
|
||||||
/>
|
|
||||||
<span>{idp.name}</span>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
{idp.lastUsed && (
|
{idp.lastUsed && (
|
||||||
<div className="absolute inset-0">
|
<div className="absolute inset-0">
|
||||||
<span className="absolute top-0 right-0 text-xs bg-primary text-primary-foreground rounded-bl-sm rounded-tr-sm px-2 py-0.5">
|
<span className="absolute top-0 right-0 text-xs bg-primary text-primary-foreground rounded-bl-sm rounded-tr-sm px-2 py-0.5">
|
||||||
{t("idpLastUsed")}
|
{t("idpLastUsed")}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ export default function IdpTypeIcon({
|
|||||||
}: Props) {
|
}: Props) {
|
||||||
const effectiveType = (variant || type || "").toLowerCase();
|
const effectiveType = (variant || type || "").toLowerCase();
|
||||||
|
|
||||||
|
console.log(`[IdpTypeIcon]`, { effectiveType, variant, type });
|
||||||
|
|
||||||
let src: string | null = null;
|
let src: string | null = null;
|
||||||
let defaultAlt = "";
|
let defaultAlt = "";
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ColumnDef } from "@tanstack/react-table";
|
import ConfirmDeleteDialog from "@app/components/ConfirmDeleteDialog";
|
||||||
import { ExtendedColumnDef } from "@app/components/ui/data-table";
|
|
||||||
import { IdpDataTable } from "@app/components/OrgIdpDataTable";
|
|
||||||
import { Button } from "@app/components/ui/button";
|
|
||||||
import {
|
|
||||||
Command,
|
|
||||||
CommandEmpty,
|
|
||||||
CommandGroup,
|
|
||||||
CommandInput,
|
|
||||||
CommandItem,
|
|
||||||
CommandList
|
|
||||||
} from "@app/components/ui/command";
|
|
||||||
import {
|
import {
|
||||||
Credenza,
|
Credenza,
|
||||||
CredenzaBody,
|
CredenzaBody,
|
||||||
@@ -22,37 +11,42 @@ import {
|
|||||||
CredenzaHeader,
|
CredenzaHeader,
|
||||||
CredenzaTitle
|
CredenzaTitle
|
||||||
} from "@app/components/Credenza";
|
} from "@app/components/Credenza";
|
||||||
|
import { isIdpGlobalModeBannerVisible } from "@app/components/IdpGlobalModeBanner";
|
||||||
|
import IdpTypeBadge from "@app/components/IdpTypeBadge";
|
||||||
|
import IdpTypeIcon from "@app/components/IdpTypeIcon";
|
||||||
|
import { IdpDataTable } from "@app/components/OrgIdpDataTable";
|
||||||
|
import { Badge } from "@app/components/ui/badge";
|
||||||
|
import { Button } from "@app/components/ui/button";
|
||||||
import {
|
import {
|
||||||
ArrowRight,
|
Command,
|
||||||
ArrowUpDown,
|
CommandEmpty,
|
||||||
MoreHorizontal
|
CommandGroup,
|
||||||
} from "lucide-react";
|
CommandInput,
|
||||||
import { useMemo, useState } from "react";
|
CommandItem,
|
||||||
import ConfirmDeleteDialog from "@app/components/ConfirmDeleteDialog";
|
CommandList
|
||||||
import { toast } from "@app/hooks/useToast";
|
} from "@app/components/ui/command";
|
||||||
import { formatAxiosError } from "@app/lib/api";
|
import { ExtendedColumnDef } from "@app/components/ui/data-table";
|
||||||
import { createApiClient } from "@app/lib/api";
|
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
|
||||||
import { useUserContext } from "@app/hooks/useUserContext";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger
|
DropdownMenuTrigger
|
||||||
} from "@app/components/ui/dropdown-menu";
|
} from "@app/components/ui/dropdown-menu";
|
||||||
import Link from "next/link";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { useTranslations } from "next-intl";
|
|
||||||
import IdpTypeBadge from "@app/components/IdpTypeBadge";
|
|
||||||
import IdpTypeIcon from "@app/components/IdpTypeIcon";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { useDebounce } from "use-debounce";
|
|
||||||
import type { ListUserAdminOrgIdpsResponse } from "@server/routers/orgIdp/types";
|
|
||||||
import { cn } from "@app/lib/cn";
|
|
||||||
import { Badge } from "@app/components/ui/badge";
|
|
||||||
import { usePaidStatus } from "@app/hooks/usePaidStatus";
|
import { usePaidStatus } from "@app/hooks/usePaidStatus";
|
||||||
|
import { toast } from "@app/hooks/useToast";
|
||||||
|
import { useUserContext } from "@app/hooks/useUserContext";
|
||||||
|
import { createApiClient, formatAxiosError } from "@app/lib/api";
|
||||||
|
import { cn } from "@app/lib/cn";
|
||||||
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
||||||
import { isIdpGlobalModeBannerVisible } from "@app/components/IdpGlobalModeBanner";
|
import type { ListUserAdminOrgIdpsResponse } from "@server/routers/orgIdp/types";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { ArrowRight, ArrowUpDown, MoreHorizontal } from "lucide-react";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useMemo, useState } from "react";
|
||||||
|
import { useDebounce } from "use-debounce";
|
||||||
|
|
||||||
export type IdpRow = {
|
export type IdpRow = {
|
||||||
idpId: number;
|
idpId: number;
|
||||||
@@ -483,15 +477,17 @@ export default function IdpTable({ idps, orgId }: Props) {
|
|||||||
{group.name}
|
{group.name}
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-1 flex flex-wrap gap-1">
|
<div className="mt-1 flex flex-wrap gap-1">
|
||||||
{group.sources.map((src) => (
|
{group.sources.map(
|
||||||
<Badge
|
(src) => (
|
||||||
key={src.orgId}
|
<Badge
|
||||||
variant="secondary"
|
key={src.orgId}
|
||||||
className="max-w-full truncate font-normal"
|
variant="secondary"
|
||||||
>
|
className="max-w-full truncate font-normal"
|
||||||
{src.orgName}
|
>
|
||||||
</Badge>
|
{src.orgName}
|
||||||
))}
|
</Badge>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
|
|||||||
Reference in New Issue
Block a user