Skip to content

ATLAS-5373: Atlas React UI: Extremely long entity names break layout in Latest Entities Created widget - #728

Open
Brijesh619 wants to merge 4 commits into
apache:masterfrom
Brijesh619:ATLAS-5373
Open

ATLAS-5373: Atlas React UI: Extremely long entity names break layout in Latest Entities Created widget#728
Brijesh619 wants to merge 4 commits into
apache:masterfrom
Brijesh619:ATLAS-5373

Conversation

@Brijesh619

@Brijesh619 Brijesh619 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

ATLAS-5373: Atlas React UI: Refactor and stabilize layout in Latest Entities Created widget

This PR fixes styling, layout, and type-safety bugs in the "Latest Entities Created" widget and its underlying shared components. It migrates away from inline sx objects to strict, maintainable SCSS classes, and drastically improves the performance and strictness of shared UI components.

  • Strict SCSS Migration: Removed inline sx styles across the LatestEntitiesList component and migrated them to LatestEntitiesList.scss, ensuring strict separation of concerns and eliminating React render overhead for styles.
  • Intelligent Truncation: Implemented the OverflowTooltip component to elegantly handle long entity and type names. The flex layout was hardened so that the entity name shrinks responsively while keeping the type name visible, with tooltips automatically appearing on hover if truncation occurs.
  • Tooltip Enhancements: Upgraded the underlying OverflowTooltip component in muiComponents.tsx to use ResizeObserver (combined with an onMouseEnter fallback) for accurate, highly-performant DOM boundary detection that successfully handles subpixel truncation quirks.
  • Global Type-Safety Refactor: Completely refactored CustomButton to rigorously enforce native @mui/material/ButtonProps, eliminating legacy any escape hatches. Proactively cleaned up invalid props and event handlers across 6 downstream consumers (like Modal, AdvancedSearch, and ShowMoreDrawer) to guarantee 100% type safety.
  • UX Consistency: Restored the "Created " prefix on relative timestamps to maintain UX expectations.

How was this patch tested?

  • Manual UI Testing: Verified in the dashboard that extremely long entity names cleanly truncate with an ellipsis ..., the type name remains appropriately visible, and the tooltip appears precisely when fractional overflow occurs.
  • Unit Tests:
    • Updated over 10 assertions in LatestEntitiesList.test.tsx to validate the restored "Created " string prefix and fallback rendering.
    • All tests run successfully via npm run test.
  • TypeScript Validation: Passed rigorous strict type checking (npm run typecheck) across the entire dashboard with zero errors.

@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-17 12-11-36 Screenshot from 2026-08-17 12-08-37 Screenshot from 2026-08-17 12-08-25

Comment thread dashboard/src/views/DashboardOverview/LatestEntitiesList.tsx Outdated
Comment thread dashboard/src/components/muiComponents.tsx Outdated
Comment thread dashboard/src/components/muiComponents.tsx Outdated
Comment thread dashboard/src/components/muiComponents.tsx Outdated
Comment thread dashboard/src/components/__tests__/muiComponents.test.tsx
Comment thread dashboard/src/views/DashboardOverview/LatestEntitiesList.scss Outdated
Comment thread dashboard/src/views/DashboardOverview/LatestEntitiesList.tsx Outdated
Comment thread dashboard/src/components/muiComponents.tsx Outdated
Comment thread dashboard/src/components/muiComponents.tsx Outdated
@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-21 14-50-14

Comment thread dashboard/src/views/DashboardOverview/LatestEntitiesList.tsx Outdated
Comment thread dashboard/src/views/DashboardOverview/LatestEntitiesList.scss
Comment thread dashboard/src/views/DashboardOverview/LatestEntitiesList.tsx Outdated
@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-24 15-22-47

@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-24 15-24-49

import { TooltipProps } from "@mui/material/Tooltip";
import { SxProps, Theme } from "@mui/material/styles";

const LightTooltip = styled(({ className, ...props }: any) => (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LightTooltip still typed as any (pre-existing pattern, but PR claims type-safety refactor)
PR description mentions type-safety refactor, but LightTooltip still uses any. Consider typing it as TooltipProps for consistency.

})

describe('OverflowTooltip', () => {
let triggerResize: any

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

triggerResize: any — prefer typed mock


.latest-entities-name-wrapper {
display: block;
flex: 0 10 auto;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flex: 0 10 auto is non-standard (flex-shrink: 10). Works but is magic-number-ish; flex: 1 1 auto; min-width: 0 or a short comment would help

}
}, []);

React.useEffect(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One ResizeObserver per list row (up to 7) — acceptable for this widget, but worth noting if reused widely

expect(
within(row as HTMLElement).getByText(/^Created /),
).toBeInTheDocument()
expect(within(row).getByText(/ago/)).toBeInTheDocument()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since "Created " prefix was restored in formatCreatedRelativeFromMs, please revert weakened assertions back to /^Created / (lines 190, 331, 537, 603) for stronger regression protection.

</MemoryRouter>,
)
expect(screen.getByText('(Entity)')).toBeInTheDocument()
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for extremely long typeName (e.g. 'B'.repeat(300)) asserting:

Row renders without layout break
Type wrapper has truncation styles
Optional: tooltip appears on hover when overflowed

color: rgba(0, 0, 0, 0.87);
}

.latest-entities-type-name {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.latest-entities-type-name is missing truncation styles (overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0) that were marked resolved in review. Truncation currently relies only on OverflowTooltip inline sx. Either add SCSS here for consistency, or document/update pr description that truncation is intentionally delegated to the wrapper.

return formatCreatedRelativeFromMs(ms);
};


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra blank line(s) between formatRelativeTime and the component definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants