Replaced old entity delete modal with untitles delete modal#29760
Replaced old entity delete modal with untitles delete modal#29760anuj-kumary wants to merge 12 commits into
Conversation
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>
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>
…rror Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…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>
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Gitar
|



Describe your changes:
Fixes #29730
I worked on ... because ...
Type of change:
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:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Summary by Gitar
DeleteWidgetModalwith the newDeleteEntityModalcomponent across various pages and components.DeleteEntityModal.tsxand its corresponding test fileDeleteEntityModal.test.tsxto standardize entity deletion workflows.permanently-delete-common-messageandsoft-delete-common-messageto support the new modal's messaging.DataQualityTab.test.tsx,ManageButton.test.tsx,AlertDetailsPage.test.tsx, etc.) to reflect the component migration.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 newDeleteEntityModalbuilt 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.DeleteEntityModal.tsxwith corresponding tests and i18n keys, and migrates all callers (ManageButton,BotListV1,DomainDetails,KPIList,RolesListPage,PoliciesListPage, etc.) to the new component.confirmation-text-inputselectors 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
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%%{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 --> YComments Outside Diff (1)
openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts, line 2222-2231 (link)hard-delete-optiondata-testid insoftDeleteEntity/hardDeleteEntityBoth
softDeleteEntity(line ~2130) andhardDeleteEntity(line 2222) still assert on[role="dialog"].ant-modaland.ant-modal-titlewhich are Ant Design class names. The newDeleteEntityModaluses@openmetadata/ui-core-componentsand will not render these classes, so thesewaitFor/expectcalls will time out every time.Additionally,
hardDeleteEntitystill clicks[data-testid="hard-delete-option"](line 2230). In the old modal this mapped to the innerTypography.Paragraphrendered as${option.type}-option. The newRadioButtononly setsdata-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 inserviceIngestion.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