Fix: bug on description & tag update for duplicate entity names (#10340)

* fix UI bug

* add nullish check

---------

Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
This commit is contained in:
Sasha Chung 2023-02-28 16:23:18 +09:00 committed by GitHub
parent d3e5461c58
commit 2b4bf736af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -168,16 +168,16 @@ const EntityTable = ({
const updateColumnDescription = ( const updateColumnDescription = (
tableCols: Column[], tableCols: Column[],
changedColName: string, changedColFQN: string,
description: string description: string
) => { ) => {
tableCols?.forEach((col) => { tableCols?.forEach((col) => {
if (col.name === changedColName) { if (col.fullyQualifiedName === changedColFQN) {
col.description = description; col.description = description;
} else { } else {
updateColumnDescription( updateColumnDescription(
col?.children as Column[], col?.children as Column[],
changedColName, changedColFQN,
description description
); );
} }
@ -186,7 +186,7 @@ const EntityTable = ({
const updateColumnTags = ( const updateColumnTags = (
tableCols: Column[], tableCols: Column[],
changedColName: string, changedColFQN: string,
newColumnTags: Array<TagOption> newColumnTags: Array<TagOption>
) => { ) => {
const getUpdatedTags = (column: Column) => { const getUpdatedTags = (column: Column) => {
@ -210,12 +210,12 @@ const EntityTable = ({
}; };
tableCols?.forEach((col) => { tableCols?.forEach((col) => {
if (col.name === changedColName) { if (col.fullyQualifiedName === changedColFQN) {
col.tags = getUpdatedTags(col); col.tags = getUpdatedTags(col);
} else { } else {
updateColumnTags( updateColumnTags(
col?.children as Column[], col?.children as Column[],
changedColName, changedColFQN,
newColumnTags newColumnTags
); );
} }
@ -223,11 +223,11 @@ const EntityTable = ({
}; };
const handleEditColumnChange = async (columnDescription: string) => { const handleEditColumnChange = async (columnDescription: string) => {
if (editColumn) { if (editColumn && editColumn.column.fullyQualifiedName) {
const tableCols = cloneDeep(tableColumns); const tableCols = cloneDeep(tableColumns);
updateColumnDescription( updateColumnDescription(
tableCols, tableCols,
editColumn.column.name, editColumn.column.fullyQualifiedName,
columnDescription columnDescription
); );
await onUpdate?.(tableCols); await onUpdate?.(tableCols);
@ -239,18 +239,18 @@ const EntityTable = ({
const handleTagSelection = ( const handleTagSelection = (
selectedTags?: Array<EntityTags>, selectedTags?: Array<EntityTags>,
columnName = '' columnFQN = ''
) => { ) => {
const newSelectedTags: TagOption[] | undefined = selectedTags?.map( const newSelectedTags: TagOption[] | undefined = selectedTags?.map(
(tag) => { (tag) => {
return { fqn: tag.tagFQN, source: tag.source }; return { fqn: tag.tagFQN, source: tag.source };
} }
); );
if (newSelectedTags && (editColumnTag || columnName)) { if (newSelectedTags && (editColumnTag || columnFQN)) {
const tableCols = cloneDeep(tableColumns); const tableCols = cloneDeep(tableColumns);
updateColumnTags( updateColumnTags(
tableCols, tableCols,
editColumnTag?.column.name || columnName, editColumnTag?.column.fullyQualifiedName || columnFQN,
newSelectedTags newSelectedTags
); );
onUpdate?.(tableCols); onUpdate?.(tableCols);
@ -551,7 +551,7 @@ const EntityTable = ({
handleTagSelection(); handleTagSelection();
}} }}
onSelectionChange={(selectedTags) => { onSelectionChange={(selectedTags) => {
handleTagSelection(selectedTags, record?.name); handleTagSelection(selectedTags, record?.fullyQualifiedName);
}} }}
/> />