Skip to content

Commit e48f143

Browse files
authored
Merge pull request #1238 from wish-oss/feat/copy-ip
feat: added clipboard functionality to copy IP address from badge in services pages
2 parents 407e2e1 + 5c889e8 commit e48f143

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import { useRouter } from "next/router";
5252
import React, { useState, useEffect, type ReactElement } from "react";
5353
import { toast } from "sonner";
5454
import superjson from "superjson";
55+
import copy from 'copy-to-clipboard';
5556

5657
type TabState =
5758
| "projects"
@@ -139,6 +140,13 @@ const Service = (
139140
<div className="flex flex-col h-fit w-fit gap-2">
140141
<div className="flex flex-row h-fit w-fit gap-2">
141142
<Badge
143+
className="cursor-pointer"
144+
onClick={() => {
145+
if (data?.server?.ipAddress) {
146+
copy(data.server.ipAddress);
147+
toast.success("IP Address Copied!");
148+
}
149+
}}
142150
variant={
143151
!data?.serverId
144152
? "default"

apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ import Link from "next/link";
4444
import { useRouter } from "next/router";
4545
import React, { useState, useEffect, type ReactElement } from "react";
4646
import superjson from "superjson";
47+
import { toast } from "sonner";
48+
import copy from 'copy-to-clipboard';
4749

4850
type TabState =
4951
| "projects"
@@ -131,6 +133,13 @@ const Service = (
131133
<div className="flex flex-col h-fit w-fit gap-2">
132134
<div className="flex flex-row h-fit w-fit gap-2">
133135
<Badge
136+
className="cursor-pointer"
137+
onClick={() => {
138+
if (data?.server?.ipAddress) {
139+
copy(data.server.ipAddress);
140+
toast.success("IP Address Copied!");
141+
}
142+
}}
134143
variant={
135144
!data?.serverId
136145
? "default"
@@ -142,7 +151,7 @@ const Service = (
142151
{data?.server?.name || "Dokploy Server"}
143152
</Badge>
144153
{data?.server?.serverStatus === "inactive" && (
145-
<TooltipProvider delayDuration={0}>
154+
<TooltipProvider>
146155
<Tooltip>
147156
<TooltipTrigger asChild>
148157
<Label className="break-all w-fit flex flex-row gap-1 items-center">

0 commit comments

Comments
 (0)