OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Addressed Context Center feedbacks

Open Rohit0301 opened this issue 5 months ago β€’ 4 comments

Describe your changes:

https://github.com/user-attachments/assets/095467dc-b2bd-40f6-b3cb-8b1f1971ccb4

Fixes 29275

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:

  • [x] 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

  • UI/UX improvements:
    • Refactored ArchiveView and MemoriesView to use updated button components and improved icon layouts.
    • Updated KnowledgeCard and ArticleDetailHeader to standardize typography weights and iconography.
    • Added maxItemWidth to Breadcrumbs to prevent layout overflow in headers.
  • Knowledge Center state management:
    • Implemented pendingSaveCountRef in KnowledgePageDetailComponent to prevent premature status transitions to SAVED during concurrent debounced patches.
    • Synchronized TitleComponent with external prop changes to ensure the input reflects the persisted display name.
  • Messaging and Localization:
    • Updated soft-delete-message-for-entity in en-us.json to reflect that soft-deleted items can be restored from Archives.
    • Standardized delete confirmation modal messages across ContextCenter modules to use consistent entity type labeling.

This will update automatically on new commits.

Greptile Summary

This PR addresses Context Center UX feedback across the Knowledge Center and Context Center modules β€” fixing a race condition where concurrent debounced saves prematurely flipped status to SAVED, syncing TitleComponent without clobbering in-progress edits, and rendering quick links inline in the article hierarchy with a dedicated click handler.

  • pendingSaveCountRef in KnowledgePageDetailComponent: increments on beginTrackedSave and decrements on endTrackedSave (called from finally) so the SAVED state only transitions once all concurrent saves have settled.
  • TitleComponent prop sync guard: introduces prevValueRef so incoming value prop updates only overwrite local state when the user has not diverged from the last persisted value, preventing API-response clobbers.
  • Quick link inline editing in KnowledgePagesHierarchy: quick-link nodes now render with a click handler (onQuickLinkClick) instead of a <Link>, and their delete calls hardDelete=true while article deletes remain soft; the article count in the hierarchy header now draws from a dedicated getListKnowledgePages({ limit: 0 }) call rather than pagination state.

Confidence Score: 4/5

Safe to merge with one small UI label inconsistency; a previously-flagged delete-message/API mismatch for articles remains unaddressed in both KnowledgePagesHierarchy and ArticleDetailHeader.

The concurrent-save fix, TitleComponent sync guard, and quick-link hierarchy rendering are all correct. The delete flow for quick links is now consistent (hardDelete=true matches the permanent-deletion message). However, article deletes in both KnowledgePagesHierarchy and ArticleDetailHeader still call the soft-delete API while showing the removed permanently message, leaving soft-deleted articles unrecoverable via the Archive UI β€” a mismatch that was raised in a prior review round and has not yet been resolved.

