Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lineage): Fix lineage entity drawer height UI bug #4707

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions datahub-web-react/src/app/lineage/LineageExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { EntityType } from '../../types.generated';
import { capitalizeFirstLetter } from '../shared/textUtil';
import { ANTD_GRAY } from '../entity/shared/constants';

const DEFAULT_DISTANCE_FROM_TOP = 106;

const LoadingMessage = styled(Message)`
margin-top: 10%;
`;
Expand All @@ -26,10 +28,10 @@ const FooterButtonGroup = styled.div`
margin: 12px 0;
`;

const EntityDrawer = styled(Drawer)`
top: 106px;
const EntityDrawer = styled(Drawer)<{ distanceFromTop: number }>`
top: ${(props) => props.distanceFromTop}px;
jjoyce0510 marked this conversation as resolved.
Show resolved Hide resolved
z-index: 1;
height: calc(100vh - 106px);
height: calc(100vh - ${(props) => props.distanceFromTop}px);
.ant-drawer-content-wrapper {
border-right: 1px solid ${ANTD_GRAY[4.5]};
box-shadow: none !important;
Expand Down Expand Up @@ -62,6 +64,8 @@ export default function LineageExplorer({ urn, type }: Props) {
const [selectedEntity, setSelectedEntity] = useState<EntitySelectParams | undefined>(undefined);
const [asyncEntities, setAsyncEntities] = useState<FetchedEntities>({});

const drawerRef: React.MutableRefObject<HTMLDivElement | null> = useRef(null);

const maybeAddAsyncLoadedEntity = useCallback(
(entityAndType: EntityAndType) => {
if (entityAndType?.entity.urn && !asyncEntities[entityAndType?.entity.urn]?.fullyFetched) {
Expand Down Expand Up @@ -99,6 +103,9 @@ export default function LineageExplorer({ urn, type }: Props) {
return <Alert type="error" message={error?.message || 'Entity failed to load'} />;
}

const drawerDistanceFromTop =
drawerRef && drawerRef.current ? drawerRef.current.offsetTop : DEFAULT_DISTANCE_FROM_TOP;

return (
<>
{loading && <LoadingMessage type="loading" content="Loading..." />}
Expand All @@ -123,7 +130,9 @@ export default function LineageExplorer({ urn, type }: Props) {
/>
</div>
)}
<div ref={drawerRef} />
<EntityDrawer
distanceFromTop={drawerDistanceFromTop}
placement="left"
closable={false}
onClose={handleClose}
Expand Down