Skip to content

Commit

Permalink
Fix lineage entity drawer heigh UI bug (datahub-project#4707)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscollins3456 authored and maggiehays committed Aug 1, 2022
1 parent 0f7d088 commit f1c7a48
Showing 1 changed file with 12 additions and 3 deletions.
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;
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

0 comments on commit f1c7a48

Please sign in to comment.