Skip to content

Commit

Permalink
supported display name in description (#14105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish8689 authored Nov 24, 2023
1 parent 1540329 commit b25b537
Show file tree
Hide file tree
Showing 26 changed files with 67 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
getClassificationExtraDropdownContent,
getTagsTableColumn,
} from '../../utils/ClassificationUtils';
import { getEntityName } from '../../utils/EntityUtils';
import {
getEntityVersionByField,
getMutuallyExclusiveDiff,
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const ContainerDataModel: FC<ContainerDataModelProps> = ({
<ModalWithMarkdownEditor
header={`${t('label.edit-entity', {
entity: t('label.column'),
})}: "${editContainerColumnDescription.name}"`}
})}: "${getEntityName(editContainerColumnDescription)}"`}
placeholder={t('label.enter-field-description', {
field: t('label.column'),
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ const DashboardDetails = ({
{editChart && (
<ModalWithMarkdownEditor
header={t('label.edit-chart-name', {
name: editChart.chart.displayName,
name: getEntityName(editChart.chart),
})}
placeholder={t('label.enter-field-description', {
field: t('label.chart'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const ModelTab = ({
<ModalWithMarkdownEditor
header={`${t('label.edit-entity', {
entity: t('label.column'),
})}: "${editColumnDescription.name}"`}
})}: "${getEntityName(editColumnDescription)}"`}
placeholder={t('label.enter-field-description', {
field: t('label.column'),
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { EntityField } from '../../../constants/Feeds.constants';
import { EntityType } from '../../../enums/entity.enum';
import { ChangeDescription } from '../../../generated/entity/type';
import { getFeedCounts } from '../../../utils/CommonUtils';
import { getEntityName } from '../../../utils/EntityUtils';
import { getEntityVersionByField } from '../../../utils/EntityVersionUtils';
import { ActivityFeedTab } from '../../ActivityFeed/ActivityFeedTab/ActivityFeedTab.component';
import DescriptionV1 from '../../common/EntityDescription/DescriptionV1';
Expand Down Expand Up @@ -133,7 +134,7 @@ const GlossaryDetails = ({
<DescriptionV1
description={description}
entityFqn={glossary.fullyQualifiedName}
entityName={glossary.displayName ?? glossary.name}
entityName={getEntityName(glossary)}
entityType={EntityType.GLOSSARY}
hasEditAccess={permissions.EditDescription || permissions.EditAll}
isEdit={isDescriptionEditable}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ const AssetsTabs = forwardRef(
<ConfirmationModal
bodyText={t('message.are-you-sure-action-property', {
propertyName: getEntityName(assetToDelete),
action: t('label.remove-lowecase'),
action: t('label.remove-lowercase'),
})}
cancelText={t('label.cancel')}
confirmText={t('label.delete')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
[mlModelFqn]
);

const mlModelName = useMemo(
() => getEntityName(mlModelDetail),
[mlModelDetail]
);

const fetchResourcePermission = useCallback(async () => {
try {
const entityPermission = await getEntityPermission(
Expand Down Expand Up @@ -124,12 +129,12 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
...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);
Expand Down Expand Up @@ -392,7 +397,7 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
<DescriptionV1
description={mlModelDetail.description}
entityFqn={decodedMlModelFqn}
entityName={mlModelDetail.name}
entityName={mlModelName}
entityType={EntityType.MLMODEL}
hasEditAccess={editDescriptionPermission}
isEdit={isEdit}
Expand Down Expand Up @@ -514,6 +519,7 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
feedCount,
activeTab,
mlModelDetail,
mlModelName,
mlModelPermissions,
isEdit,
getMlHyperParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -228,7 +229,7 @@ const MlModelFeaturesList = ({
<ModalWithMarkdownEditor
header={t('label.edit-entity-name', {
entityType: t('label.feature'),
entityName: selectedFeature.name,
entityName: getEntityName(selectedFeature),
})}
placeholder={t('label.enter-field-description', {
field: t('label.feature-lowercase'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,9 @@ const PipelineDetails = ({

{editTask && (
<ModalWithMarkdownEditor
header={`${t('label.edit-entity', { entity: t('label.task') })}: "${
editTask.task.displayName ?? editTask.task.name
}"`}
header={`${t('label.edit-entity', {
entity: t('label.task'),
})}: "${getEntityName(editTask.task)}"`}
placeholder={t('label.enter-field-description', {
field: t('label.task-lowercase'),
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ const SchemaTable = ({
<ModalWithMarkdownEditor
header={`${t('label.edit-entity', {
entity: t('label.column'),
})}: "${editColumn.name}"`}
})}: "${getEntityName(editColumn)}"`}
placeholder={t('message.enter-column-description')}
value={editColumn.description as string}
visible={Boolean(editColumn)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ const TeamDetailsV1 = ({
}>
<Description
description={currentTeam.description ?? ''}
entityName={currentTeam.displayName ?? currentTeam.name}
entityName={getEntityName(currentTeam)}
isEdit={isDescriptionEditable}
onCancel={() => descriptionHandler(false)}
onDescriptionUpdate={onDescriptionUpdate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ const TopicSchemaFields: FC<TopicSchemaFieldsProps> = ({
<ModalWithMarkdownEditor
header={`${t('label.edit-entity', {
entity: t('label.schema-field'),
})}: "${editFieldDescription.name}"`}
})}: "${getEntityName(editFieldDescription)}"`}
placeholder={t('label.enter-field-description', {
field: t('label.schema-field'),
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
"relevance": "Relevanz",
"remove": "Entfernen",
"remove-entity": "{{entity}} entfernen",
"remove-lowecase": "remove",
"remove-lowercase": "remove",
"removed": "Entfernt",
"removing-user": "Benutzer entfernen",
"rename": "Umbenennen",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
"relevance": "Relevance",
"remove": "Remove",
"remove-entity": "Remove {{entity}}",
"remove-lowecase": "remove",
"remove-lowercase": "remove",
"removed": "Removed",
"removing-user": "Removing User",
"rename": "Rename",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
"relevance": "Relevancia",
"remove": "Eliminar",
"remove-entity": "Eliminar {{entity}}",
"remove-lowecase": "remove",
"remove-lowercase": "remove",
"removed": "Eliminado",
"removing-user": "Eliminando usuario",
"rename": "Rename",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
"relevance": "Pertinence",
"remove": "Retirer",
"remove-entity": "Retirer un·e {{entity}}",
"remove-lowecase": "remove",
"remove-lowercase": "remove",
"removed": "Retiré",
"removing-user": "Retirer un Utilisateur",
"rename": "Renommer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
"relevance": "Relevance",
"remove": "除外",
"remove-entity": "{{entity}}を除外",
"remove-lowecase": "remove",
"remove-lowercase": "remove",
"removed": "除外",
"removing-user": "ユーザを除外する",
"rename": "Rename",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
"relevance": "Relevância",
"remove": "Remover",
"remove-entity": "Remover {{entity}}",
"remove-lowecase": "remove",
"remove-lowercase": "remove",
"removed": "Removido",
"removing-user": "Removendo usuário",
"rename": "Rename",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
"relevance": "Актуальность",
"remove": "Удалить",
"remove-entity": "Удалить {{entity}}",
"remove-lowecase": "remove",
"remove-lowercase": "remove",
"removed": "Удаленный",
"removing-user": "Удаление пользователя",
"rename": "Переименовать",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
"relevance": "相关性",
"remove": "删除",
"remove-entity": "删除{{entity}}",
"remove-lowecase": "remove",
"remove-lowercase": "remove",
"removed": "已删除",
"removing-user": "正在删除用户",
"rename": "重命名",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const DatabaseDetails: FunctionComponent = () => {

setSchemaInstanceCount(paging.total);
} catch (error) {
showErrorToast(error);
showErrorToast(error as AxiosError);
} finally {
setIsLoading(false);
}
Expand Down Expand Up @@ -515,7 +515,7 @@ const DatabaseDetails: FunctionComponent = () => {
<DescriptionV1
description={description}
entityFqn={decodedDatabaseFQN}
entityName={databaseName}
entityName={getEntityName(database)}
entityType={EntityType.DATABASE}
hasEditAccess={editDescriptionPermission}
isEdit={isEdit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,20 @@ const PoliciesDetailPage = () => {
GlobalSettingOptions.POLICIES
);

const policyName = useMemo(() => getEntityName(policy), [policy]);

const breadcrumb = useMemo(
() => [
{
name: t('label.policy-plural'),
url: policiesPath,
},
{
name: getEntityName(policy),
name: policyName,
url: '',
},
],
[policy]
[policyName, policiesPath]
);

const fetchPolicy = async () => {
Expand Down Expand Up @@ -329,14 +331,14 @@ const PoliciesDetailPage = () => {
className="m-b-0 m-t-xs"
data-testid="heading"
level={5}>
{getEntityName(policy)}
{policyName}
</Typography.Title>
<Description
hasEditAccess
className="m-b-md"
description={policy.description || ''}
entityFqn={policy.fullyQualifiedName}
entityName={getEntityName(policy)}
entityName={policyName}
entityType={EntityType.POLICY}
isEdit={editDescription}
onCancel={() => setEditDescription(false)}
Expand Down Expand Up @@ -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);
Expand All @@ -495,7 +497,7 @@ const PoliciesDetailPage = () => {
<Typography.Text>
{t('message.are-you-sure-you-want-to-remove-child-from-parent', {
child: getEntityName(selectedEntity.record),
parent: getEntityName(policy),
parent: policyName,
})}
</Typography.Text>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,20 @@ const RolesDetailPage = () => {
GlobalSettingOptions.ROLES
);

const roleName = useMemo(() => getEntityName(role), [role]);

const breadcrumb = useMemo(
() => [
{
name: t('label.role-plural'),
url: rolesPath,
},
{
name: getEntityName(role),
name: roleName,
url: '',
},
],
[role]
[rolesPath, roleName]
);

const fetchRole = async () => {
Expand Down Expand Up @@ -251,14 +253,14 @@ const RolesDetailPage = () => {
className="m-b-0 m-t-xs"
data-testid="heading"
level={5}>
{getEntityName(role)}
{roleName}
</Typography.Title>
<Description
hasEditAccess
className="m-b-md"
description={role.description || ''}
entityFqn={role.fullyQualifiedName}
entityName={getEntityName(role)}
entityName={roleName}
entityType={EntityType.ROLE}
isEdit={editDescription}
onCancel={() => setEditDescription(false)}
Expand Down Expand Up @@ -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);
Expand All @@ -337,7 +339,7 @@ const RolesDetailPage = () => {
<Typography.Text>
{t('message.are-you-sure-you-want-to-remove-child-from-parent', {
child: getEntityName(selectedEntity.record),
parent: getEntityName(role),
parent: roleName,
})}
</Typography.Text>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ const SearchIndexFieldsTable = ({
<ModalWithMarkdownEditor
header={`${t('label.edit-entity', {
entity: t('label.field'),
})}: "${editField.field.name}"`}
})}: "${getEntityName(editField.field)}"`}
placeholder={t('label.enter-field-description', {
field: t('label.field'),
})}
Expand Down
Loading

0 comments on commit b25b537

Please sign in to comment.