Use Backend system level flag for system tags (#9126)

This commit is contained in:
Ashish Gupta 2022-12-02 22:56:11 +05:30 committed by GitHub
parent 0306bc6d69
commit 0f889e0327
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 17 deletions

View File

@ -254,7 +254,6 @@ 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(

View File

@ -48,6 +48,7 @@ import { TIER_CATEGORY } from '../../constants/constants';
import { NO_PERMISSION_FOR_ACTION } from '../../constants/HelperTextUtil';
import { delimiterRegex } from '../../constants/regex.constants';
import { CreateTagCategory } from '../../generated/api/tags/createTagCategory';
import { ProviderType } from '../../generated/entity/bot';
import { Operation } from '../../generated/entity/policies/accessControl/rule';
import { TagCategory, TagClass } from '../../generated/entity/tags/tagCategory';
import { EntityReference } from '../../generated/type/entityReference';
@ -68,7 +69,7 @@ import {
} from '../../utils/RouterUtils';
import { getErrorText } from '../../utils/StringsUtils';
import SVGIcons, { Icons } from '../../utils/SvgUtils';
import { getTagCategories, isSystemTierTags } from '../../utils/TagsUtils';
import { getTagCategories } from '../../utils/TagsUtils';
import { showErrorToast } from '../../utils/ToastUtils';
import Form from './Form';
import './TagPage.style.less';
@ -594,7 +595,7 @@ const TagsPage = () => {
className="link-text"
data-testid="delete-tag"
disabled={
isSystemTierTags(record.fullyQualifiedName || '') ||
record.provider === ProviderType.System ||
!categoryPermissions.EditAll
}
onClick={() => handleActionDeleteTag(record)}>
@ -666,7 +667,7 @@ const TagsPage = () => {
className="tw-h-8 tw-rounded tw-ml-2"
data-testid="delete-tag-category-button"
disabled={
isSystemTierTags(currentCategory.name || '') ||
currentCategory.provider === ProviderType.System ||
!categoryPermissions.Delete
}
size="small"

View File

@ -151,16 +151,3 @@ 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);
};