OpenMetadata/openmetadata-ui
satish a37efedfa4
refactor: Domain and Data Product UI improvements and architecture enhancements (#23804)
* refactor: Domain and Data Product UI improvements and architecture enhancements

## Major Changes

### Architecture Improvements
- **Refactored AssetSelectionModal**: Split monolithic component into composable hooks
  - Extracted `useAssetSelectionContent` hook (806 lines) for shared selection logic
  - Created `AssetSelectionDrawer` component for drawer variant
  - Reduced main modal component from 700+ to 18 lines
  - Enables reuse across modal and drawer UI patterns

- **Domain component reorganization**:
  - Renamed `DomainDetailsPage` → `DomainDetails` for consistency
  - Deleted legacy `DomainPage.component.tsx` (336 lines)
  - Centralized domain page styles in `DomainPageStyles.ts`

### UI/UX Enhancements
- **Breadcrumbs**: Changed to plural labels across all pages
  - "Domain" → "Domains" in listings and detail pages
  - "Data Product" → "Data Products" in listings and detail pages
  - Updated sidebar navigation labels to match

- **Scroll behavior fixes**:
  - Removed fixed height constraints causing nested scrolls in right panels
  - Changed from `height: @domain-page-height` to `min-height: 70vh`
  - Applied to both Domain (domain.less) and Data Product (data-products-details-page.less) detail pages
  - Now uses single body scroll for better UX

- **Visual improvements**:
  - Added white text color to MUI tooltips for better contrast on black background
  - Enhanced GenericProvider with `muiTags` prop support
  - Added new `CoverImage` component for domain/data product headers
  - Improved `useBreadcrumbs` hook with 187 lines of enhancements

### Bug Fixes
- **TypeScript errors in NotistackUtils.tsx**:
  - Fixed implicit 'any' type for `snackbarId` parameters (4 instances)
  - Added type assertion for i18n.t() return value
  - All type errors resolved

### Component Improvements
- Enhanced TagsViewer with MUI tooltip support
- Updated TagChip component for better tag display
- Improved EntityAvatar component
- Refined drawer hooks with better type safety

* feat: Add cover image upload with reposition functionality for domains

- Add MUICoverImageUpload component with drag-and-drop support
- Implement vertical reposition functionality for cover images
- Integrate cover image field in AddDomainForm
- Update CoverImage component to support position object format
- Add COVER_IMAGE_UPLOAD_MUI field type to form utils
- Support empty entityLink for uploads during domain creation
- Add translations for cover image upload UI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: Add cover image display with authenticated loading and test IDs

- Update DomainDetails and DataProductsDetailsPage to pass cover image URL and position to CoverImage component
- Implement authenticated image loading with proper loading states in CoverImage component
- Add gray background during authenticated image loading to prevent 401 error flash
- Implement conditional rendering in MUICoverImageUpload to show loading spinner for authenticated images
- Add comprehensive data-testid attributes for both components to improve testability
- Use theme colors for loading backgrounds instead of hardcoded values

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: Implement generic cover image upload flow and remove dead code

- Create reusable createEntityWithCoverImage utility function
- Refactor domain, subdomain, and data product creation to use generic function
- Fix cover image preview and reposition functionality for client-side handling
- Remove unused AddDomain component and /domain/add route
- Remove dead DomainLeftPanel component
- Reduce code duplication by 77% (344 lines → 79 lines)
- Add proper TypeScript types and ESLint compliance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: Update coverImage structure to match new backend API

- Update CoverImageUploadUtils to send coverImage as nested object
- Change from flat structure (coverImage: url, coverImagePosition: number)
- Change to nested structure (coverImage: { url: string, position: string })
- Update DomainDetails to read from nested coverImage object
- Update DataProductsDetailsPage to read from nested coverImage object
- Convert position between CSS string format ("20px") and pixel number (20)
- Fix DomainRouter test by removing deleted AddDomain component references
- Add type assertions for compatibility until backend types are regenerated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: Use percentage-based positioning for cover images

Fix cover image display inconsistency between upload field (622x103px)
and detail page (auto x 131px) by using CSS percentage values for
translateY instead of absolute pixels. This ensures the same visual
result regardless of container width.

- Store position as percentage string (e.g., "-16%") instead of pixels
- Convert between pixels (for dragging UX) and percentage (for storage)
- Update CoverImagePosition interface to use string type
- Simplify detail page rendering by removing parseInt conversions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix ts error

* refactor: Extract generic file upload component from cover image upload

- Create MUIFileUpload component with drag-and-drop, validation, and preview support
- Refactor MUICoverImageUpload to use MUIFileUpload (33% code reduction)
- Add 20 i18n keys across all 18 languages for file upload features
- Fix TypeScript types and ESLint formatting issues
- Fix upload zone height to match preview at 103px

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Revert entity-transfer-message change

* Update checkDefaultStateForNavigationTree for 2 domains tree and tree item

* Fix navigation page test

---------

Co-authored-by: Satish <satish@Satishs-MacBook-Pro.local>
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-15 19:22:50 +05:30
..
2025-09-01 15:15:36 +05:30