From 0f889e03275187c30f95b0ff05df499da17c0111 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Fri, 2 Dec 2022 22:56:11 +0530 Subject: [PATCH] Use Backend system level flag for system tags (#9126) --- .../main/resources/ui/src/pages/tags/index.test.tsx | 1 - .../src/main/resources/ui/src/pages/tags/index.tsx | 7 ++++--- .../src/main/resources/ui/src/utils/TagsUtils.ts | 13 ------------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/tags/index.test.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/tags/index.test.tsx index db2df28487e..7577916f505 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/tags/index.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/tags/index.test.tsx @@ -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( diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/tags/index.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/tags/index.tsx index ec3dd879329..eb9ea1ca01c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/tags/index.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/tags/index.tsx @@ -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" diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.ts b/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.ts index 09865c166e8..fada284b9b9 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.ts @@ -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); -};