diff --git a/catalog-rest-service/src/main/resources/ui/src/pages/teams/UserCard.tsx b/catalog-rest-service/src/main/resources/ui/src/pages/teams/UserCard.tsx index 2405938e697..547f87341c3 100644 --- a/catalog-rest-service/src/main/resources/ui/src/pages/teams/UserCard.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/pages/teams/UserCard.tsx @@ -1,9 +1,12 @@ +import classNames from 'classnames'; import { capitalize } from 'lodash'; import React from 'react'; import { Link } from 'react-router-dom'; import Avatar from '../../components/common/avatar/Avatar'; +import { SearchIndex } from '../../enums/search.enum'; import { getPartialNameFromFQN } from '../../utils/CommonUtils'; -import SVGIcons from '../../utils/SvgUtils'; +import SVGIcons, { Icons } from '../../utils/SvgUtils'; +import { getEntityLink } from '../../utils/TableUtils'; type Props = { item: { description: string; name: string; id?: string }; @@ -15,6 +18,12 @@ type Props = { onRemove?: (value: string) => void; }; +enum DatasetType { + TABLE = 'table', + TOPIC = 'topic', + DASHBOARD = 'dashboard', +} + const UserCard = ({ item, isActionVisible = false, @@ -24,18 +33,90 @@ const UserCard = ({ onSelect, onRemove, }: Props) => { + const getArrForPartialName = ( + type: string + ): Array<'service' | 'database' | 'table' | 'column'> => { + switch (type) { + case DatasetType.TABLE: + return ['database', 'table']; + case DatasetType.TOPIC: + case DatasetType.DASHBOARD: + default: + return ['service', 'database', 'table']; + } + }; + + const getDatasetIcon = (type: string) => { + let icon = ''; + switch (type) { + case DatasetType.TOPIC: + icon = Icons.TOPIC; + + break; + case DatasetType.DASHBOARD: + icon = Icons.DASHBOARD; + + break; + case DatasetType.TABLE: + default: + icon = Icons.TABLE; + + break; + } + + return ( + + ); + }; + + const getDatasetTitle = (type: string, fqn: string) => { + let link = ''; + switch (type) { + case DatasetType.TOPIC: + link = getEntityLink(SearchIndex.TOPIC, fqn); + + break; + case DatasetType.DASHBOARD: + link = getEntityLink(SearchIndex.DASHBOARD, fqn); + + break; + case DatasetType.TABLE: + default: + link = getEntityLink(SearchIndex.TABLE, fqn); + + break; + } + + return ( + + + + ); + }; + return (
- {isIconVisible ? : null} + {isIconVisible && !isDataset ? ( + + ) : ( + <>{getDatasetIcon(item.name)} + )} -
+
{isDataset ? ( - - - + <>{getDatasetTitle(item.name, item.description)} ) : (

{item.description}

)} diff --git a/catalog-rest-service/src/main/resources/ui/src/pages/teams/index.tsx b/catalog-rest-service/src/main/resources/ui/src/pages/teams/index.tsx index 2594ef4eb17..175649750cd 100644 --- a/catalog-rest-service/src/main/resources/ui/src/pages/teams/index.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/pages/teams/index.tsx @@ -240,7 +240,9 @@ const TeamsPage = () => { {currentTeam?.owns.map((dataset, index) => { const Dataset = { description: dataset.name, name: dataset.type }; - return ; + return ( + + ); })}