From 2b4bf736afe2ba364c01c06da3696f729f5f9b6a Mon Sep 17 00:00:00 2001 From: Sasha Chung <50770626+nuang-ee@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:23:18 +0900 Subject: [PATCH] Fix: bug on description & tag update for duplicate entity names (#10340) * fix UI bug * add nullish check --------- Co-authored-by: Sachin Chaurasiya --- .../EntityTable/EntityTable.component.tsx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/EntityTable/EntityTable.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/EntityTable/EntityTable.component.tsx index 24f978b3498..854a6ec837a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/EntityTable/EntityTable.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/EntityTable/EntityTable.component.tsx @@ -168,16 +168,16 @@ const EntityTable = ({ const updateColumnDescription = ( tableCols: Column[], - changedColName: string, + changedColFQN: string, description: string ) => { tableCols?.forEach((col) => { - if (col.name === changedColName) { + if (col.fullyQualifiedName === changedColFQN) { col.description = description; } else { updateColumnDescription( col?.children as Column[], - changedColName, + changedColFQN, description ); } @@ -186,7 +186,7 @@ const EntityTable = ({ const updateColumnTags = ( tableCols: Column[], - changedColName: string, + changedColFQN: string, newColumnTags: Array ) => { const getUpdatedTags = (column: Column) => { @@ -210,12 +210,12 @@ const EntityTable = ({ }; tableCols?.forEach((col) => { - if (col.name === changedColName) { + if (col.fullyQualifiedName === changedColFQN) { col.tags = getUpdatedTags(col); } else { updateColumnTags( col?.children as Column[], - changedColName, + changedColFQN, newColumnTags ); } @@ -223,11 +223,11 @@ const EntityTable = ({ }; const handleEditColumnChange = async (columnDescription: string) => { - if (editColumn) { + if (editColumn && editColumn.column.fullyQualifiedName) { const tableCols = cloneDeep(tableColumns); updateColumnDescription( tableCols, - editColumn.column.name, + editColumn.column.fullyQualifiedName, columnDescription ); await onUpdate?.(tableCols); @@ -239,18 +239,18 @@ const EntityTable = ({ const handleTagSelection = ( selectedTags?: Array, - columnName = '' + columnFQN = '' ) => { const newSelectedTags: TagOption[] | undefined = selectedTags?.map( (tag) => { return { fqn: tag.tagFQN, source: tag.source }; } ); - if (newSelectedTags && (editColumnTag || columnName)) { + if (newSelectedTags && (editColumnTag || columnFQN)) { const tableCols = cloneDeep(tableColumns); updateColumnTags( tableCols, - editColumnTag?.column.name || columnName, + editColumnTag?.column.fullyQualifiedName || columnFQN, newSelectedTags ); onUpdate?.(tableCols); @@ -551,7 +551,7 @@ const EntityTable = ({ handleTagSelection(); }} onSelectionChange={(selectedTags) => { - handleTagSelection(selectedTags, record?.name); + handleTagSelection(selectedTags, record?.fullyQualifiedName); }} />