mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 18:36:08 +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 })),
|
||||
getTaglist: jest.fn().mockReturnValue(['tag 1', 'tag 2']),
|
||||
getTagOptionsFromFQN: jest.fn().mockReturnValue([]),
|
||||
isSystemTierTags: jest.fn().mockReturnValue(false),
|
||||
}));
|
||||
|
||||
jest.mock(
|
||||
|
@ -67,7 +67,7 @@ import {
|
||||
} from '../../utils/RouterUtils';
|
||||
import { getErrorText } from '../../utils/StringsUtils';
|
||||
import SVGIcons, { Icons } from '../../utils/SvgUtils';
|
||||
import { getTagCategories } from '../../utils/TagsUtils';
|
||||
import { getTagCategories, isSystemTierTags } from '../../utils/TagsUtils';
|
||||
import { showErrorToast } from '../../utils/ToastUtils';
|
||||
import Form from './Form';
|
||||
import './TagPage.style.less';
|
||||
@ -592,7 +592,10 @@ const TagsPage = () => {
|
||||
<button
|
||||
className="link-text"
|
||||
data-testid="delete-tag"
|
||||
disabled={!categoryPermissions.EditAll}
|
||||
disabled={
|
||||
isSystemTierTags(record.fullyQualifiedName || '') ||
|
||||
!categoryPermissions.EditAll
|
||||
}
|
||||
onClick={() => handleActionDeleteTag(record)}>
|
||||
{deleteTags.data?.id === record.id ? (
|
||||
deleteTags.data?.status === 'success' ? (
|
||||
@ -661,7 +664,10 @@ const TagsPage = () => {
|
||||
<Button
|
||||
className="tw-h-8 tw-rounded tw-ml-2"
|
||||
data-testid="delete-tag-category-button"
|
||||
disabled={!categoryPermissions.Delete}
|
||||
disabled={
|
||||
isSystemTierTags(currentCategory.name || '') ||
|
||||
!categoryPermissions.Delete
|
||||
}
|
||||
size="small"
|
||||
onClick={() => {
|
||||
deleteTagHandler();
|
||||
|
@ -151,3 +151,16 @@ export const fetchTagsAndGlossaryTerms = async () => {
|
||||
|
||||
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