Skip to content

refactor(ui): unify copy buttons on a single CopyButton component - #37953

Merged
Rohit0301 merged 6 commits into
mainfrom
Rohit0301/copy01-icons-usage
Nov 17, 2026
Merged

Rohit0301 merged 6 commits into
mainfrom
Rohit0301/copy01-icons-usage

Conversation

@Rohit0301

@Rohit0301 Rohit0301 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes open-metadata/openmetadata-collate#8640

Unifies every copy-to-clipboard button in the UI on one component, components/common/CopyButton/CopyButton.tsx — the Context Center copy interaction (success pill + check + ring pulse) — instead of three near-duplicate variants and ~30 hand-rolled ButtonUtility icon={Copy01} + useClipboard blocks.

  • CopyButton (moved from components/CopyLinkButton/): value, tooltip, tooltipPlacement, size, color, testId, isDisabled, onCopy, className.
    • Icon-only (default): square → green circle + check + ring pulse, tooltip flips to "Copied".
    • Labeled (label): core Button, 16px icon, label flips to "Copied", green success state, no shape change.
    • Always stopPropagation/preventDefault so copying inside a clickable row/card does not open it.
  • Removed common/CopyLinkButton (field-link) and common/CopyToClipboardButton; their callers use CopyButton. New getEntityDetailsUrl() in RouterUtils builds the field link (same origin + getEntityDetailsPath logic as before).
  • Migrated icon-only sites (entity headers, query cards/viewers, code & schema editors, test connection steps, password generators, persona/role/policy detail, execution source, array fields, block-editor code block, reindex failures, bot JWT token) and labeled sites (test connection logs, bot/access tokens, health check logs, persona AI context, log viewer modal, agent run attention card).
  • Column/field link buttons in schema tables use size="xs" to match the edit pencil next to them.
  • Fixes a nested <button> in the old Context Center button (it wrapped ButtonUtility in a TooltipTrigger).
  • data-testids are unchanged at every existing site. New ids only where there was none: copy-execution-source, copy-array-field, copy-attention-log, and copy-secret on the SCIM bot token.
  • Duplicate actions that reuse the Copy01 glyph (announcement duplicate, block menu duplicate) are intentionally untouched.

Behaviour changes: copying a generated password / bot token / access token no longer shows a success toast (the button state replaces it); the code-block copy no longer dims on data-copied.

