From d8f1548076447725fac3b3cff20f322ef92fb1d6 Mon Sep 17 00:00:00 2001 From: vishalkadam47 Date: Wed, 29 Jan 2025 13:09:58 +0530 Subject: [PATCH] feat: added clipboard functionality to copy IP address from badge in services pages --- .../services/application/[applicationId].tsx | 9 ++++++++- .../[projectId]/services/compose/[composeId].tsx | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx index 3ef433ed9..9b2435ec8 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx @@ -51,7 +51,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import React, { useState, useEffect, type ReactElement } from "react"; import { toast } from "sonner"; -import superjson from "superjson"; +import superjson from "superjson"; type TabState = | "projects" @@ -139,6 +139,13 @@ const Service = (
{ + if (data?.server?.ipAddress) { + navigator.clipboard.writeText(data.server.ipAddress); + toast.success("IP Address Copied!"); + } + }} variant={ !data?.serverId ? "default" diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx index 66c3ef537..ad9a8ad7a 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx @@ -44,6 +44,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import React, { useState, useEffect, type ReactElement } from "react"; import superjson from "superjson"; +import { toast } from "sonner"; type TabState = | "projects" @@ -131,6 +132,13 @@ const Service = (
{ + if (data?.server?.ipAddress) { + navigator.clipboard.writeText(data.server.ipAddress); + toast.success("IP Address Copied!"); + } + }} variant={ !data?.serverId ? "default" @@ -142,7 +150,7 @@ const Service = ( {data?.server?.name || "Dokploy Server"} {data?.server?.serverStatus === "inactive" && ( - +