Skip to content

Replaced entity delete modal with hard delete modal - #29851

Merged
anuj-kumary merged 21 commits into
mainfrom
delete-modal
Jul 10, 2026
Merged

anuj-kumary merged 21 commits into
mainfrom
delete-modal

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Replaced the optional delete modal with the direct delete modal for entities that only support Permanent Delete.

Screenshot 2026-07-10 at 1 19 55 PM

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.

Greptile Summary

This PR replaces soft/hard delete choice modals with direct hard-delete confirmations for entities that only support permanent deletion. The main changes are:

  • Adds a shared hard-delete helper with standard toast handling.
  • Routes hard-delete-only ManageButton flows through the lightweight delete modal.
  • Preserves async delete handling for async entity delete callers.
  • Updates alert, KPI, domain, role, policy, custom metric, and test definition delete flows.
  • Adjusts Jest and Playwright tests for the new modal behavior.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/src/components/common/EntityPageInfos/ManageButton/ManageButton.tsx Adds the direct hard-delete modal path and keeps async hard deletes on the async delete provider.
openmetadata-ui/src/main/resources/ui/src/utils/DeleteWidget/DeleteWidgetUtils.ts Introduces a shared helper for permanent entity deletion and toast handling.
openmetadata-ui/src/main/resources/ui/src/utils/DeleteWidget/DeleteWidgetUtils.test.ts Adds helper coverage with a default-export mock shape that matches the production import.
openmetadata-ui/src/main/resources/ui/src/pages/NotificationListPage/NotificationListPage.tsx Moves notification deletion to the direct hard-delete confirmation flow.
openmetadata-ui/src/main/resources/ui/src/pages/ObservabilityAlertsPage/ObservabilityAlertsPage.tsx Moves observability alert deletion to the direct hard-delete confirmation flow.

Reviews (17): Last reviewed commit: "Added unit test" | Re-trigger Greptile

Context used (3)

  • Context used - CLAUDE.md (source)
  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - AGENTS.md (source)

@anuj-kumary anuj-kumary self-assigned this Jul 8, 2026
@anuj-kumary
anuj-kumary requested a review from a team as a code owner July 8, 2026 17:00
@anuj-kumary anuj-kumary added safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (25 flaky)