KnowledgePagesHierarchy.tsx and ArticleDetailHeader.component.tsx β€” the article delete path still shows a permanent-deletion message while performing a soft-delete.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePageDetailComponent/KnowledgePageDetailComponent.tsx Adds pendingSaveCountRef to prevent premature SAVED status when multiple debounced saves are in flight; uses functional setState updater to avoid stale closures.
openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/TitleComponent/TitleComponent.tsx Adds prevValueRef guard so incoming prop changes only sync to local state when the user has not diverged from the last known saved value, preventing mid-edit clobbers.
openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx Quick links now rendered inline with articles; collapse/expand toggling switched from empty-keys heuristic to explicit isUserExpandedAll flag; article count label mismatch with all-type total count.
openmetadata-ui/src/main/resources/ui/src/pages/ContextCenterPage/ContextCenterArticlesPage/ContextCenterArticlesPage.tsx Adds quick-link inline editing via handleQuickLinkClick; refactors callbacks to useCallback; wraps permission fetch and article/quick-link creation in memoized callbacks.
openmetadata-ui/src/main/resources/ui/src/utils/StringUtils.ts Adds decodeHtmlEntities (DOMParser-based, browser-safe) and pipes stripMarkdown output through it to decode HTML entities left over from markdown removal.
openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json Adds soft-delete-archive-message (used by ContextCenterDocumentsPage), article-lowercase, document-lowercase, and quick-link-lowercase keys without modifying the global soft-delete-message-for-entity.
openmetadata-ui/src/main/resources/ui/src/rest/knowledgeCenterAPI.ts Changes getPageHierarchyFromES pageType parameter from PageType.ARTICLE default to optional, enabling hierarchy calls to return all page types including quick links.
openmetadata-ui/src/main/resources/ui/src/components/ContextCenter/ArticleDetailHeader/ArticleDetailHeader.component.tsx Replaces inline clipboard logic with CopyLinkButton; updates color tokens; switches delete message to delete-entity-permanently while the API call still does a soft-delete (hardDelete=false).

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant U as User (types title/content)
    participant TC as TitleComponent
    participant KPD as KnowledgePageDetailComponent
    participant API as patchKnowledgePage API

    U->>TC: onChange(value)
    TC->>KPD: handleDisplayNameOnChange
    KPD->>KPD: setContentChangeState(UN_SAVED)
    KPD->>KPD: "beginTrackedSave() pendingSaveCount=1"
    KPD->>API: patchKnowledgePage(patch1)

    U->>TC: onChange(more text)
    TC->>KPD: handleDisplayNameOnChange
    KPD->>KPD: "beginTrackedSave() pendingSaveCount=2"
    KPD->>API: patchKnowledgePage(patch2)

    API-->>KPD: response1
    KPD->>KPD: "endTrackedSave() pendingSaveCount=1 stay SAVING"
    KPD-->>TC: value prop updated
    TC->>TC: "titleValue != prevValueRef skip sync"

    API-->>KPD: response2
    KPD->>KPD: "endTrackedSave() pendingSaveCount=0 set SAVED"
    KPD-->>TC: value prop updated
    TC->>TC: "titleValue == prevValueRef sync"
