Skip to content

feat: copy server IP to clipboard#4264

Open
vytenisstaugaitis wants to merge 2 commits intoDokploy:canaryfrom
vytenisstaugaitis:feat/copy-ip-to-clipboard
Open

feat: copy server IP to clipboard#4264
vytenisstaugaitis wants to merge 2 commits intoDokploy:canaryfrom
vytenisstaugaitis:feat/copy-ip-to-clipboard

Conversation

@vytenisstaugaitis
Copy link
Copy Markdown
Contributor

@vytenisstaugaitis vytenisstaugaitis commented Apr 20, 2026

What is this PR about?

Added a copy to clipboard button next to the Server IP field in the Web Server settings.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related (if applicable)

closes #3982

Screenshots (if applicable)

Screenshot 2026-04-20 at 11 18 19 Screenshot 2026-04-20 at 11 19 05

Greptile Summary

This PR adds a copy-to-clipboard button next to the Server IP field in the Web Server settings card, using the browser Clipboard API with a 2-second visual toggle between Copy and Check icons. The implementation is straightforward and isolated to a single component with no state-management or API changes.

Confidence Score: 5/5

Safe to merge — the change is small, self-contained, and all remaining findings are P2 style suggestions.

No P0 or P1 issues. The two comments flag an unhandled async rejection (best-practice hardening) and a minor import style preference, neither of which blocks correct operation.

No files require special attention.

Comments Outside Diff (1)

  1. apps/dokploy/components/dashboard/settings/web-server.tsx, line 13 (link)

    P2 Prefer named React import

    The default React import is only used for React.useState. With the modern JSX transform already in use across this codebase, you can use the named import instead, which is the pattern used in sibling components.

    Then replace React.useState with useState on line 27.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (1): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 20, 2026
@dosubot dosubot Bot added the enhancement New feature or request label Apr 20, 2026
Comment on lines +29 to 33
};

return (
<div className="w-full">
{/* <Card className={cn("rounded-lg w-full bg-transparent p-0", className)}></Card> */}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unhandled clipboard API rejection

navigator.clipboard.writeText() will reject (e.g., on HTTP pages, in browsers without Clipboard API support, or when permission is denied), but the async function is called from onClick without a .catch() handler, so the error silently disappears and setCopied(true) is never reached. Wrapping in a try/catch lets you surface the failure.

Suggested change
};
return (
<div className="w-full">
{/* <Card className={cn("rounded-lg w-full bg-transparent p-0", className)}></Card> */}
const handleCopy = async () => {
try {
await navigator.clipboard.writeText(webServerSettings?.serverIp || "");
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch {
// clipboard write failed (no HTTPS, permission denied, etc.)
}
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy button next to server IP

1 participant