✅ 4413 passed · ❌ 0 failed · 🟡 25 flaky · ⏭️ 175 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 423 0 4 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 786 0 6 40
🟡 Shard 4 813 0 1 18
🟡 Shard 5 826 0 1 5
🟡 Shard 6 822 0 4 46
🟡 Shard 7 732 0 9 50
🟡 25 flaky test(s) (passed on retry)
  • Features/TeamsDragAndDrop.spec.ts › Add teams in hierarchy (shard 1, 1 retry)
  • Features/TeamsHierarchy.spec.ts › Add teams in hierarchy (shard 1, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: metric (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a fully denied user sees neither asset type when browsing (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary Term (Nested) (shard 3, 2 retries)
  • Features/BulkImportWithDotInName.spec.ts › CSV with quoted FQN loads correctly in import grid (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article list cards, recently viewed widget, and pagination work (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › description: switching articles does not bleed unsaved content into next article (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clicking a memory row adds ?memory= param to the URL (shard 3, 1 retry)
  • Features/Glossary/GlossaryTermRelationsGraphNested.spec.ts › viewing a child term: parent appears as a 1-hop neighbour via parentOf edge (shard 4, 2 retries)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Entity Version Less than < (shard 5, 1 retry)
  • Pages/DomainAdvanced.spec.ts › Domain expert can edit domain description and tags (shard 6, 1 retry)
  • Pages/EntityDataConsumer.spec.ts › Tier Add, Update and Remove (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should perform CRUD and Removal operations for searchIndex (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Steward to view all tabs for searchIndex (shard 7, 1 retry)
  • Pages/Glossary.spec.ts › Create term with related terms, tags and owners during creation (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Check for Circular Reference in Glossary Import (shard 7, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › Column lineage for dashboard -> topic (shard 7, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 7, 1 retry)
  • Pages/ODCSImportExportPermissions.spec.ts › Admin should successfully import ODCS contract (shard 7, 1 retry)
  • VersionPages/EntityVersionPages.spec.ts › ApiEndpoint (shard 7, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

anuj-kumary and others added 4 commits July 9, 2026 08:31
DeleteEntityModal had data-testid="delete-modal" on its outer element;
Domains.spec.ts (and other tests) rely on getByTestId('delete-modal')
to verify the confirmation dialog is open. DeleteModal was missing this
attribute, causing the playwright Domain tests to fail after the swap.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
siddhant1
siddhant1 previously approved these changes Jul 10, 2026
@sonarqubecloud

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 4 resolved / 5 findings

Replaces optional delete modals with a direct hard-delete flow and shared helper utility. Ensure that removing the typed confirmation requirement does not lead to accidental permanent data loss.

💡 Edge Case: Permanent-delete confirmation now single-click, no typed confirmation

📄 openmetadata-ui/src/main/resources/ui/src/components/common/DeleteModal/DeleteModal.tsx:79-90

The new shared DeleteModal (components/common/DeleteModal/DeleteModal.tsx) confirms deletion with a single always-enabled Delete button and no typed-confirmation input. The previous DeleteEntityModal/EntityDeleteModal flows used for hard deletes typically required the user to type a confirmation string before the destructive action could proceed. By migrating hard-delete-only entities (domains, KPIs, roles, policies, test definitions, notification/observability alerts, custom metrics) to DeleteModal, a permanent, irreversible delete is now a single click. This appears intentional per the PR description, but it does reduce the friction/safety guard on irreversible operations. Consider whether a typed confirmation (or at least a clearly worded destructive warning) should be retained for these permanent deletes.

✅ 4 resolved
✅ Quality: Delete handlers not wrapped in useCallback

📄 openmetadata-ui/src/main/resources/ui/src/pages/DataInsightPage/KPIList.tsx:208-220 📄 openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainDetails/DomainDetails.component.tsx:339-351 📄 openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesListPage/PoliciesListPage.tsx:247-259
The new async delete handlers (handleDomainDelete, handleKpiDelete, handlePolicyDelete, handleRoleDelete, handleAlertHardDelete) are declared as plain functions recreated on every render and passed as the onDelete prop to DeleteModal. The repo convention is to wrap event handlers in useCallback to avoid unnecessary re-renders of child components. Wrapping these in useCallback (with the appropriate dependency arrays, e.g. the selected entity and refresh callback) keeps them consistent with the codebase's performance guidelines.

✅ Quality: Hard-delete success/failure flows lack unit test coverage on pages

📄 openmetadata-ui/src/main/resources/ui/src/pages/NotificationListPage/NotificationListPage.tsx:209-222 📄 openmetadata-ui/src/main/resources/ui/src/pages/ObservabilityAlertsPage/ObservabilityAlertsPage.tsx:49-62
The migrated pages (NotificationListPage, ObservabilityAlertsPage, KPIList, RolesListPage, PoliciesListPage, DomainDetails) add new handle*HardDelete/handle*Delete callbacks that call hardDeleteEntity and branch on its boolean result (refetch/afterDeleteAction on success, clear selection on failure). The updated tests only assert that the DeleteModal renders (e.g. NotificationListPage.test.tsx, ObservabilityAlertsPage.test.tsx now just check for the DeleteModal text). Only the shared hardDeleteEntity util and ManageButton routing are directly tested. The page-level success/failure branching (modal close, refetch, selection reset) is untested. Consider adding tests that click confirm and assert the delete API is called and the modal closes on success.

✅ Quality: Inconsistent/misleading confirmation copy for hard deletes

📄 openmetadata-ui/src/main/resources/ui/src/pages/DataInsightPage/KPIList.tsx:266-268 📄 openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesListPage/RolesListPage.tsx 📄 openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainDetails/DomainDetails.component.tsx:1125-1127
All migrated call sites now perform a permanent (hard) delete via hardDeleteEntity, but the confirmation message shown in DeleteModal is inconsistent across them. DomainDetails.component.tsx and CustomMetricGraphs.component.tsx use message.permanently-delete-common-message (which warns the action is permanent), while KPIList.tsx, RolesListPage.tsx, and the other page migrations use the generic message.are-you-sure-delete-entity, which does not communicate that the entity will be permanently removed. Since the previous DeleteEntityModal explicitly rendered a hard-delete option/description, dropping the permanence warning on some screens is a UX regression. Standardize on the permanently-delete-common-message (or an equivalent permanent-delete string) for every hard-delete call site so users are consistently warned the action cannot be undone.

✅ Bug: deleteOptions/hardDeleteMessagePostFix ignored when allowSoftDelete=false

📄 openmetadata-ui/src/main/resources/ui/src/components/common/EntityPageInfos/ManageButton/ManageButton.tsx:337-351 📄 openmetadata-ui/src/main/resources/ui/src/components/common/EntityPageInfos/ManageButton/ManageButton.tsx:342-347 📄 openmetadata-ui/src/main/resources/ui/src/components/common/EntityPageInfos/ManageButton/ManageButton.tsx:88-100
In ManageButton.tsx the new branch renders the lightweight DeleteModal whenever allowSoftDelete === false. DeleteModal only accepts entityTitle, message, isDeleting, onCancel, and onDelete. This means the deleteOptions and hardDeleteMessagePostFix props that callers pass to ManageButton are now silently dropped for hard-delete-only entities.

A concrete regression: KnowledgeDetailPageHeader.tsx (around line 409-428) passes allowSoftDelete={false} together with a custom deleteOptions array that defines a specific confirmation title (Permanently delete <type> "<name>") and description via deleteWidgetClassBase.getDeleteMessage(...). Previously DeleteEntityModal rendered those custom options; now the generic message.permanently-delete-common-message string is shown instead and the custom copy is lost. The delete still functions, but the intended confirmation text no longer appears.

Suggested fix: forward the custom message into the DeleteModal message prop (e.g. derive it from deleteOptions?.[0]?.description / hardDeleteMessagePostFix) so hard-delete-only callers keep their customized confirmation copy, or continue routing callers that supply deleteOptions through DeleteEntityModal.

🤖 Prompt for agents
Code Review: Replaces optional delete modals with a direct hard-delete flow and shared helper utility. Ensure that removing the typed confirmation requirement does not lead to accidental permanent data loss.

1. 💡 Edge Case: Permanent-delete confirmation now single-click, no typed confirmation
   Files: openmetadata-ui/src/main/resources/ui/src/components/common/DeleteModal/DeleteModal.tsx:79-90

   The new shared `DeleteModal` (components/common/DeleteModal/DeleteModal.tsx) confirms deletion with a single always-enabled `Delete` button and no typed-confirmation input. The previous `DeleteEntityModal`/`EntityDeleteModal` flows used for hard deletes typically required the user to type a confirmation string before the destructive action could proceed. By migrating hard-delete-only entities (domains, KPIs, roles, policies, test definitions, notification/observability alerts, custom metrics) to `DeleteModal`, a permanent, irreversible delete is now a single click. This appears intentional per the PR description, but it does reduce the friction/safety guard on irreversible operations. Consider whether a typed confirmation (or at least a clearly worded destructive warning) should be retained for these permanent deletes.

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

This branch was previously deployed

1 inactive deployment
test — 715c4ddb Deployed Jul 10, 2026 by anuj-kumary via playwright-ci-postgresql (2, 7) #55909
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 skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants