diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Entity/Task/TaskTab/TaskTabNew.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Entity/Task/TaskTab/TaskTabNew.component.tsx index bfc2efcfe55..d4c32b313fa 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Entity/Task/TaskTab/TaskTabNew.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Entity/Task/TaskTab/TaskTabNew.component.tsx @@ -47,7 +47,7 @@ import React, { useState, } from 'react'; import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; +import { Link, useHistory } from 'react-router-dom'; import { ReactComponent as EditIcon } from '../../../../assets/svg/edit-new.svg'; import { ReactComponent as AssigneesIcon } from '../../../../assets/svg/ic-assignees.svg'; import { ReactComponent as TaskCloseIcon } from '../../../../assets/svg/ic-close-task.svg'; @@ -124,6 +124,7 @@ import { getEntityName, getEntityReferenceListFromEntities, } from '../../../../utils/EntityUtils'; +import { getUserPath } from '../../../../utils/RouterUtils'; import { UserAvatarGroup } from '../../../common/OwnerLabel/UserAvatarGroup.component'; import EntityPopOverCard from '../../../common/PopOverCard/EntityPopOverCard'; import UserPopOverCard from '../../../common/PopOverCard/UserPopOverCard'; @@ -875,13 +876,21 @@ export const TaskTabNew = ({ {t('label.created-by')} - - -
- -
-
- {taskThread.createdBy} + + + +
+ +
+
+ + {taskThread.createdBy} + {isEditAssignee ? ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/OwnerItem/OwnerItem.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/OwnerItem/OwnerItem.tsx index e5d17008d39..2051fbf0c10 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/OwnerItem/OwnerItem.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/OwnerItem/OwnerItem.tsx @@ -57,7 +57,10 @@ export const OwnerItem: React.FC = ({ }}> {!isCompactView ? ( - + ({ key: owner.id, label: ( -
+
+ {owner.displayName} -
+ ), })), }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/ProfilePicture/ProfilePictureNew.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/ProfilePicture/ProfilePictureNew.tsx new file mode 100644 index 00000000000..ed587f6e31d --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/ProfilePicture/ProfilePictureNew.tsx @@ -0,0 +1,142 @@ +/* + * Copyright 2022 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Avatar, Tooltip } from 'antd'; +import classNames from 'classnames'; +import { parseInt } from 'lodash'; +import { ImageShape } from 'Models'; +import React, { useMemo } from 'react'; +import { Link } from 'react-router-dom'; +import { usePermissionProvider } from '../../../context/PermissionProvider/PermissionProvider'; +import { ResourceEntity } from '../../../context/PermissionProvider/PermissionProvider.interface'; +import { User } from '../../../generated/entity/teams/user'; +import { useUserProfile } from '../../../hooks/user-profile/useUserProfile'; +import { getRandomColor } from '../../../utils/CommonUtils'; +import { userPermissions } from '../../../utils/PermissionsUtils'; +import { getUserPath } from '../../../utils/RouterUtils'; +import Loader from '../Loader/Loader'; +import UserPopOverCard from '../PopOverCard/UserPopOverCard'; + +type UserData = Pick; + +interface Props extends UserData { + width?: string; + type?: ImageShape; + className?: string; + height?: string; + isTeam?: boolean; + size?: number | 'small' | 'default' | 'large'; + avatarType?: 'solid' | 'outlined'; +} + +const ProfilePictureNew = ({ + name, + displayName, + className = '', + type = 'circle', + width = '36', + height, + isTeam = false, + size, + avatarType = 'solid', +}: Props) => { + const { permissions } = usePermissionProvider(); + const { color, character, backgroundColor } = getRandomColor( + displayName ?? name + ); + + const viewUserPermission = useMemo(() => { + return userPermissions.hasViewPermissions(ResourceEntity.USER, permissions); + }, [permissions]); + + const [profileURL, isPicLoading] = useUserProfile({ + permission: viewUserPermission, + name, + isTeam, + }); + + const getAvatarByName = () => { + const avatar = ( + + ); + + return ( + + + {avatar} + + + ); + }; + + const getAvatarElement = () => { + return isPicLoading ? ( +
+ {getAvatarByName()} +
+ +
+
+ ) : ( + getAvatarByName() + ); + }; + + return profileURL ? ( + + + + + + ) : ( + getAvatarElement() + ); +}; + +export default ProfilePictureNew; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/RemainingOwner/OwnerReveal.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/RemainingOwner/OwnerReveal.tsx index 91bed3e9bad..4e178f8b842 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/RemainingOwner/OwnerReveal.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/RemainingOwner/OwnerReveal.tsx @@ -10,10 +10,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Button, Dropdown } from 'antd'; +import { Button, Dropdown, Typography } from 'antd'; import React from 'react'; import { useTranslation } from 'react-i18next'; +import { Link } from 'react-router-dom'; import { getEntityName } from '../../../utils/EntityUtils'; +import { getOwnerPath } from '../../../utils/ownerUtils'; import UserPopOverCard from '../PopOverCard/UserPopOverCard'; import ProfilePicture from '../ProfilePicture/ProfilePicture'; import { OwnerRevealProps } from './OwnerReveal.interface'; @@ -60,18 +62,24 @@ export const OwnerReveal: React.FC = ({ key: owner.id, label: ( -
-
- -
- {getEntityName(owner)} -
+ + + + + {getEntityName(owner)}{' '} + +
), })),