diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Users/Users.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Users/Users.component.tsx index 7ef4b1b0974..bd559a4826c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Users/Users.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Users/Users.component.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { EntityType } from '../../enums/entity.enum'; +import { AssetsType } from '../../enums/entity.enum'; import { EntityReference, User } from '../../generated/entity/teams/user'; import UserCard from '../../pages/teams/UserCard'; import SVGIcons, { Icons } from '../../utils/SvgUtils'; @@ -43,10 +43,10 @@ const Users = ({ userData }: Props) => { }, ]; - const getEntityDetails = (data: EntityReference[]) => { - const includedEntity = Object.values(EntityType); + const getAssets = (data: EntityReference[]) => { + const includedEntity = Object.values(AssetsType); - return data.filter((d) => includedEntity.includes(d.type as EntityType)); + return data.filter((d) => includedEntity.includes(d.type as AssetsType)); }; const fetchLeftPanel = () => { @@ -142,14 +142,14 @@ const Users = ({ userData }: Props) => {
{activeTab === 1 && getEntityData( - getEntityDetails(userData?.owns || []), + getAssets(userData?.owns || []), `${ userData?.displayName || userData?.name || 'User' } does not own anything yet` )} {activeTab === 2 && getEntityData( - getEntityDetails(userData?.follows || []), + getAssets(userData?.follows || []), `${ userData?.displayName || userData?.name || 'User' } does not follow anything yet` diff --git a/openmetadata-ui/src/main/resources/ui/src/enums/entity.enum.ts b/openmetadata-ui/src/main/resources/ui/src/enums/entity.enum.ts index 4f9527c90bc..43ec270a06b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/enums/entity.enum.ts +++ b/openmetadata-ui/src/main/resources/ui/src/enums/entity.enum.ts @@ -27,6 +27,13 @@ export enum EntityType { WEBHOOK = 'webhook', } +export enum AssetsType { + TABLE = 'table', + TOPIC = 'topic', + DASHBOARD = 'dashboard', + PIPELINE = 'pipeline', +} + export enum ChangeType { ADDED = 'Added', UPDATED = 'Updated', diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/teams/UserCard.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/teams/UserCard.tsx index 38116e21061..ca13b4bb5ed 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/teams/UserCard.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/teams/UserCard.tsx @@ -18,6 +18,7 @@ import { Link } from 'react-router-dom'; import { useAuthContext } from '../../auth-provider/AuthProvider'; import Avatar from '../../components/common/avatar/Avatar'; import NonAdminAction from '../../components/common/non-admin-action/NonAdminAction'; +import { AssetsType } from '../../enums/entity.enum'; import { SearchIndex } from '../../enums/search.enum'; import { Operation } from '../../generated/entity/policies/accessControl/rule'; import { useAuth } from '../../hooks/authHooks'; @@ -35,13 +36,6 @@ type Props = { onRemove?: (value: string) => void; }; -enum DatasetType { - TABLE = 'table', - TOPIC = 'topic', - DASHBOARD = 'dashboard', - PIPELINE = 'pipeline', -} - const UserCard = ({ item, isActionVisible = false, @@ -57,10 +51,10 @@ const UserCard = ({ type: string ): Array<'service' | 'database' | 'table' | 'column'> => { switch (type) { - case DatasetType.TABLE: + case AssetsType.TABLE: return ['database', 'table']; - case DatasetType.TOPIC: - case DatasetType.DASHBOARD: + case AssetsType.TOPIC: + case AssetsType.DASHBOARD: default: return ['service', 'database', 'table']; } @@ -69,19 +63,19 @@ const UserCard = ({ const getDatasetIcon = (type: string) => { let icon = ''; switch (type) { - case DatasetType.TOPIC: + case AssetsType.TOPIC: icon = Icons.TOPIC; break; - case DatasetType.DASHBOARD: + case AssetsType.DASHBOARD: icon = Icons.DASHBOARD; break; - case DatasetType.PIPELINE: + case AssetsType.PIPELINE: icon = Icons.PIPELINE; break; - case DatasetType.TABLE: + case AssetsType.TABLE: default: icon = Icons.TABLE; @@ -92,7 +86,7 @@ const UserCard = ({ @@ -102,15 +96,19 @@ const UserCard = ({ const getDatasetTitle = (type: string, fqn: string) => { let link = ''; switch (type) { - case DatasetType.TOPIC: + case AssetsType.TOPIC: link = getEntityLink(SearchIndex.TOPIC, fqn); break; - case DatasetType.DASHBOARD: + case AssetsType.PIPELINE: + link = getEntityLink(SearchIndex.PIPELINE, fqn); + + break; + case AssetsType.DASHBOARD: link = getEntityLink(SearchIndex.DASHBOARD, fqn); break; - case DatasetType.TABLE: + case AssetsType.TABLE: default: link = getEntityLink(SearchIndex.TABLE, fqn);