Collate companion PR (migrates Collate's own copy buttons) follows; it needs this merged first. Nothing in Collate imports the removed components or changed props.

Type of change:

  • Improvement

High-level design:

One shared component replaces three variants and the inline pattern. Callers keep layout-only classes; CopyButton applies the caller className before the success colours so the copied state always wins (e.g. the flush password button in the members form stays flush but turns green). Alternatives: keeping CopyToClipboardButton as a thin wrapper was rejected per the no-wrappers rule.

Tests:

Use cases covered

  • Copy link/URL/value from every surface listed above; copy inside a clickable table row does not trigger the row.
  • Labeled variant shows "Copied" and success state; disabled when there is nothing to copy.

Unit tests

  • CopyButton.test.tsx rewritten (icon + labeled variants, success state, accessible name, stopPropagation, onCopy, disabled).
  • Updated tests that mocked the removed components / old props (SchemaTable, TopicSchema, ContainerDataModel, APIEndpointSchema, SearchIndexFieldsTable, DisplayName, MemoriesView, DocumentPreviewPanel, AppLogsViewer, CoreArrayField, PersonaDetail, QueryViewer, BotTokenSection, TestCaseHeaderTitle, ServiceDocPanel code block).
  • 386 related suites / 6031 tests pass locally; tsc and ESLint clean on changed files.

Backend integration tests

  • Not applicable (UI only).

Playwright

  • Not re-run. Every testid used by existing specs is unchanged and "Copy"/"Copied" text assertions still hold.

Screenshots

01-table-entity-header-copied 01-table-entity-header-idle 02-table-column-link-copied 02-table-column-link-idle 03-topic-schema-field-link-copied 04-container-column-link-copied 05-search-index-field-link-copied 06-api-endpoint-field-link-copied 07-table-query-card-copied 07-table-query-card-idle 08-test-suite-details-header-copied 09-observability-test-suite-header-copied 10-incident-test-case-header-copied 11-observability-test-case-header-copied 12-bot-jwt-token-copied 13-topic-schema-text-editor-copied 14-topic-config-query-viewer-copied 15-search-index-settings-query-viewer-copied 16-persona-detail-link-copied 17-access-control-role-link-copied 18-access-control-policy-link-copied 19-profile-bot-token-copied 19-profile-bot-token-idle 20-health-check-logs-copied 21-access-token-row-copied 22-members-create-user-password-copied 22-members-create-user-password-idle 23-table-version-header-copied 24-create-user-password-copied 25-context-center-memory-row-copied 26-context-center-article-header-copied 27-ingestion-form-array-field-copied 28-sso-form-array-field-copied 29-service-doc-code-block-copied 30-om-health-connection-step-copied 31-test-definition-sql-code-editor-copied 32-agent-run-attention-card-copied 32-agent-run-attention-card-idle 33-log-viewer-modal-copied 33-log-viewer-modal-idle 34-profiler-execution-source-copied 35-test-connection-copy-log-copied 36-reindex-failures-copied 37-persona-ai-context-preview-copied 38-context-center-document-preview-copied

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

Unifies copy actions on CopyButton, with shared success feedback and icon-only or labeled buttons.

  • Copy buttons across the UI now share the same copied feedback.

Reviews (10) · Last reviewed commit: "refactor(ui): drop the code-block copy w..." · Reviewed by Greptile

Keep the Context Center copy interaction (success pill + ring pulse) as
components/common/CopyButton, add a labeled variant, and migrate every
copy-to-clipboard site to it. Remove common/CopyLinkButton and
common/CopyToClipboardButton. Existing data-testids are preserved.
@Rohit0301
Rohit0301 requested a review from a team as a code owner November 17, 2026 08:12
@Rohit0301
Rohit0301 requested a review from karanh37 November 17, 2026 08:12
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@Rohit0301 Rohit0301 added the safe to test Add this label to run secure Github workflows on PRs label Nov 17, 2026
@gitar-bot

gitar-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Replacing dozens of UI copy flows with one shared component changes clipboard feedback across many surfaces; failed copies could go unnoticed.

Unifies all copy-to-clipboard buttons on a single CopyButton component, replacing three variants and ~30 inline copy patterns, with the success state and click isolation applied consistently. The previously missing decision record for the shared copy-button rule has been addressed. No open issues found.

✅ 1 closed
✅ Quality: Copy-button rule set by this PR has no decision record

📄 openmetadata-ui/src/main/resources/ui/src/components/common/CopyButton/CopyButton.tsx:26-38 📄 openmetadata-ui/src/main/resources/ui/src/components/common/CopyButton/CopyButton.tsx:84-89
This PR makes a rule for the whole UI, and no record in docs/decisions/ states it. The description says the PR replaces every copy variant with one CopyButton so that "every copy action [gets] the same success feedback". It also says "copying a generated password, bot token or access token no longer shows a success toast, because the button state replaces it" and that "CopyButton always calls stopPropagation and preventDefault". The code also sets a 1200 ms reset (COPIED_RESET_MS). That value is a judgment call: the old CopyToClipboardButton default and the useClipboard default were both 1500 ms. The repo squash-merges, so these rules are lost once the PR body is gone, and the next person to add a copy action could bring back a toast or a hand-rolled button.

The record would say: "A copy action is common/CopyButton. It shows success with its own copied state (a check glyph on a filled success-solid button for 1200 ms) and no toast. It never lets the click reach a parent row or card." Also, 2026-11-13-react-aria-controlled-props-are-cleared-with-null-not-undefined.md still uses the deleted CopyToClipboardButton as its example, so that line should be updated too.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@Rohit0301
Rohit0301 enabled auto-merge (squash) November 17, 2026 09:49
@Rohit0301
Rohit0301 disabled auto-merge November 17, 2026 10:23
@Rohit0301
Rohit0301 enabled auto-merge (squash) November 17, 2026 10:23
@Rohit0301
Rohit0301 disabled auto-merge November 17, 2026 10:27
@Rohit0301
Rohit0301 merged commit 7eb05ee into main Nov 17, 2026
54 of 59 checks passed
@Rohit0301
Rohit0301 deleted the Rohit0301/copy01-icons-usage branch November 17, 2026 10:27
harsh-vador added a commit that referenced this pull request Nov 17, 2026
main went stale after #37953 and #37904 changed imports without
regenerating it, which fails the impact-map drift check on every PR.
harsh-vador added a commit that referenced this pull request Nov 18, 2026
* fix(ui): bump @apidevtools/json-schema-ref-parser to 15.3.6

CVE-2026-15195 (prototype pollution in Pointer.set) affects every
version below 15.3.6, including the 14.1.1 the UI resolved. Collate
already pins 15.3.6, so this also aligns the two UIs on one major.

15.x ships an ESM `import yaml from "js-yaml"`, and js-yaml 5 has no
default export, so a scoped resolution keeps js-yaml 4.3.2 under the
parser only; it must stay above the bare js-yaml entry.

parseSchemas.js passed its options to the $RefParser constructor,
which never read them. They now go on every call, with a JSON parse
plugin that drops `$id`: under 2020-12 15.x resolves $refs against
`$id`, and 122 spec schemas declare an `$id` that does not match their
file path, so refs fetched open-metadata.org instead of the local file.

The regenerated output differs only in five ingestion schemas, where
22 bundle-internal $refs pointed through another $ref and resolved
nowhere; all 22 now resolve.

* test(ui): assert every local $ref in generated schemas resolves

Fails on main's output with 22 dangling pointers in five ingestion
schemas; also drop the now-redundant post-bundle $id strip, since the
parse plugin removes $id when each file is read.

* docs(decisions): record why the ref-parser js-yaml pin precedes bare js-yaml

Yarn 1 applies the first matching resolution, so the scoped js-yaml 4.3.2
entry must stay above the bare js-yaml entry; package.json cannot carry
that comment. The record also says when the pin can go: ref-parser 16.x
depends on js-yaml ^5.

* test(ui): resolve $refs the way RJSF does in the generated-schema guard

URI-decode the fragment and keep empty pointer tokens, so
'#/definitions//x' no longer passes against a missing empty key; cover
empty, escaped and URI-encoded keys.

* chore(playwright): regenerate the impact map

main went stale after #37953 and #37904 changed imports without
regenerating it, which fails the impact-map drift check on every PR.
shah-harshit added a commit that referenced this pull request Nov 18, 2026
* test(playwright): refresh stale 2.1 visual baselines and fix shell menu scenes

Refresh 32 baselines from the 2.1 nightly (run 44266671648) actuals. Every
diff traces to an intended change that arrived with the main merge: Tableau
connected-app auth option (#37084), 400px entity summary panel (#37888),
unified CopyButton (#37953), new Insights/AdvancedSearch icons (#37973),
Data Estate connector counts (#37910) and the users Name/Email columns
(#37127, #37998).

shell-profile-menu and shell-mode-menu waited for my-data-page, which
#38077 removed from /my-data in AI mode; wait for home-landing-page.

* test(playwright): complete 2.1 shell and expanded Tableau baselines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants