Skip to content

Replaced old entity delete modal with untitles delete modal#29760

Open
anuj-kumary wants to merge 12 commits into
mainfrom
issue-29730-oss
Open

Replaced old entity delete modal with untitles delete modal#29760
anuj-kumary wants to merge 12 commits into
mainfrom
issue-29730-oss

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Jul 6, 2026

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #29730

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

High-level design:

N/A — small change.

Tests:

Use cases covered

Unit tests

Backend integration tests

Ingestion integration tests

Playwright (UI) tests

Manual testing performed

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Summary by Gitar

  • Refactored UI component:
    • Replaced DeleteWidgetModal with the new DeleteEntityModal component across various pages and components.
  • New component implementation:
    • Introduced DeleteEntityModal.tsx and its corresponding test file DeleteEntityModal.test.tsx to standardize entity deletion workflows.
  • Internationalization:
    • Added new locale keys for permanently-delete-common-message and soft-delete-common-message to support the new modal's messaging.
  • Testing updates:
    • Updated various unit tests (DataQualityTab.test.tsx, ManageButton.test.tsx, AlertDetailsPage.test.tsx, etc.) to reflect the component migration.
    • Updated Playwright e2e tests to align with the new deletion modal implementation.

This will update automatically on new commits.

Greptile Summary

This PR replaces the old DeleteWidgetModal (Ant Design–based, with a mandatory typed "DELETE" confirmation) with a new DeleteEntityModal built on @openmetadata/ui-core-components. The new modal uses radio buttons to choose between soft- and hard-delete, removing the text-input confirmation step entirely.

  • Introduces DeleteEntityModal.tsx with corresponding tests and i18n keys, and migrates all callers (ManageButton, BotListV1, DomainDetails, KPIList, RolesListPage, PoliciesListPage, etc.) to the new component.
  • Updates Playwright e2e tests and utility functions across ~40 files to remove confirmation-text-input selectors and Ant Design class assertions, replacing them with [data-testid=\"delete-modal\"] and radio-button clicks.

Confidence Score: 4/5

Safe to merge after addressing the stale-closure bug in the new DeleteEntityModal; all Playwright migrations look correct.

The new DeleteEntityModal component closes over successMessage and prepareType inside a useCallback that omits both from its dependency array. If a parent passes a changed successMessage or toggles prepareType between renders, the delete API call will use the wrong entity-type format and the success toast will show the stale message. The rest of the migration — selector replacements, async-path cleanup, and test updates — is solid.

openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteEntityModal.tsx — the useCallback dependency array for handleOnEntityDeleteConfirm needs successMessage and prepareType added.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteEntityModal.tsx New component — has missing deps in handleOnEntityDeleteConfirm's useCallback (successMessage, prepareType) and a missing await on the sync delete call in onConfirm.
openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteEntityModal.test.tsx New test file covering core scenarios; does not test the async-delete path or the onDelete override prop.
openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts Updated softDeleteEntity/hardDeleteEntity to use new modal selectors; stale ant-modal class assertions removed; adds fillDeleteConfirmationIfPresent helper.
openmetadata-ui/src/main/resources/ui/src/components/common/EntityPageInfos/ManageButton/ManageButton.tsx Minimal swap of DeleteWidgetModal to DeleteEntityModal; props forwarded unchanged.
openmetadata-ui/src/main/resources/ui/playwright/utils/serviceIngestion.ts Replaces hard-delete-option selector with hard-delete and removes text input fill; confirmation step aligned with new modal.
openmetadata-ui/src/main/resources/ui/playwright/utils/team.ts Replaces ant-modal/soft-delete-option/hard-delete-option selectors with new modal testids; looks correct.
openmetadata-ui/src/main/resources/ui/playwright/utils/user.ts Migrates user soft/hard delete helpers to new modal selectors; removes typed confirmation steps.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Roles.spec.ts Removes typed-confirmation lines; getElementWithPagination clicks the delete button so modal opens before confirmButton expectation runs.
openmetadata-ui/src/main/resources/ui/playwright/utils/testCases.ts confirmIngestionPipelineHardDelete still fills confirmation-text-input (correct, ingestion pipelines may retain old modal); moved after waitForResponse setup to avoid race.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([User clicks Delete]) --> B[DeleteEntityModal opens]
    B --> C{allowSoftDelete?}
    C -- true --> D[Default: Soft Delete selected]
    C -- false --> E[Default: Hard Delete selected]
    D --> F[User optionally switches to Hard Delete]
    E --> F
    F --> G([User clicks Confirm])
    G --> H{isAsyncDelete?}
    H -- yes --> I[setIsLoading true]
    I --> J[handleOnAsyncEntityDeleteConfirm]
    J --> K{throws?}
    K -- no --> L[afterDeleteAction]
    K -- yes --> M[swallowed by finally]
    L --> N[setIsLoading false + close modal]
    M --> N
    H -- no --> O{onDelete prop provided?}
    O -- yes --> P[onDelete called]
    O -- no --> Q[handleOnEntityDeleteConfirm]
    Q --> R[deleteEntity API call]
    R --> S{status 200?}
    S -- yes --> T[showSuccessToast]
    T --> U{EntityType USER + self?}
    U -- yes --> V[onLogoutHandler]
    U -- no --> W[afterDeleteAction]
    S -- no --> X[showErrorToast]
    W --> Y[finally: close modal]
    X --> Y
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A([User clicks Delete]) --> B[DeleteEntityModal opens]
    B --> C{allowSoftDelete?}
    C -- true --> D[Default: Soft Delete selected]
    C -- false --> E[Default: Hard Delete selected]
    D --> F[User optionally switches to Hard Delete]
    E --> F
    F --> G([User clicks Confirm])
    G --> H{isAsyncDelete?}
    H -- yes --> I[setIsLoading true]
    I --> J[handleOnAsyncEntityDeleteConfirm]
    J --> K{throws?}
    K -- no --> L[afterDeleteAction]
    K -- yes --> M[swallowed by finally]
    L --> N[setIsLoading false + close modal]
    M --> N
    H -- no --> O{onDelete prop provided?}
    O -- yes --> P[onDelete called]
    O -- no --> Q[handleOnEntityDeleteConfirm]
    Q --> R[deleteEntity API call]
    R --> S{status 200?}
    S -- yes --> T[showSuccessToast]
    T --> U{EntityType USER + self?}
    U -- yes --> V[onLogoutHandler]
    U -- no --> W[afterDeleteAction]
    S -- no --> X[showErrorToast]
    W --> Y[finally: close modal]
    X --> Y
Loading

Comments Outside Diff (1)

  1. openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts, line 2222-2231 (link)

    P1 Stale Ant Design selectors and missing hard-delete-option data-testid in softDeleteEntity / hardDeleteEntity

    Both softDeleteEntity (line ~2130) and hardDeleteEntity (line 2222) still assert on [role="dialog"].ant-modal and .ant-modal-title which are Ant Design class names. The new DeleteEntityModal uses @openmetadata/ui-core-components and will not render these classes, so these waitFor / expect calls will time out every time.

    Additionally, hardDeleteEntity still clicks [data-testid="hard-delete-option"] (line 2230). In the old modal this mapped to the inner Typography.Paragraph rendered as ${option.type}-option. The new RadioButton only sets data-testid={option.type} (i.e., "hard-delete"), so "hard-delete-option" no longer exists and the click will not find any element. The same stale selector is present in serviceIngestion.ts, bot.ts, user.ts, team.ts, and several spec files.

Reviews (10): Last reviewed commit: "fix(playwright): replace old hard/soft-d..." | Re-trigger Greptile

@anuj-kumary anuj-kumary self-assigned this Jul 6, 2026
@anuj-kumary anuj-kumary added the UI UI specific issues label Jul 6, 2026
@anuj-kumary anuj-kumary requested a review from a team as a code owner July 6, 2026 07:56
@anuj-kumary anuj-kumary added the safe to test Add this label to run secure Github workflows on PRs label Jul 6, 2026
Comment thread openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Roles.spec.ts Outdated
Comment thread openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Policies.spec.ts Outdated
The migration from EntityDeleteModal to DeleteEntityModal introduced a
dependency on Dialog, Modal, ModalOverlay, RadioButton, RadioGroup from
@openmetadata/ui-core-components. These sub-components were not covered
by the existing @openmetadata/ui-core-components mock in the test, causing
all tests to fail with "Cannot read properties of undefined (reading 'Header')".

Mock DeleteEntityModal directly (same pattern used in ManageButton.test.tsx,
CustomMetricGraphs.test.tsx, DataQualityTab.test.tsx) rather than expanding
the @openmetadata/ui-core-components mock with Dialog sub-components.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.77% (72734/114049) 46.91% (42343/90248) 48.2% (13020/27008)

Resolves modify/delete conflict on KnowledgeCenter.spec.ts (deleted in
main as part of the KnowledgeCenter→ContextCenter rename; our branch had
a minor modification — accepted main's deletion).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… in Policies spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
anuj-kumary and others added 3 commits July 7, 2026 00:19
…odal migration

Replace .ant-modal-header/.ant-modal-title/[role="dialog"].ant-modal selectors
with data-testid="delete-modal". Remove hard-delete-option clicks (use
data-testid="hard-delete" radio), drop confirmation-text-input fills and
toBeDisabled/not.toBeDisabled assertions that no longer apply — the new
DeleteEntityModal does not gate the confirm button on text input.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ty helpers

Update all utility functions that interact with the delete modal via ManageButton
to use the new DeleteEntityModal testids: wait on delete-modal instead of
[role="dialog"].ant-modal, click hard-delete/soft-delete radio buttons instead
of hard-delete-option/soft-delete-option, remove stale .ant-modal-title checks,
and collapse redundant check(hard-delete)/click(hard-delete-option) pairs to a
single click(hard-delete).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gitar-bot

gitar-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 2 resolved / 3 findings

Replaces the legacy entity delete modal with a new standardized component, but the async delete path lacks error handling, causing the modal to lock up on failure. Additionally, numerous Playwright helpers still reference stale Ant Design selectors and missing data-testids.

⚠️ Bug: Merge dropped used i18n key intake-form-plural-description

📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json:3287

The most recent commit (the main merge) removes the message.intake-form-plural-description key from all 20 locale files (e.g. en-us.json line ~3287). However, that key is still referenced in src/utils/GlobalSettingsClassBase.ts (description: t('message.intake-form-plural-description')) and src/pages/IntakeForms/IntakeFormsPage.tsx (subHeader: t('message.intake-form-plural-description')). On the PR branch prior to the merge (commit 7649465) the key was present and resolved correctly; after the merge it is gone from every locale file while the two call sites remain. As a result i18next will render the raw key string message.intake-form-plural-description in the Intake Forms settings page/subheader instead of the intended text.

This looks like a merge-conflict misresolution that accidentally deleted the key. Restore the intake-form-plural-description entry in all 20 locale files (or, if the Intake Forms feature is being intentionally dropped, remove the two t(...) call sites as well) so the key and its usages stay in sync.

Re-add the accidentally-removed key to all 20 locale files (translated per language) so the two t('message.intake-form-plural-description') call sites resolve.
"intake-form-plural-description": "Define governance-policy required fields for Data Products, Domains, and Glossary Terms. Enforced at both the API and UI layers.",
✅ 2 resolved
Bug: Policies delete test still asserts on stale .ant-modal selector

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Policies.spec.ts
The policy delete test still asserts await expect(page.locator('[role="dialog"].ant-modal')).toBeVisible(); after clicking the delete action. This PR migrated PoliciesListPage.tsx to render the new radio-based DeleteEntityModal (imported from components/common/DeleteWidget/DeleteEntityModal), which is built on @openmetadata/ui-core-components — not Ant Design — so it does not render the .ant-modal class. The toBeVisible() assertion will time out and fail the test. Since this PR removed the accompanying page.fill('DELETE') line (that flow no longer needs typed confirmation), the stale Ant Design dialog assertion should be updated to target the new modal's DOM (e.g. page.getByTestId('confirm-button') visibility) or removed.

Bug: page.locator() called with no selector will throw

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Glossary/GlossaryCRUDOperations.spec.ts:411-420
In GlossaryCRUDOperations.spec.ts, the edit that removed the old confirmation-text-input reference left behind const confirmInput = page.locator(); with no arguments. Playwright's Page.locator() requires a selector string argument; calling it with none throws a runtime error (locator: Expected a selector) as soon as this line executes. Because the new DeleteEntityModal no longer renders any confirmation-text-input (it uses radio buttons + a confirm button instead), the entire confirmInput block (lines 411-420) is now dead and broken. It should be removed, and the confirm button should be clicked directly after the modal becomes visible.

🤖 Prompt for agents
Code Review: Replaces the legacy entity delete modal with a new standardized component, but the async delete path lacks error handling, causing the modal to lock up on failure. Additionally, numerous Playwright helpers still reference stale Ant Design selectors and missing data-testids.

1. ⚠️ Bug: Merge dropped used i18n key intake-form-plural-description
   Files: openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json:3287

   The most recent commit (the `main` merge) removes the `message.intake-form-plural-description` key from all 20 locale files (e.g. `en-us.json` line ~3287). However, that key is still referenced in `src/utils/GlobalSettingsClassBase.ts` (`description: t('message.intake-form-plural-description')`) and `src/pages/IntakeForms/IntakeFormsPage.tsx` (`subHeader: t('message.intake-form-plural-description')`). On the PR branch prior to the merge (commit 76494659) the key was present and resolved correctly; after the merge it is gone from every locale file while the two call sites remain. As a result i18next will render the raw key string `message.intake-form-plural-description` in the Intake Forms settings page/subheader instead of the intended text.
   
   This looks like a merge-conflict misresolution that accidentally deleted the key. Restore the `intake-form-plural-description` entry in all 20 locale files (or, if the Intake Forms feature is being intentionally dropped, remove the two `t(...)` call sites as well) so the key and its usages stay in sync.

   Fix (Re-add the accidentally-removed key to all 20 locale files (translated per language) so the two t('message.intake-form-plural-description') call sites resolve.):
   "intake-form-plural-description": "Define governance-policy required fields for Data Products, Domains, and Glossary Terms. Enforced at both the API and UI layers.",

Options

Display: compact → Showing less information.

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

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

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 UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI - update delete modal design to match new design framework

1 participant