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 = (
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<TagOption>
) => {
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<EntityTags>,
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);
}}
/>