mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-06 04:10:13 +00:00
Show new types of resources right
This commit is contained in:
@@ -438,6 +438,7 @@ export async function getUserResources(
|
|||||||
return {
|
return {
|
||||||
siteResourceId: siteResource.siteResourceId,
|
siteResourceId: siteResource.siteResourceId,
|
||||||
name: siteResource.name,
|
name: siteResource.name,
|
||||||
|
niceId: siteResource.niceId,
|
||||||
destination: siteResource.destination,
|
destination: siteResource.destination,
|
||||||
mode: siteResource.mode,
|
mode: siteResource.mode,
|
||||||
ssl: siteResource.ssl,
|
ssl: siteResource.ssl,
|
||||||
@@ -492,6 +493,7 @@ export type GetUserResourcesResponse = {
|
|||||||
siteResources: Array<{
|
siteResources: Array<{
|
||||||
siteResourceId: number;
|
siteResourceId: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
niceId: string;
|
||||||
destination: string;
|
destination: string;
|
||||||
mode: string;
|
mode: string;
|
||||||
tcpPortRangeString: string | null;
|
tcpPortRangeString: string | null;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import {
|
|||||||
TooltipTrigger
|
TooltipTrigger
|
||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
import CopyToClipboard from "@app/components/CopyToClipboard";
|
import CopyToClipboard from "@app/components/CopyToClipboard";
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
|
|
||||||
// Update Resource type to include site information
|
// Update Resource type to include site information
|
||||||
type Resource = {
|
type Resource = {
|
||||||
@@ -49,7 +50,7 @@ type Resource = {
|
|||||||
domain: string;
|
domain: string;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
protected: boolean;
|
protected: boolean;
|
||||||
// mode: string; // "http", "tcp", "udp", "rdp", "vnc", "ssh"
|
mode: string; // "http", "tcp", "udp", "rdp", "vnc", "ssh"
|
||||||
// Auth method fields
|
// Auth method fields
|
||||||
sso?: boolean;
|
sso?: boolean;
|
||||||
password?: boolean;
|
password?: boolean;
|
||||||
@@ -62,6 +63,7 @@ type Resource = {
|
|||||||
type SiteResource = {
|
type SiteResource = {
|
||||||
siteResourceId: number;
|
siteResourceId: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
niceId: string;
|
||||||
destination: string;
|
destination: string;
|
||||||
mode: string;
|
mode: string;
|
||||||
ssl: boolean;
|
ssl: boolean;
|
||||||
@@ -754,7 +756,13 @@ export default function MemberResourcesPortal({
|
|||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex-shrink-0">
|
<div className="flex-shrink-0 flex items-center gap-2">
|
||||||
|
<Badge
|
||||||
|
variant="secondary"
|
||||||
|
className="text-xs"
|
||||||
|
>
|
||||||
|
{resource.mode.toUpperCase()}
|
||||||
|
</Badge>
|
||||||
<ResourceInfo
|
<ResourceInfo
|
||||||
resource={resource}
|
resource={resource}
|
||||||
/>
|
/>
|
||||||
@@ -860,7 +868,13 @@ export default function MemberResourcesPortal({
|
|||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex-shrink-0">
|
<div className="flex-shrink-0 flex items-center gap-2">
|
||||||
|
<Badge
|
||||||
|
variant="secondary"
|
||||||
|
className="text-xs"
|
||||||
|
>
|
||||||
|
{siteResource.mode.toUpperCase()}
|
||||||
|
</Badge>
|
||||||
<InfoPopup>
|
<InfoPopup>
|
||||||
<div className="space-y-2 text-sm">
|
<div className="space-y-2 text-sm">
|
||||||
<div className="text-xs font-medium mb-1.5">
|
<div className="text-xs font-medium mb-1.5">
|
||||||
@@ -876,24 +890,24 @@ export default function MemberResourcesPortal({
|
|||||||
:
|
:
|
||||||
</span>
|
</span>
|
||||||
<span className="ml-2 text-muted-foreground capitalize">
|
<span className="ml-2 text-muted-foreground capitalize">
|
||||||
{
|
{siteResource.mode.toUpperCase()}
|
||||||
siteResource.mode
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<span className="font-medium">
|
|
||||||
{t(
|
|
||||||
"memberPortalDestination"
|
|
||||||
)}
|
|
||||||
:
|
|
||||||
</span>
|
|
||||||
<span className="ml-2 text-muted-foreground">
|
|
||||||
{
|
|
||||||
siteResource.destination
|
|
||||||
}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
{siteResource.destination && (
|
||||||
|
<div>
|
||||||
|
<span className="font-medium">
|
||||||
|
{t(
|
||||||
|
"memberPortalDestination"
|
||||||
|
)}
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
<span className="ml-2 text-muted-foreground">
|
||||||
|
{
|
||||||
|
siteResource.destination
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{siteResource.alias && (
|
{siteResource.alias && (
|
||||||
<div>
|
<div>
|
||||||
<span className="font-medium">
|
<span className="font-medium">
|
||||||
@@ -942,45 +956,35 @@ export default function MemberResourcesPortal({
|
|||||||
isLink={true}
|
isLink={true}
|
||||||
/>
|
/>
|
||||||
) : siteResource.alias ? (
|
) : siteResource.alias ? (
|
||||||
<>
|
/* Alias as primary */
|
||||||
{/* Alias as primary */}
|
<div className="flex items-center gap-2">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="text-sm text-muted-foreground font-medium text-left truncate flex-1">
|
||||||
<div className="text-base font-semibold text-foreground text-left truncate flex-1">
|
{siteResource.alias}
|
||||||
{
|
</div>
|
||||||
siteResource.alias
|
<Button
|
||||||
}
|
variant="ghost"
|
||||||
</div>
|
size="icon"
|
||||||
<Button
|
className="h-8 w-8 text-muted-foreground"
|
||||||
variant="ghost"
|
onClick={() => {
|
||||||
size="icon"
|
navigator.clipboard.writeText(
|
||||||
className="h-8 w-8 text-muted-foreground"
|
siteResource.alias!
|
||||||
onClick={() => {
|
);
|
||||||
navigator.clipboard.writeText(
|
toast({
|
||||||
siteResource.alias!
|
title: t(
|
||||||
);
|
"memberPortalCopiedToClipboard"
|
||||||
toast({
|
),
|
||||||
title: t(
|
description:
|
||||||
"memberPortalCopiedToClipboard"
|
t(
|
||||||
|
"memberPortalCopiedAliasDescription"
|
||||||
),
|
),
|
||||||
description:
|
duration: 2000
|
||||||
t(
|
});
|
||||||
"memberPortalCopiedAliasDescription"
|
}}
|
||||||
),
|
>
|
||||||
duration: 2000
|
<Copy className="h-4 w-4" />
|
||||||
});
|
</Button>
|
||||||
}}
|
</div>
|
||||||
>
|
) : siteResource.destination ? (
|
||||||
<Copy className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
{/* Destination as secondary */}
|
|
||||||
<div className="text-xs text-muted-foreground truncate">
|
|
||||||
{
|
|
||||||
siteResource.destination
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
/* Destination as primary when no alias */
|
/* Destination as primary when no alias */
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className="text-sm text-muted-foreground font-medium text-left truncate flex-1">
|
<div className="text-sm text-muted-foreground font-medium text-left truncate flex-1">
|
||||||
@@ -1011,6 +1015,37 @@ export default function MemberResourcesPortal({
|
|||||||
<Copy className="h-4 w-4" />
|
<Copy className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
/* niceId fallback when no alias and no destination */
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="text-sm text-muted-foreground font-medium text-left truncate flex-1">
|
||||||
|
{
|
||||||
|
siteResource.niceId
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
className="h-8 w-8 text-muted-foreground"
|
||||||
|
onClick={() => {
|
||||||
|
navigator.clipboard.writeText(
|
||||||
|
siteResource.niceId
|
||||||
|
);
|
||||||
|
toast({
|
||||||
|
title: t(
|
||||||
|
"memberPortalCopiedToClipboard"
|
||||||
|
),
|
||||||
|
description:
|
||||||
|
t(
|
||||||
|
"memberPortalCopiedDestinationDescription"
|
||||||
|
),
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Copy className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user