diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ClassificationDetails/ClassificationDetails.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ClassificationDetails/ClassificationDetails.tsx index 4abc71728f7..2c2448d271f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ClassificationDetails/ClassificationDetails.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ClassificationDetails/ClassificationDetails.tsx @@ -52,6 +52,7 @@ import { getClassificationExtraDropdownContent, getTagsTableColumn, } from '../../utils/ClassificationUtils'; +import { getEntityName } from '../../utils/EntityUtils'; import { getEntityVersionByField, getMutuallyExclusiveDiff, @@ -501,10 +502,7 @@ function ClassificationDetails({ 'opacity-60': isClassificationDisabled, })} description={description} - entityName={ - currentClassification?.displayName ?? - currentClassification?.fullyQualifiedName - } + entityName={getEntityName(currentClassification)} hasEditAccess={editDescriptionPermission} isEdit={isEditClassification} onCancel={handleCancelEditDescription} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ContainerDetail/ContainerDataModel/ContainerDataModel.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ContainerDetail/ContainerDataModel/ContainerDataModel.tsx index cd0d82f8f83..c19cc211610 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ContainerDetail/ContainerDataModel/ContainerDataModel.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ContainerDetail/ContainerDataModel/ContainerDataModel.tsx @@ -253,7 +253,7 @@ const ContainerDataModel: FC = ({ = ({ [mlModelFqn] ); + const mlModelName = useMemo( + () => getEntityName(mlModelDetail), + [mlModelDetail] + ); + const fetchResourcePermission = useCallback(async () => { try { const entityPermission = await getEntityPermission( @@ -124,12 +129,12 @@ const MlModelDetail: FC = ({ ...mlModelDetail, tier: getTierTags(mlModelDetail.tags ?? []), mlModelTags: getTagsWithoutTier(mlModelDetail.tags ?? []), - entityName: getEntityName(mlModelDetail), + entityName: mlModelName, isFollowing: mlModelDetail.followers?.some( ({ id }: { id: string }) => id === currentUser?.id ), }; - }, [mlModelDetail]); + }, [mlModelDetail, mlModelName]); const fetchEntityFeedCount = () => { getFeedCounts(EntityType.MLMODEL, decodedMlModelFqn, setFeedCount); @@ -392,7 +397,7 @@ const MlModelDetail: FC = ({ = ({ feedCount, activeTab, mlModelDetail, + mlModelName, mlModelPermissions, isEdit, getMlHyperParameters, diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MlModelDetail/MlModelFeaturesList.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MlModelDetail/MlModelFeaturesList.tsx index 43a74400962..73c3c27d1b0 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MlModelDetail/MlModelFeaturesList.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MlModelDetail/MlModelFeaturesList.tsx @@ -21,6 +21,7 @@ import TableTags from '../../components/TableTags/TableTags.component'; import { EntityType } from '../../enums/entity.enum'; import { MlFeature } from '../../generated/entity/data/mlmodel'; import { TagSource } from '../../generated/type/schema'; +import { getEntityName } from '../../utils/EntityUtils'; import { createTagObject } from '../../utils/TagsUtils'; import ErrorPlaceHolder from '../common/ErrorWithPlaceholder/ErrorPlaceHolder'; import { ModalWithMarkdownEditor } from '../Modals/ModalWithMarkdownEditor/ModalWithMarkdownEditor'; @@ -228,7 +229,7 @@ const MlModelFeaturesList = ({ descriptionHandler(false)} onDescriptionUpdate={onDescriptionUpdate} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicSchema/TopicSchema.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicSchema/TopicSchema.tsx index e6cb8a1d475..866808ec35f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicSchema/TopicSchema.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/TopicDetails/TopicSchema/TopicSchema.tsx @@ -361,7 +361,7 @@ const TopicSchemaFields: FC = ({ { setSchemaInstanceCount(paging.total); } catch (error) { - showErrorToast(error); + showErrorToast(error as AxiosError); } finally { setIsLoading(false); } @@ -515,7 +515,7 @@ const DatabaseDetails: FunctionComponent = () => { { GlobalSettingOptions.POLICIES ); + const policyName = useMemo(() => getEntityName(policy), [policy]); + const breadcrumb = useMemo( () => [ { @@ -90,11 +92,11 @@ const PoliciesDetailPage = () => { url: policiesPath, }, { - name: getEntityName(policy), + name: policyName, url: '', }, ], - [policy] + [policyName, policiesPath] ); const fetchPolicy = async () => { @@ -329,14 +331,14 @@ const PoliciesDetailPage = () => { className="m-b-0 m-t-xs" data-testid="heading" level={5}> - {getEntityName(policy)} + {policyName} setEditDescription(false)} @@ -486,7 +488,7 @@ const PoliciesDetailPage = () => { open={!isUndefined(selectedEntity.record)} title={`${t('label.remove-entity', { entity: getEntityName(selectedEntity.record), - })} ${t('label.from-lowercase')} ${getEntityName(policy)}`} + })} ${t('label.from-lowercase')} ${policyName}`} onCancel={() => setEntity(undefined)} onOk={async () => { await handleDelete(selectedEntity.record, selectedEntity.attribute); @@ -495,7 +497,7 @@ const PoliciesDetailPage = () => { {t('message.are-you-sure-you-want-to-remove-child-from-parent', { child: getEntityName(selectedEntity.record), - parent: getEntityName(policy), + parent: policyName, })} diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesDetailPage/RolesDetailPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesDetailPage/RolesDetailPage.tsx index a3e6266779f..4ca5214a976 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesDetailPage/RolesDetailPage.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesDetailPage/RolesDetailPage.tsx @@ -68,6 +68,8 @@ const RolesDetailPage = () => { GlobalSettingOptions.ROLES ); + const roleName = useMemo(() => getEntityName(role), [role]); + const breadcrumb = useMemo( () => [ { @@ -75,11 +77,11 @@ const RolesDetailPage = () => { url: rolesPath, }, { - name: getEntityName(role), + name: roleName, url: '', }, ], - [role] + [rolesPath, roleName] ); const fetchRole = async () => { @@ -251,14 +253,14 @@ const RolesDetailPage = () => { className="m-b-0 m-t-xs" data-testid="heading" level={5}> - {getEntityName(role)} + {roleName} setEditDescription(false)} @@ -328,7 +330,7 @@ const RolesDetailPage = () => { open={!isUndefined(selectedEntity.record)} title={`${t('label.remove-entity', { entity: getEntityName(selectedEntity.record), - })} ${t('label.from-lowercase')} ${getEntityName(role)}`} + })} ${t('label.from-lowercase')} ${roleName}`} onCancel={() => setEntity(undefined)} onOk={async () => { await handleDelete(selectedEntity.record, selectedEntity.attribute); @@ -337,7 +339,7 @@ const RolesDetailPage = () => { {t('message.are-you-sure-you-want-to-remove-child-from-parent', { child: getEntityName(selectedEntity.record), - parent: getEntityName(role), + parent: roleName, })} diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.tsx index 517ac036bfa..83a075ce9d5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/SearchIndexDetailsPage/SearchIndexFieldsTable/SearchIndexFieldsTable.tsx @@ -273,7 +273,7 @@ const SearchIndexFieldsTable = ({ { setLoading(false); } }, - [getEntityPermissionByFqn, setTablePermissions] + [tableFqn, getEntityPermissionByFqn, setTablePermissions] ); useEffect(() => { @@ -560,6 +560,7 @@ const TableDetailsPageV1 = () => { [ isEdit, tableDetails, + entityName, onDescriptionEdit, onDescriptionUpdate, editTagsPermission, @@ -808,11 +809,11 @@ const TableDetailsPageV1 = () => { showErrorToast( error as AxiosError, t('server.entity-follow-error', { - entity: getEntityName(tableDetails), + entity: entityName, }) ); } - }, [USERId, tableId, setTableDetails, getEntityFeedCount]); + }, [USERId, tableId, entityName, setTableDetails, getEntityFeedCount]); const unFollowTable = useCallback(async () => { try { @@ -835,11 +836,11 @@ const TableDetailsPageV1 = () => { showErrorToast( error as AxiosError, t('server.entity-unfollow-error', { - entity: getEntityName(tableDetails), + entity: entityName, }) ); } - }, [USERId, tableId, getEntityFeedCount, setTableDetails]); + }, [USERId, tableId, entityName, getEntityFeedCount, setTableDetails]); const { isFollowing } = useMemo(() => { return { @@ -854,7 +855,7 @@ const TableDetailsPageV1 = () => { const versionHandler = useCallback(() => { version && history.push(getVersionPath(EntityType.TABLE, tableFqn, version + '')); - }, [version]); + }, [version, tableFqn]); const afterDeleteAction = useCallback( (isSoftDelete?: boolean) => diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TestSuiteDetailsPage/TestSuiteDetailsPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TestSuiteDetailsPage/TestSuiteDetailsPage.component.tsx index d5eed19a0e6..3e71c1df17e 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/TestSuiteDetailsPage/TestSuiteDetailsPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/TestSuiteDetailsPage/TestSuiteDetailsPage.component.tsx @@ -97,8 +97,8 @@ const TestSuiteDetailsPage = () => { const { testSuiteDescription, testSuiteId, testOwner } = useMemo(() => { return { testOwner: testSuite?.owner, - testSuiteId: testSuite?.id, - testSuiteDescription: testSuite?.description, + testSuiteId: testSuite?.id ?? '', + testSuiteDescription: testSuite?.description ?? '', }; }, [testSuite]); @@ -132,7 +132,7 @@ const TestSuiteDetailsPage = () => { try { const response = await getListTestCase({ fields: 'testCaseResult,testDefinition,testSuite', - testSuiteId: testSuiteId, + testSuiteId, orderByLastExecutionDate: true, ...param, limit: pageSize, @@ -156,7 +156,7 @@ const TestSuiteDetailsPage = () => { try { await addTestCaseToLogicalTestSuite({ testCaseIds, - testSuiteId: testSuite?.id ?? '', + testSuiteId, }); setIsTestCaseModalOpen(false); fetchTestCases(); @@ -289,8 +289,8 @@ const TestSuiteDetailsPage = () => { }, [testSuiteFQN]); useEffect(() => { - if (testSuite?.id) { - fetchTestCases({ testSuiteId: testSuite.id }); + if (testSuiteId) { + fetchTestCases({ testSuiteId }); } }, [testSuite, pageSize]); @@ -360,8 +360,8 @@ const TestSuiteDetailsPage = () => { descriptionHandler(false)}