mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-28 10:56:02 +00:00
* UI Fixed Deleting the Tier tag category causes UI errors #5849 * fixed failing test * updated logic for restricting system tags deletion
This commit is contained in:
parent
db0215f964
commit
4faafe4235
@ -254,6 +254,7 @@ jest.mock('../../utils/TagsUtils', () => ({
|
|||||||
.mockImplementation(() => Promise.resolve({ data: mockTagsCategory })),
|
.mockImplementation(() => Promise.resolve({ data: mockTagsCategory })),
|
||||||
getTaglist: jest.fn().mockReturnValue(['tag 1', 'tag 2']),
|
getTaglist: jest.fn().mockReturnValue(['tag 1', 'tag 2']),
|
||||||
getTagOptionsFromFQN: jest.fn().mockReturnValue([]),
|
getTagOptionsFromFQN: jest.fn().mockReturnValue([]),
|
||||||
|
isSystemTierTags: jest.fn().mockReturnValue(false),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
jest.mock(
|
jest.mock(
|
||||||
|
@ -67,7 +67,7 @@ import {
|
|||||||
} from '../../utils/RouterUtils';
|
} from '../../utils/RouterUtils';
|
||||||
import { getErrorText } from '../../utils/StringsUtils';
|
import { getErrorText } from '../../utils/StringsUtils';
|
||||||
import SVGIcons, { Icons } from '../../utils/SvgUtils';
|
import SVGIcons, { Icons } from '../../utils/SvgUtils';
|
||||||
import { getTagCategories } from '../../utils/TagsUtils';
|
import { getTagCategories, isSystemTierTags } from '../../utils/TagsUtils';
|
||||||
import { showErrorToast } from '../../utils/ToastUtils';
|
import { showErrorToast } from '../../utils/ToastUtils';
|
||||||
import Form from './Form';
|
import Form from './Form';
|
||||||
import './TagPage.style.less';
|
import './TagPage.style.less';
|
||||||
@ -592,7 +592,10 @@ const TagsPage = () => {
|
|||||||
<button
|
<button
|
||||||
className="link-text"
|
className="link-text"
|
||||||
data-testid="delete-tag"
|
data-testid="delete-tag"
|
||||||
disabled={!categoryPermissions.EditAll}
|
disabled={
|
||||||
|
isSystemTierTags(record.fullyQualifiedName || '') ||
|
||||||
|
!categoryPermissions.EditAll
|
||||||
|
}
|
||||||
onClick={() => handleActionDeleteTag(record)}>
|
onClick={() => handleActionDeleteTag(record)}>
|
||||||
{deleteTags.data?.id === record.id ? (
|
{deleteTags.data?.id === record.id ? (
|
||||||
deleteTags.data?.status === 'success' ? (
|
deleteTags.data?.status === 'success' ? (
|
||||||
@ -661,7 +664,10 @@ const TagsPage = () => {
|
|||||||
<Button
|
<Button
|
||||||
className="tw-h-8 tw-rounded tw-ml-2"
|
className="tw-h-8 tw-rounded tw-ml-2"
|
||||||
data-testid="delete-tag-category-button"
|
data-testid="delete-tag-category-button"
|
||||||
disabled={!categoryPermissions.Delete}
|
disabled={
|
||||||
|
isSystemTierTags(currentCategory.name || '') ||
|
||||||
|
!categoryPermissions.Delete
|
||||||
|
}
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
deleteTagHandler();
|
deleteTagHandler();
|
||||||
|
@ -151,3 +151,16 @@ export const fetchTagsAndGlossaryTerms = async () => {
|
|||||||
|
|
||||||
return tagsAndTerms;
|
return tagsAndTerms;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isSystemTierTags = (tag: string) => {
|
||||||
|
const tierTags = [
|
||||||
|
'Tier',
|
||||||
|
'Tier.Tier1',
|
||||||
|
'Tier.Tier2',
|
||||||
|
'Tier.Tier3',
|
||||||
|
'Tier.Tier4',
|
||||||
|
'Tier.Tier5',
|
||||||
|
];
|
||||||
|
|
||||||
|
return tierTags.includes(tag);
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user