Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { api } from "@/utils/api";
import { Button } from "@/components/ui/button";

interface Props {
id: string;
Expand All @@ -25,8 +26,10 @@ export const RefreshToken = ({ id, type }: Props) => {
const utils = api.useUtils();
return (
<AlertDialog>
<AlertDialogTrigger>
<RefreshCcw className="h-4 w-4 cursor-pointer text-muted-foreground" />
<AlertDialogTrigger asChild>
<Button variant="ghost" size="icon">
<RefreshCcw className="h-4 w-4 cursor-pointer text-muted-foreground" />
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import {
ChevronUp,
Clock,
Copy,
EyeClosedIcon,
EyeIcon,
EyeOffIcon,
Loader2,
RefreshCcw,
RocketIcon,
Expand Down Expand Up @@ -98,13 +101,19 @@ export const ShowDeployments = ({
const [expandedDescriptions, setExpandedDescriptions] = useState<Set<string>>(
new Set(),
);
const [showWebhookUrl, setShowWebhookUrl] = useState(false);

const webhookUrl = useMemo(
() =>
`${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`,
[url, refreshToken, type],
);

const webhookUrlMasked = useMemo(
() => "•".repeat(webhookUrl.length),
[webhookUrl],
);

const MAX_DESCRIPTION_LENGTH = 200;

const truncateDescription = (description: string): string => {
Expand Down Expand Up @@ -231,7 +240,7 @@ export const ShowDeployments = ({
</span>
<div className="flex flex-row items-center gap-2 flex-wrap">
<span>Webhook URL: </span>
<div className="flex flex-row items-center gap-2">
<div className="flex flex-row items-center gap-1">
<Badge
role="button"
tabIndex={0}
Expand All @@ -250,9 +259,24 @@ export const ShowDeployments = ({
toast.success("Copied to clipboard.");
}}
>
{webhookUrl}
<span className="font-mono">
{showWebhookUrl ? webhookUrl : webhookUrlMasked}
</span>
<Copy className="h-4 w-4 ml-2" />
</Badge>
<Button
variant="ghost"
size="icon"
onClick={() => {
setShowWebhookUrl((v) => !v);
}}
>
{showWebhookUrl ? (
<EyeIcon className="h-4 w-4 cursor-pointer text-muted-foreground" />
) : (
<EyeOffIcon className="h-4 w-4 cursor-pointer text-muted-foreground" />
)}
</Button>
{(type === "application" || type === "compose") && (
<RefreshToken id={id} type={type} />
)}
Expand Down
Loading