%%{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"}}}%%
sequenceDiagram
    participant U as User (types title/content)
    participant TC as TitleComponent
    participant KPD as KnowledgePageDetailComponent
    participant API as patchKnowledgePage API

    U->>TC: onChange(value)
    TC->>KPD: handleDisplayNameOnChange
    KPD->>KPD: setContentChangeState(UN_SAVED)
    KPD->>KPD: "beginTrackedSave() pendingSaveCount=1"
    KPD->>API: patchKnowledgePage(patch1)

    U->>TC: onChange(more text)
    TC->>KPD: handleDisplayNameOnChange
    KPD->>KPD: "beginTrackedSave() pendingSaveCount=2"
    KPD->>API: patchKnowledgePage(patch2)

    API-->>KPD: response1
    KPD->>KPD: "endTrackedSave() pendingSaveCount=1 stay SAVING"
    KPD-->>TC: value prop updated
    TC->>TC: "titleValue != prevValueRef skip sync"

    API-->>KPD: response2
    KPD->>KPD: "endTrackedSave() pendingSaveCount=0 set SAVED"
    KPD-->>TC: value prop updated
    TC->>TC: "titleValue == prevValueRef sync"

Comments Outside Diff (1)

  1. openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx, line 839-851 (link)

    P1 Article delete: "permanently removed" message but soft-delete API call

    The delete modal now shows delete-entity-permanently ("Once you delete this article, it will be removed permanently."), but the actual API call for articles is deleteKnowledgePage(deletePage.id) β€” which defaults to hardDelete = false (soft-delete). Since the Archive page no longer lists soft-deleted articles (that display was removed in ContextCenterArchivePage.tsx), users who "permanently delete" an article cannot recover it via the UI while the record silently accumulates as a soft-deleted row in the database.

    Either pass hardDelete = true for articles to match the modal message, or revert to a soft-delete–appropriate message (e.g., soft-delete-archive-message or soft-delete-message-for-entity) and restore the archive display. The same inconsistency exists in ArticleDetailHeader.component.tsx (line 652) where delete-entity-permanently is used with deleteKnowledgePage(knowledgePage.id) (no hardDelete).

Reviews (18): Last reviewed commit: "minor fix" | Re-trigger Greptile

Rohit0301 avatar Jun 19 '26 17:06 Rohit0301

🟑 Playwright Results β€” all passed (54 flaky)

βœ… 4422 passed Β· ❌ 0 failed Β· 🟑 54 flaky Β· ⏭️ 38 skipped

Shard Passed Failed Flaky Skipped
🟑 Shard 1 320 0 5 4
🟑 Shard 2 817 0 12 9
🟑 Shard 3 825 0 4 7
🟑 Shard 4 829 0 2 10
🟑 Shard 5 853 0 21 0
🟑 Shard 6 778 0 10 8
🟑 54 flaky test(s) (passed on retry)
  • Features/CustomizeDetailPage.spec.ts β€Ί Dashboard - customization should work (shard 1, 1 retry)
  • Features/TagsSuggestion.spec.ts β€Ί should edit and accept suggested tags for an api endpoint response schema field (shard 1, 1 retry)
  • Flow/Metric.spec.ts β€Ί Verify Unit of Measurement Update (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts β€Ί the browse tree only shows the asset-type categories a user can access (shard 1, 1 retry)
  • Features/DomainIsolation/DomainLineageIsolation.spec.ts β€Ί userA sees tableA but not the cross-tenant tableB node (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts β€Ί Glossary (shard 2, 1 retry)
  • Features/BulkImport.spec.ts β€Ί Database service (shard 2, 2 retries)
  • Features/BulkImport.spec.ts β€Ί Database Schema (shard 2, 1 retry)
  • Features/BulkImport.spec.ts β€Ί Keyboard Delete selection (shard 2, 1 retry)
  • Features/BulkImportWithDotInName.spec.ts β€Ί Import at database level with dot in service name (shard 2, 1 retry)
  • Features/Container.spec.ts β€Ί expand / collapse should not appear after updating nested fields for container (shard 2, 1 retry)
  • Features/Container.spec.ts β€Ί Copy column link button should copy the column URL to clipboard (shard 2, 1 retry)
  • Features/DataQuality/Profiler.spec.ts β€Ί Update profiler setting modal (shard 2, 1 retry)
  • Features/DataQuality/TestCaseImportExportE2eFlow.spec.ts β€Ί Admin: Complete export-import-validate flow (shard 2, 2 retries)
  • Features/ExploreQuickFilters.spec.ts β€Ί explore tree sidebar selection is not cleared when a top dropdown filter is applied (shard 2, 1 retry)
  • Features/GlobalSearchSuggestions.spec.ts β€Ί Navigate to column from column suggestion (shard 2, 2 retries)
  • Features/Glossary/GlossaryHierarchy.spec.ts β€Ί should cancel move operation (shard 2, 1 retry)
  • Features/Permissions/EntityPermissions.spec.ts β€Ί Dashboard allow entity-specific permission operations (shard 3, 1 retry)
  • Features/SearchExport.spec.ts β€Ί Export queues a background job and downloads from the jobs tray (shard 3, 1 retry)
  • Features/Table.spec.ts β€Ί Table pagination with sorting should works (shard 3, 1 retry)
  • Features/TestSuiteMultiPipeline.spec.ts β€Ί TestSuite multi pipeline support (shard 3, 1 retry)
  • Pages/CustomProperties.spec.ts β€Ί Time (shard 4, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts β€Ί Validate DataProduct Rule Any_In (shard 4, 1 retry)
  • Pages/Entity.spec.ts β€Ί Delete File (shard 5, 1 retry)
  • Pages/Entity.spec.ts β€Ί User as Owner Add, Update and Remove (shard 5, 1 retry)
  • Pages/Entity.spec.ts β€Ί Filter columns by tag prunes non-matching rows (shard 5, 1 retry)
  • Pages/Entity.spec.ts β€Ί Update displayName (shard 5, 1 retry)
  • Pages/Entity.spec.ts β€Ί Follow & Un-follow entity (shard 5, 1 retry)
  • Pages/Entity.spec.ts β€Ί Domain Propagation (shard 5, 1 retry)
  • Pages/Entity.spec.ts β€Ί User as Owner Add, Update and Remove (shard 5, 1 retry)
  • ... and 24 more

πŸ“¦ Download artifacts

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

github-actions[bot] avatar Jun 19 '26 20:06 github-actions[bot]

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 62%
63.03% (70293/111522) 45.91% (40664/88565) 47.29% (12523/26478)

github-actions[bot] avatar Jun 20 '26 08:06 github-actions[bot]

Code Review βœ… Approved 9 resolved / 9 findings

Improves Knowledge Center UI consistency and state management by implementing debounced save tracking and input sync guards. All previous findings regarding count labels, HTML structure, and state drift have been resolved.

βœ… 9 resolved
βœ… Quality: Tag key changed from tagFQN to non-unique tag.name

πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/ContextCenter/MemoriesView/MemoriesView.component.tsx:249 The badge key was changed from String(tag.tagFQN ?? '') to tag.name. tag.name is less unique than the fully-qualified tagFQN (two tags in different classifications can share the same name), risking duplicate React keys and reconciliation glitches. tag.name can also be undefined for some tag shapes. Prefer keeping tagFQN as the key.

βœ… Bug: Total count counts all pages, mislabeled as articles

πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx:239-246 πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx:722 fetchKnowledgePagesTotalCount calls getListKnowledgePages({ limit: 0 }) without a pageType filter. Per knowledgeCenterAPI.ts, getListKnowledgePages hits /contextCenter/pages and returns ALL knowledge pages (articles + quick links), whereas the hierarchy itself is fetched via getPageHierarchyFromES, which defaults to pageType: PageType.ARTICLE. The rendered label uses this count next to t('label.article-plural') ({knowledgePagesTotalCount} {t('label.article-plural')}).

Previously the displayed value came from paginationState.paging.total, which was derived from the ARTICLE-filtered hierarchy fetch. After this change the displayed article count will be inflated by quick-link pages (and any other page types), so the number shown to users no longer matches the article list. KnowledgePageListParams already supports a pageType field, so the fix is to pass pageType: PageType.ARTICLE to scope the count to articles.

βœ… Quality: Duplicated Tailwind prefix: tw:tw:text-quaternary

πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx:581 πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx:588 The QuickLinkIcon and File06 icons use className="tw:shrink-0 tw:tw:text-quaternary" with a duplicated tw: prefix. tw:tw:text-quaternary is not a valid class, so the intended quaternary text color will not be applied and the icon falls back to the inherited color. Fix the typo to tw:text-quaternary.

βœ… Edge Case: Expand/collapse toggle state can drift from actual tree state

πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx:236 πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx:774-788 πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx:699-708 The expand/collapse button in KnowledgePagesHierarchy now derives its icon/action solely from isUserExpandedAll (set to true in handleExpandAll, line 236, and false when the collapse button is clicked, line 782). However, expandedKeys is mutated independently of this flag:

  • The activeKey effect (lines 699-707) appends keys to expandedKeys when navigating, so nodes can be expanded while isUserExpandedAll is still false β€” the button keeps showing "Expand all" even though part of the tree is already expanded.
  • After clicking "Expand all", if the user manually collapses individual nodes via the Tree, isUserExpandedAll stays true, so the button still reads "Collapse all" and a single click wipes all expansion (setExpandedKeys([])).

This is a cosmetic/UX inconsistency rather than a functional break. Consider deriving the toggle state from whether expandedKeys actually covers all expandable nodes (or clearing isUserExpandedAll when the user collapses a node) so the button label always matches the visible tree.

βœ… Bug: Nested

πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx:637-644 πŸ“„ openmetadata-ui/src/main/resources/ui/src/components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx:613-627 This commit replaced the quick-link div role="button" wrapper with a real <button> element (lines 637-644). That <button> still renders {deleteButton} as a child, and deleteButton is a ButtonUtility, which renders a native <button> (confirmed via react-aria-components). Nesting a <button> inside a <button> is invalid HTML: React emits a hydration/DOM-nesting warning, and browsers auto-correct by closing the outer button early, which can break the flex layout (justify-between) and the delete button's positioning, and lead to inconsistent click handling. The previous div role="button" did not have this problem because a div is not an interactive button element.

Fix: keep the outer element non-button (e.g., a div/span with role="button", tabIndex={0}, and keyboard handler as before) so the inner delete <button> remains valid, or move the delete button outside the clickable button wrapper. If accessibility via a native button is desired, the delete action should not be a descendant of the outer button.

...and 4 more resolved from earlier reviews

Options

Display: compact β†’ Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with πŸ‘ / πŸ‘Ž | Gitar

gitar-bot avatar Jun 27 '26 15:06 gitar-bot