diff --git a/datahub-web-react/src/app/entityV2/dataset/profile/schema/utils/utils.ts b/datahub-web-react/src/app/entityV2/dataset/profile/schema/utils/utils.ts index f9afa21b670e3e..d75171ca7fa83b 100644 --- a/datahub-web-react/src/app/entityV2/dataset/profile/schema/utils/utils.ts +++ b/datahub-web-react/src/app/entityV2/dataset/profile/schema/utils/utils.ts @@ -69,6 +69,11 @@ export function pathMatchesNewPath(fieldPathA?: string | null, fieldPathB?: stri return fieldPathA === fieldPathB || fieldPathA === downgradeV2FieldPath(fieldPathB); } +// should use pathMatchesExact when rendering editable info so the user edits the correct field +export function pathMatchesExact(fieldPathA?: string | null, fieldPathB?: string | null) { + return fieldPathA === fieldPathB; +} + // group schema fields by fieldPath and grouping for hierarchy in schema table export function groupByFieldPath( schemaRows?: Array, diff --git a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/components/SchemaFieldDrawer/AboutFieldTab.tsx b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/components/SchemaFieldDrawer/AboutFieldTab.tsx index d6d4caee20e46b..a96c2743ba1a15 100644 --- a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/components/SchemaFieldDrawer/AboutFieldTab.tsx +++ b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/components/SchemaFieldDrawer/AboutFieldTab.tsx @@ -10,7 +10,7 @@ import { UsageQueryResult, } from '../../../../../../../../types.generated'; import { useMutationUrn } from '../../../../../../../entity/shared/EntityContext'; -import { pathMatchesNewPath } from '../../../../../../dataset/profile/schema/utils/utils'; +import { pathMatchesExact } from '../../../../../../dataset/profile/schema/utils/utils'; import NotesSection from '../../../../../notes/NotesSection'; import FieldDescription from './FieldDescription'; import { FieldDetails } from './FieldDetails'; @@ -55,7 +55,7 @@ export function AboutFieldTab({ properties }: AboutFieldTabProps) { : undefined; const editableFieldInfo = properties.editableSchemaMetadata?.editableSchemaFieldInfo.find( (candidateEditableFieldInfo) => - pathMatchesNewPath(candidateEditableFieldInfo.fieldPath, expandedField?.fieldPath), + pathMatchesExact(candidateEditableFieldInfo.fieldPath, expandedField?.fieldPath), ); const notes = properties.notes?.sort((a, b) => moment(b.lastModified.time).diff(moment(a.lastModified.time))) || []; diff --git a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useDescriptionRenderer.tsx b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useDescriptionRenderer.tsx index 2d4151aaa26c5a..10afeb8dfdc044 100644 --- a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useDescriptionRenderer.tsx +++ b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useDescriptionRenderer.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { EditableSchemaMetadata, SchemaField, SubResourceType } from '../../../../../../../types.generated'; import DescriptionField from '../../../../../dataset/profile/schema/components/SchemaDescriptionField'; -import { pathMatchesNewPath } from '../../../../../dataset/profile/schema/utils/utils'; +import { pathMatchesExact } from '../../../../../dataset/profile/schema/utils/utils'; import { useUpdateDescriptionMutation } from '../../../../../../../graphql/mutations.generated'; import { useMutationUrn, useRefetch } from '../../../../../../entity/shared/EntityContext'; import { useSchemaRefetch } from '../SchemaContext'; @@ -31,7 +31,7 @@ export default function useDescriptionRenderer( return (description: string | undefined, record: SchemaField, index: number): JSX.Element => { const editableFieldInfo = editableSchemaMetadata?.editableSchemaFieldInfo.find((candidateEditableFieldInfo) => - pathMatchesNewPath(candidateEditableFieldInfo.fieldPath, record.fieldPath), + pathMatchesExact(candidateEditableFieldInfo.fieldPath, record.fieldPath), ); const { schemaFieldEntity } = record; const { displayedDescription, sanitizedDescription, isPropagated, sourceDetail } = extractFieldDescription( diff --git a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldDescriptionInfo.ts b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldDescriptionInfo.ts index b2158f9760ca17..8caab79d623677 100644 --- a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldDescriptionInfo.ts +++ b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldDescriptionInfo.ts @@ -1,4 +1,4 @@ -import { pathMatchesNewPath } from '@src/app/entityV2/dataset/profile/schema/utils/utils'; +import { pathMatchesExact } from '@src/app/entityV2/dataset/profile/schema/utils/utils'; import { EditableSchemaMetadata, SchemaField } from '@src/types.generated'; import { getFieldDescriptionDetails } from './getFieldDescriptionDetails'; import { sanitizeRichText } from '../../../Documentation/components/editor/utils'; @@ -8,7 +8,7 @@ export default function useExtractFieldDescriptionInfo( ) { return (record: SchemaField, description: string | undefined | null = null) => { const editableFieldInfoB = editableSchemaMetadata?.editableSchemaFieldInfo.find((candidateEditableFieldInfo) => - pathMatchesNewPath(candidateEditableFieldInfo.fieldPath, record.fieldPath), + pathMatchesExact(candidateEditableFieldInfo.fieldPath, record.fieldPath), ); const { displayedDescription, isPropagated, sourceDetail } = getFieldDescriptionDetails({ schemaFieldEntity: record.schemaFieldEntity, diff --git a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldGlossaryTermsInfo.ts b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldGlossaryTermsInfo.ts index 848b5e647cbafa..e77434a41ee6bd 100644 --- a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldGlossaryTermsInfo.ts +++ b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldGlossaryTermsInfo.ts @@ -1,4 +1,4 @@ -import { pathMatchesNewPath } from '@src/app/entityV2/dataset/profile/schema/utils/utils'; +import { pathMatchesExact } from '@src/app/entityV2/dataset/profile/schema/utils/utils'; import { EditableSchemaMetadata, GlossaryTerms, SchemaField } from '@src/types.generated'; export default function useExtractFieldGlossaryTermsInfo( @@ -6,7 +6,7 @@ export default function useExtractFieldGlossaryTermsInfo( ) { return (record: SchemaField, defaultUneditableTerms: GlossaryTerms | null = null) => { const editableTerms = editableSchemaMetadata?.editableSchemaFieldInfo.find((candidateEditableFieldInfo) => - pathMatchesNewPath(candidateEditableFieldInfo.fieldPath, record.fieldPath), + pathMatchesExact(candidateEditableFieldInfo.fieldPath, record.fieldPath), )?.glossaryTerms; const uneditableTerms = defaultUneditableTerms || record?.glossaryTerms; diff --git a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldTagsInfo.ts b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldTagsInfo.ts index bdd34e64e651eb..a809e5b3d3d0c4 100644 --- a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldTagsInfo.ts +++ b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useExtractFieldTagsInfo.ts @@ -1,10 +1,10 @@ -import { pathMatchesNewPath } from '@src/app/entityV2/dataset/profile/schema/utils/utils'; +import { pathMatchesExact } from '@src/app/entityV2/dataset/profile/schema/utils/utils'; import { EditableSchemaMetadata, GlobalTags, SchemaField } from '@src/types.generated'; export default function useExtractFieldTagsInfo(editableSchemaMetadata: EditableSchemaMetadata | null | undefined) { return (record: SchemaField, defaultUneditableTags: GlobalTags | null = null) => { const editableTags = editableSchemaMetadata?.editableSchemaFieldInfo.find((candidateEditableFieldInfo) => - pathMatchesNewPath(candidateEditableFieldInfo.fieldPath, record.fieldPath), + pathMatchesExact(candidateEditableFieldInfo.fieldPath, record.fieldPath), )?.globalTags; const uneditableTags = defaultUneditableTags || record?.globalTags; diff --git a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useTagsAndTermsRendererFeatureTable.tsx b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useTagsAndTermsRendererFeatureTable.tsx index b14072d1b5f29e..b8e284186f6242 100644 --- a/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useTagsAndTermsRendererFeatureTable.tsx +++ b/datahub-web-react/src/app/entityV2/shared/tabs/Dataset/Schema/utils/useTagsAndTermsRendererFeatureTable.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { EditableSchemaMetadata, EntityType, GlobalTags, SchemaField } from '../../../../../../../types.generated'; import TagTermGroup from '../../../../../../sharedV2/tags/TagTermGroup'; -import { pathMatchesNewPath } from '../../../../../dataset/profile/schema/utils/utils'; +import { pathMatchesExact } from '../../../../../dataset/profile/schema/utils/utils'; import { useEntityData, useRefetch } from '../../../../../../entity/shared/EntityContext'; export default function useTagsAndTermsRendererFeatureTable( @@ -15,7 +15,7 @@ export default function useTagsAndTermsRendererFeatureTable( const tagAndTermRender = (tags: GlobalTags, record: SchemaField, rowIndex: number | undefined) => { const relevantEditableFieldInfo = editableSchemaMetadata?.editableSchemaFieldInfo.find( - (candidateEditableFieldInfo) => pathMatchesNewPath(candidateEditableFieldInfo.fieldPath, record.fieldPath), + (candidateEditableFieldInfo) => pathMatchesExact(candidateEditableFieldInfo.fieldPath, record.fieldPath), ); return (