From 6e455e51ace0467cef78d70857eea75655ad2e86 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Fri, 29 Jul 2022 18:30:05 +0530 Subject: [PATCH] Fix #6410 UI: Homepage looks distorted on windows machine (#6435) --- .../ActivityFeedCard/ActivityFeedCard.tsx | 1 + .../FeedCardHeader/FeedCardHeader.tsx | 115 +++++++----------- .../common/PopOverCard/EntityPopOverCard.tsx | 26 ++-- .../common/PopOverCard/UserPopOverCard.tsx | 14 ++- 4 files changed, 74 insertions(+), 82 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedCard/ActivityFeedCard.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedCard/ActivityFeedCard.tsx index 52ebe28d1fa..53be2025d69 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedCard/ActivityFeedCard.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedCard/ActivityFeedCard.tsx @@ -159,6 +159,7 @@ const ActivityFeedCard: FC = ({
= ({ const getFeedLinkElement = () => { if (!isUndefined(entityFQN) && !isUndefined(entityType)) { return ( - - - {getFeedAction(feedType)}{' '} - {isEntityFeed ? ( - - {getEntityFieldDisplay(entityField)} - - ) : ( - - {entityType} + + posted on + {isEntityFeed ? ( + + {getEntityFieldDisplay(entityField)} + + ) : ( + <> + {entityType} + - + {entityDisplayName(entityType, entityFQN)} - - )} - - + + + )} + ); } else { return null; @@ -87,45 +77,35 @@ const FeedCardHeader: FC = ({ const getTaskLinkElement = () => { if (!isUndefined(entityFQN) && !isUndefined(entityType)) { return ( -
- created a task + + created a task - + + {`#${taskDetails?.id} `} + {taskDetails?.type} + - for + for {isEntityFeed ? ( {getEntityFieldDisplay(entityField)} ) : ( - + <> {entityType} - - + {entityDisplayName(entityType, entityFQN)} - + )} -
+ ); } else { return null; @@ -133,28 +113,25 @@ const FeedCardHeader: FC = ({ }; return ( -
-
- - { - e.stopPropagation(); - onTitleClickHandler(createdBy); - }}> - {createdBy} - - - - {feedType === ThreadType.Conversation - ? getFeedLinkElement() - : getTaskLinkElement()} +
+ - {timeStamp && ' - ' + getDayTimeByTimeStamp(timeStamp)} + className="thread-author tw-cursor-pointer" + onClick={(e) => { + e.stopPropagation(); + onTitleClickHandler(createdBy); + }}> + {createdBy} -
+ + + {feedType === ThreadType.Conversation + ? getFeedLinkElement() + : getTaskLinkElement()} + + + {timeStamp && ' - ' + getDayTimeByTimeStamp(timeStamp)} +
); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/PopOverCard/EntityPopOverCard.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/PopOverCard/EntityPopOverCard.tsx index 809a63df434..8a5515c0339 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/PopOverCard/EntityPopOverCard.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/PopOverCard/EntityPopOverCard.tsx @@ -15,7 +15,7 @@ import { Popover } from 'antd'; import { AxiosError, AxiosResponse } from 'axios'; import { uniqueId } from 'lodash'; import { EntityTags } from 'Models'; -import React, { FC, HTMLAttributes, useMemo, useState } from 'react'; +import React, { FC, HTMLAttributes, useEffect, useMemo, useState } from 'react'; import { Link } from 'react-router-dom'; import AppState from '../../../AppState'; import { getDashboardByFqn } from '../../../axiosAPIs/dashboardAPI'; @@ -171,7 +171,20 @@ const EntityPopOverCard: FC = ({ children, entityType, entityFQN }) => { ); }; + const onMouseOver = () => { + const entitydetails = AppState.entityData[entityFQN]; + if (entitydetails) { + setEntityData(entitydetails); + } else { + getData(); + } + }; + const PopoverContent = () => { + useEffect(() => { + onMouseOver(); + }, []); + return (
@@ -237,15 +250,6 @@ const EntityPopOverCard: FC = ({ children, entityType, entityFQN }) => { ); }; - const onMouseOver = () => { - const entitydetails = AppState.entityData[entityFQN]; - if (entitydetails) { - setEntityData(entitydetails); - } else { - getData(); - } - }; - return ( = ({ children, entityType, entityFQN }) => { title={} trigger="hover" zIndex={9999}> -
{children}
+ {children}
); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/PopOverCard/UserPopOverCard.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/PopOverCard/UserPopOverCard.tsx index 7e403e893f9..3377a977784 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/PopOverCard/UserPopOverCard.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/PopOverCard/UserPopOverCard.tsx @@ -14,7 +14,13 @@ import { Popover } from 'antd'; import { AxiosResponse } from 'axios'; import { isEmpty } from 'lodash'; -import React, { FC, Fragment, HTMLAttributes, useState } from 'react'; +import React, { + FC, + Fragment, + HTMLAttributes, + useEffect, + useState, +} from 'react'; import { useHistory } from 'react-router-dom'; import AppState from '../../../AppState'; import { getUserByName } from '../../../axiosAPIs/userAPI'; @@ -135,6 +141,10 @@ const UserPopOverCard: FC = ({ children, userName, type = 'user' }) => { }; const PopoverContent = () => { + useEffect(() => { + getData(); + }, []); + return ( {isLoading ? ( @@ -164,7 +174,7 @@ const UserPopOverCard: FC = ({ children, userName, type = 'user' }) => { title={} trigger="hover" zIndex={9999}> -
{children}
+ {children} ); };