feat: add copy button to User and Database Name in database credentials#4596
Open
ravindu0823 wants to merge 2 commits into
Open
feat: add copy button to User and Database Name in database credentials#4596ravindu0823 wants to merge 2 commits into
ravindu0823 wants to merge 2 commits into
Conversation
The Internal Credentials cards rendered User and Database Name as plain disabled inputs with no copy affordance, unlike the Password and Internal Host fields. Add a new CopyInput component (a visible input paired with a copy button) and use it for the User and Database Name fields across all database types. Fixes Dokploy#4495 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…submits Address review: the shared Button does not default type to "button", so a typeless button acts as type="submit". CopyInput is a reusable component; if dropped inside a form its copy action would submit the form. Set type="button" explicitly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a copy-to-clipboard button to the User and Database Name fields in the Internal Credentials cards across all database types, making them consistent with the existing copy buttons on the Password and Internal Host fields.
Fixes #4495
Root cause
The Internal Credentials cards rendered User and Database Name as plain
<Input disabled value=... />with no copy affordance, while Password and Internal Connection URL already usedToggleVisibilityInput(which includes a copy button).ToggleVisibilityInputcannot be reused here because it masks the value as a password.Fix
apps/dokploy/components/shared/copy-input.tsx: a visibleInputpaired with a copyButton, mirroringtoggle-visibility-input.tsx. It exports a pure, testable helpercopyToClipboard(value)that copies the value (viacopy-to-clipboard), shows asonnertoast, and returns the value (falling back to""forundefined).<Input>for<CopyInput>on the User / Database Name fields in the 6 credential components (postgres, mysql, mariadb — User + Database Name; mongo, redis, libsql — User only), keepingdisabledand the existingvalue. TheInputimport is retained since other fields still use it.Test
New TDD test
apps/dokploy/__test__/utils/copy-input.test.tsmockscopy-to-clipboardandsonner, then assertscopyToClipboardcopies the value, shows a toast, returns the value, and falls back to""forundefined.Confirmed RED first (module absent), then GREEN:
Typecheck clean:
pnpm --filter=dokploy run typecheck.🤖 Generated with Claude Code