Fix #7957 Table with FK and PK only display PK label in schema tab (#7982)

* Fix #7957 Table with FK and PK only display PK label in schema tab

* Add data-testid

* Fix tag page issue
This commit is contained in:
Sachin Chaurasiya 2022-10-06 18:39:03 +05:30 committed by GitHub
parent 544bd7657f
commit 4be02c20b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 19 deletions

View File

@ -15,7 +15,7 @@ import { faCaretDown, faCaretRight } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Popover, Table } from 'antd';
import classNames from 'classnames';
import { cloneDeep, isEmpty, isNil, isUndefined, lowerCase } from 'lodash';
import { cloneDeep, isEmpty, isUndefined, lowerCase } from 'lodash';
import { EntityFieldThreads, EntityTags, TagOption } from 'Models';
import React, {
Fragment,
@ -349,18 +349,26 @@ const EntityTable = ({
columnName: string,
columnConstraint?: string
) => {
if (!isNil(columnConstraint)) {
return getConstraintIcon(columnConstraint, 'tw-mr-2');
} else {
const flag = tableConstraints?.find((constraint) =>
constraint.columns?.includes(columnName)
);
if (!isUndefined(flag)) {
return getConstraintIcon(flag.constraintType, 'tw-mr-2');
} else {
return null;
}
}
// get the table constraint for column
const tableConstraint = tableConstraints?.find((constraint) =>
constraint.columns?.includes(columnName)
);
// prepare column constraint element
const columnConstraintEl = columnConstraint
? getConstraintIcon(columnConstraint, 'tw-mr-2')
: null;
// prepare table constraint element
const tableConstraintEl = tableConstraint
? getConstraintIcon(tableConstraint.constraintType, 'tw-mr-2')
: null;
return (
<span data-testid="constraints">
{columnConstraintEl} {tableConstraintEl}
</span>
);
};
const handleUpdate = (column: Column, index: number) => {

View File

@ -222,8 +222,7 @@ const TagsPage = () => {
createTagCategory(data)
.then((res) => {
if (res) {
setCurrentCategory(res);
fetchCategories();
history.push(getTagPath(res.name));
} else {
throw jsonData['api-error-messages']['unexpected-server-response'];
}
@ -268,9 +267,12 @@ const TagsPage = () => {
const updatedCategory = categories.filter(
(data) => data.id !== categoryId
);
setCurrentCategory(updatedCategory[0]);
setCategoreis(updatedCategory);
setIsLoading(false);
const currentCategory = updatedCategory[0];
history.push(
getTagPath(
currentCategory?.fullyQualifiedName || currentCategory?.name
)
);
} else {
showErrorToast(
jsonData['api-error-messages']['delete-tag-category-error']
@ -283,7 +285,10 @@ const TagsPage = () => {
jsonData['api-error-messages']['delete-tag-category-error']
);
})
.finally(() => setDeleteTags({ data: undefined, state: false }));
.finally(() => {
setDeleteTags({ data: undefined, state: false });
setIsLoading(false);
});
};
/**