diff --git a/app/dashboard/servers/Servers.tsx b/app/dashboard/servers/Servers.tsx index 2cc8887..e67d457 100644 --- a/app/dashboard/servers/Servers.tsx +++ b/app/dashboard/servers/Servers.tsx @@ -25,6 +25,7 @@ import { MemoryStick, HardDrive, LucideServer, + Copy, } from "lucide-react" import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { @@ -343,6 +344,40 @@ export default function Dashboard() { // Flatten icons for search const allIcons = Object.values(iconCategories).flat() + const copyServerDetails = (sourceServer: Server) => { + // First clear all fields + setName("") + setIcon("") + setOs("") + setIp("") + setUrl("") + setCpu("") + setGpu("") + setRam("") + setDisk("") + setMonitoring(false) + setMonitoringURL("") + setHost(false) + setHostServer(0) + + // Then copy the new server details + setTimeout(() => { + setName(sourceServer.name + " (Copy)") + setIcon(sourceServer.icon || "") + setOs(sourceServer.os || "") + setIp(sourceServer.ip || "") + setUrl(sourceServer.url || "") + setCpu(sourceServer.cpu || "") + setGpu(sourceServer.gpu || "") + setRam(sourceServer.ram || "") + setDisk(sourceServer.disk || "") + setMonitoring(sourceServer.monitoring || false) + setMonitoringURL(sourceServer.monitoringURL || "") + setHost(sourceServer.host) + setHostServer(sourceServer.hostServer || 0) + }, 0) + } + return ( @@ -390,7 +425,60 @@ export default function Dashboard() { - Add an server + + Add a server + + @@ -471,6 +559,7 @@ export default function Dashboard() { id="name" type="text" placeholder="e.g. Server1" + value={name} onChange={(e) => setName(e.target.value)} /> @@ -478,7 +567,7 @@ export default function Dashboard() { - setOs(value)}> @@ -490,13 +579,14 @@ export default function Dashboard() {
-
@@ -518,6 +608,7 @@ export default function Dashboard() { id="publicURL" type="text" placeholder="e.g. https://proxmox.server1.com" + value={url} onChange={(e) => setUrl(e.target.value)} /> @@ -526,46 +617,50 @@ export default function Dashboard() {
-
-
-
-
@@ -628,6 +723,7 @@ export default function Dashboard() { id="monitoringURL" type="text" placeholder={`http://${ip}:61208`} + value={monitoringURL} onChange={(e) => setMonitoringURL(e.target.value)} />