feat(deployments): Add option to copy webhook url by clicking on it

This commit is contained in:
Jiří Vrba
2026-03-09 09:25:41 +01:00
parent 8e9ab98a7a
commit 4330d7bd99
@@ -1,7 +1,7 @@
import { import {
ChevronDown, ChevronDown,
ChevronUp, ChevronUp,
Clock, Clock, Copy,
Loader2, Loader2,
RefreshCcw, RefreshCcw,
RocketIcon, RocketIcon,
@@ -30,6 +30,7 @@ import { ClearDeployments } from "./clear-deployments";
import { KillBuild } from "./kill-build"; import { KillBuild } from "./kill-build";
import { RefreshToken } from "./refresh-token"; import { RefreshToken } from "./refresh-token";
import { ShowDeployment } from "./show-deployment"; import { ShowDeployment } from "./show-deployment";
import copy from "copy-to-clipboard";
interface Props { interface Props {
id: string; id: string;
@@ -224,11 +225,19 @@ export const ShowDeployments = ({
<div className="flex flex-row items-center gap-2 flex-wrap"> <div className="flex flex-row items-center gap-2 flex-wrap">
<span>Webhook URL: </span> <span>Webhook URL: </span>
<div className="flex flex-row items-center gap-2"> <div className="flex flex-row items-center gap-2">
<span className="break-all text-muted-foreground"> <Badge
className="p-2 rounded-md ml-1 mr-1 hover:border-primary hover:text-primary-foreground hover:bg-primary hover:cursor-pointer"
variant="outline"
onClick={() => {
copy(`${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`);
toast.success("Copied to clipboard.");
}}
>
{`${url}/api/deploy${ {`${url}/api/deploy${
type === "compose" ? "/compose" : "" type === "compose" ? "/compose" : ""
}/${refreshToken}`} }/${refreshToken}`}
</span> <Copy className="h-4 w-4 ml-1 text-muted-foreground"/>
</Badge>
{(type === "application" || type === "compose") && ( {(type === "application" || type === "compose") && (
<RefreshToken id={id} type={type}/> <RefreshToken id={id} type={type}/>
)} )}
@@ -268,7 +277,8 @@ export const ShowDeployments = ({
className="flex flex-col gap-4 rounded-lg border p-4 sm:flex-row sm:items-center sm:justify-between" className="flex flex-col gap-4 rounded-lg border p-4 sm:flex-row sm:items-center sm:justify-between"
> >
<div className="flex flex-1 flex-col min-w-0"> <div className="flex flex-1 flex-col min-w-0">
<span className="flex items-center gap-4 font-medium capitalize text-foreground"> <span
className="flex items-center gap-4 font-medium capitalize text-foreground">
{index + 1}. {deployment.status} {index + 1}. {deployment.status}
<StatusTooltip <StatusTooltip
status={deployment?.status} status={deployment?.status}
@@ -277,7 +287,8 @@ export const ShowDeployments = ({
</span> </span>
<div className="flex flex-col gap-1"> <div className="flex flex-col gap-1">
<span className="break-words text-sm text-muted-foreground whitespace-pre-wrap"> <span
className="break-words text-sm text-muted-foreground whitespace-pre-wrap">
{isExpanded || !needsTruncation {isExpanded || !needsTruncation
? titleText ? titleText
: truncateDescription(titleText)} : truncateDescription(titleText)}
@@ -322,8 +333,10 @@ export const ShowDeployments = ({
)} )}
</div> </div>
</div> </div>
<div className="flex w-full flex-col items-start gap-2 sm:w-auto sm:max-w-[300px] sm:items-end sm:justify-start"> <div
<div className="text-sm capitalize text-muted-foreground flex flex-wrap items-center gap-2"> className="flex w-full flex-col items-start gap-2 sm:w-auto sm:max-w-[300px] sm:items-end sm:justify-start">
<div
className="text-sm capitalize text-muted-foreground flex flex-wrap items-center gap-2">
<DateTooltip date={deployment.createdAt}/> <DateTooltip date={deployment.createdAt}/>
{deployment.startedAt && deployment.finishedAt && ( {deployment.startedAt && deployment.finishedAt && (
<Badge <Badge
@@ -342,7 +355,8 @@ export const ShowDeployments = ({
)} )}
</div> </div>
<div className="flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:justify-end"> <div
className="flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:justify-end">
{deployment.pid && deployment.status === "running" && ( {deployment.pid && deployment.status === "running" && (
<DialogAction <DialogAction
title="Kill Process" title="Kill Process"
@@ -445,7 +459,8 @@ export const ShowDeployments = ({
isLoading={isRollingBack} isLoading={isRollingBack}
className="w-full sm:w-auto" className="w-full sm:w-auto"
> >
<RefreshCcw className="size-4 text-primary group-hover:text-red-500" /> <RefreshCcw
className="size-4 text-primary group-hover:text-red-500"/>
Rollback Rollback
</Button> </Button>
</DialogAction> </DialogAction>