From 2d25ae2745b16336cf3243558772cd276e7b9d4f Mon Sep 17 00:00:00 2001 From: Chira Madlani Date: Mon, 24 Jun 2024 20:21:45 +0530 Subject: [PATCH 1/6] fix(ui): consider all the tags as tier which are children of Tier classification --- .../ui/src/utils/TableUtils.test.tsx | 43 +++++++++++++++++++ .../resources/ui/src/utils/TableUtils.tsx | 10 ++--- 2 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.test.tsx diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.test.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.test.tsx new file mode 100644 index 000000000000..2a3c7767794c --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.test.tsx @@ -0,0 +1,43 @@ +/* + * Copyright 2024 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { TagLabel } from '../generated/entity/data/container'; +import { getTagsWithoutTier, getTierTags } from '../utils/TableUtils'; + +describe('TableUtils', () => { + it('getTierTags should return the correct usage percentile', () => { + const tags = [ + { tagFQN: 'Tier.Tier1' }, + { tagFQN: 'RandomTag' }, + { tagFQN: 'OtherTag' }, + ] as TagLabel[]; + const result = getTierTags(tags); + + expect(result).toStrictEqual({ tagFQN: 'Tier.Tier1' }); + }); + + it('getTagsWithoutTier should return the tier tag FQN', () => { + const tags = [ + { tagFQN: 'Tier.Gold' }, + { tagFQN: 'RandomTag' }, + { tagFQN: 'OtherTag' }, + ]; + const result = getTagsWithoutTier(tags); + + expect(result).toStrictEqual([ + { tagFQN: 'RandomTag' }, + { tagFQN: 'OtherTag' }, + ]); + }); + + // Add more tests for other functions in TableUtils... +}); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx index d351315d9ee0..61f8f1e319b5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx @@ -116,10 +116,8 @@ export const getTierFromTableTags = ( }; export const getTierTags = (tags: Array) => { - const tierTag = tags.find( - (item) => - item.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) && - !isNaN(parseInt(item.tagFQN.substring(9).trim())) + const tierTag = tags.find((item) => + item.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}`) ); return tierTag; @@ -129,9 +127,7 @@ export const getTagsWithoutTier = ( tags: Array ): Array => { return tags.filter( - (item) => - !item.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) || - isNaN(parseInt(item.tagFQN.substring(9).trim())) + (item) => !item.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}`) ); }; From d70863d722fb481cd93b13ebb0dcd069dc8a3229 Mon Sep 17 00:00:00 2001 From: Chira Madlani Date: Mon, 24 Jun 2024 22:48:36 +0530 Subject: [PATCH 2/6] add playwright --- .../ui/playwright/e2e/Pages/Entity.spec.ts | 6 +- .../support/entity/EntityDataClass.ts | 4 + .../ui/playwright/support/tag/TagClass.ts | 100 ++++++++++++++++++ .../main/resources/ui/playwright/utils/tag.ts | 27 +++++ 4 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 openmetadata-ui/src/main/resources/ui/playwright/support/tag/TagClass.ts create mode 100644 openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts index bb3f322d4d4c..6f40658bbe4d 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts @@ -85,7 +85,11 @@ entities.forEach((EntityClass) => { }); test('Tier Add, Update and Remove', async ({ page }) => { - await entity.tier(page, 'Tier1', 'Tier5'); + await entity.tier( + page, + 'Tier1', + EntityDataClass.tierTag1.data.displayName + ); }); test('Update description', async ({ page }) => { diff --git a/openmetadata-ui/src/main/resources/ui/playwright/support/entity/EntityDataClass.ts b/openmetadata-ui/src/main/resources/ui/playwright/support/entity/EntityDataClass.ts index 750c143aa04e..ee852948afb2 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/support/entity/EntityDataClass.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/support/entity/EntityDataClass.ts @@ -14,6 +14,7 @@ import { APIRequestContext } from '@playwright/test'; import { Domain } from '../domain/Domain'; import { Glossary } from '../glossary/Glossary'; import { GlossaryTerm } from '../glossary/GlossaryTerm'; +import { TagClass } from '../tag/TagClass'; import { TeamClass } from '../team/TeamClass'; import { UserClass } from '../user/UserClass'; @@ -28,6 +29,7 @@ export class EntityDataClass { static readonly user2 = new UserClass(); static readonly team1 = new TeamClass(); static readonly team2 = new TeamClass(); + static readonly tierTag1 = new TagClass({ classification: 'Tier' }); static async preRequisitesForTests(apiContext: APIRequestContext) { // Add pre-requisites for tests @@ -41,6 +43,7 @@ export class EntityDataClass { await this.user2.create(apiContext); await this.team1.create(apiContext); await this.team2.create(apiContext); + await this.tierTag1.create(apiContext); } static async postRequisitesForTests(apiContext: APIRequestContext) { @@ -54,5 +57,6 @@ export class EntityDataClass { await this.user2.delete(apiContext); await this.team1.delete(apiContext); await this.team2.delete(apiContext); + await this.tierTag1.delete(apiContext); } } diff --git a/openmetadata-ui/src/main/resources/ui/playwright/support/tag/TagClass.ts b/openmetadata-ui/src/main/resources/ui/playwright/support/tag/TagClass.ts new file mode 100644 index 000000000000..4c3fecaf51f6 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/playwright/support/tag/TagClass.ts @@ -0,0 +1,100 @@ +/* + * Copyright 2024 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { APIRequestContext, Page } from '@playwright/test'; +import { visitClassificationPage } from '../../utils/tag'; +import { getRandomLastName } from '../../utils/user'; + +type ResponseDataType = { + name: string; + displayName: string; + description: string; + reviewers: unknown[]; + relatedTerms: unknown[]; + synonyms: unknown[]; + mutuallyExclusive: boolean; + tags: unknown[]; + glossary: Record; + id: string; + fullyQualifiedName: string; +}; + +export type TagData = { + style?: { + color: string; + }; + description: string; + displayName: string; + classification: string; + name: string; +}; + +export class TagClass { + randomName = getRandomLastName(); + data: TagData = { + name: `pw-tier-${this.randomName}`, + displayName: `PW Tier ${this.randomName}`, + description: 'Tier tag for the Collate platform', + style: { + color: '#FFD700', + }, + classification: 'Tier', + }; + + responseData: ResponseDataType; + + constructor(tag: Partial) { + this.data.classification = tag.classification ?? this.data.classification; + } + + async visitPage(page: Page) { + await visitClassificationPage(page, this.responseData.glossary.displayName); + } + + async create(apiContext: APIRequestContext) { + const response = await apiContext.post('/api/v1/tags', { + data: this.data, + }); + + this.responseData = await response.json(); + + return await response.json(); + } + + // async patch(apiContext: APIRequestContext, data: Record[]) { + // const response = await apiContext.patch( + // `/api/v1/glossaryTerms/${this.responseData.id}`, + // { + // data, + // headers: { + // 'Content-Type': 'application/json-patch+json', + // }, + // } + // ); + + // this.responseData = await response.json(); + + // return await response.json(); + // } + + get() { + return this.responseData; + } + + async delete(apiContext: APIRequestContext) { + const response = await apiContext.delete( + `/api/v1/tags/${this.responseData.id}?recursive=true&hardDelete=true` + ); + + return await response.json(); + } +} diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts new file mode 100644 index 000000000000..b81227d0f4bc --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Page } from '@playwright/test'; +import { SidebarItem } from '../constant/sidebar'; +import { redirectToHomePage } from './common'; +import { sidebarClick } from './sidebar'; + +export const visitClassificationPage = async ( + page: Page, + classificationName: string +) => { + await redirectToHomePage(page); + const glossaryResponse = page.waitForResponse('/api/v1/glossaries?fields=*'); + await sidebarClick(page, SidebarItem.GLOSSARY); + await glossaryResponse; + await page.getByRole('menuitem', { name: classificationName }).click(); +}; From 587c1a8837ec6c9603d0ea1ca6996b7e2a5e67b9 Mon Sep 17 00:00:00 2001 From: Chira Madlani Date: Tue, 25 Jun 2024 14:40:31 +0530 Subject: [PATCH 3/6] wip tier cleanup --- .../AsyncSelectList/AsyncSelectList.tsx | 4 +- .../resources/ui/src/utils/CommonUtils.tsx | 4 +- .../resources/ui/src/utils/EntityUtils.tsx | 38 +++++++++---------- .../resources/ui/src/utils/TableUtils.tsx | 12 ------ 4 files changed, 23 insertions(+), 35 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/AsyncSelectList/AsyncSelectList.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/AsyncSelectList/AsyncSelectList.tsx index ffb560dfdcff..80944d895674 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/AsyncSelectList/AsyncSelectList.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/AsyncSelectList/AsyncSelectList.tsx @@ -39,6 +39,7 @@ import { LabelType } from '../../../generated/entity/data/table'; import { Paging } from '../../../generated/type/paging'; import { TagLabel } from '../../../generated/type/tagLabel'; import Fqn from '../../../utils/Fqn'; +import { getTagsWithoutTier } from '../../../utils/TableUtils'; import { getTagDisplay, tagRender } from '../../../utils/TagsUtils'; import { showErrorToast } from '../../../utils/ToastUtils'; import TagsV1 from '../../Tag/TagsV1/TagsV1.component'; @@ -121,8 +122,7 @@ const AsyncSelectList: FC = ({ ); const tagOptions = useMemo(() => { - const newTags = options - .filter((tag) => !tag.label?.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`)) // To filter out Tier tags + const newTags = getTagsWithoutTier(options) // To filter out Tier tags .map((tag) => { const displayName = tag.data?.displayName; const parts = Fqn.split(tag.label); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx index 95f07a548ddf..ee0b777e2727 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx @@ -688,13 +688,13 @@ export const getEntityIdArray = (entities: EntityReference[]): string[] => export const getTagValue = (tag: string | TagLabel): string | TagLabel => { if (isString(tag)) { - return tag.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) + return tag.startsWith(`Tier${FQN_SEPARATOR_CHAR}`) ? tag.split(FQN_SEPARATOR_CHAR)[1] : tag; } else { return { ...tag, - tagFQN: tag.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) + tagFQN: tag.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}`) ? tag.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : tag.tagFQN, }; diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/EntityUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/EntityUtils.tsx index 49ab753ccd72..805c845c10ad 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/EntityUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/EntityUtils.tsx @@ -135,7 +135,7 @@ import { stringToHTML } from './StringsUtils'; import { getDataTypeString, getTagsWithoutTier, - getTierFromTableTags, + getTierTags, getUsagePercentile, } from './TableUtils'; import { getTableTags } from './TagsUtils'; @@ -217,7 +217,7 @@ const getTableFieldsFromTableDetails = (tableDetails: Table) => { const databaseDisplayName = getEntityName(database) || databaseName; const schemaDisplayName = getEntityName(databaseSchema) || schemaName; - const tier = getTierFromTableTags(tags ?? []); + const tier = getTierTags(tags ?? []); return { fullyQualifiedName, @@ -301,7 +301,7 @@ const getTableOverview = (tableDetails: Table) => { }, { name: i18next.t('label.tier'), - value: tier ? tier.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, + value: tier ? tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, isLink: false, visible: [DRAWER_NAVIGATION_OPTIONS.lineage], }, @@ -343,7 +343,7 @@ const getTableOverview = (tableDetails: Table) => { const getPipelineOverview = (pipelineDetails: Pipeline) => { const { owner, tags, sourceUrl, service, displayName } = pipelineDetails; - const tier = getTierFromTableTags(tags ?? []); + const tier = getTierTags(tags ?? []); const serviceDisplayName = getEntityName(service); const overview = [ @@ -381,7 +381,7 @@ const getPipelineOverview = (pipelineDetails: Pipeline) => { }, { name: i18next.t('label.tier'), - value: tier ? tier.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, + value: tier ? tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, isLink: false, visible: [DRAWER_NAVIGATION_OPTIONS.lineage], }, @@ -393,7 +393,7 @@ const getPipelineOverview = (pipelineDetails: Pipeline) => { const getDashboardOverview = (dashboardDetails: Dashboard) => { const { owner, tags, sourceUrl, service, displayName, project } = dashboardDetails; - const tier = getTierFromTableTags(tags ?? []); + const tier = getTierTags(tags ?? []); const serviceDisplayName = getEntityName(service); const overview = [ @@ -430,7 +430,7 @@ const getDashboardOverview = (dashboardDetails: Dashboard) => { }, { name: i18next.t('label.tier'), - value: tier ? tier.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, + value: tier ? tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, isLink: false, isExternal: false, visible: [DRAWER_NAVIGATION_OPTIONS.lineage], @@ -453,7 +453,7 @@ export const getSearchIndexOverview = ( searchIndexDetails: SearchIndexEntity ) => { const { owner, tags, service } = searchIndexDetails; - const tier = getTierFromTableTags(tags ?? []); + const tier = getTierTags(tags ?? []); const overview = [ { @@ -465,7 +465,7 @@ export const getSearchIndexOverview = ( }, { name: i18next.t('label.tier'), - value: tier ? tier.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, + value: tier ? tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, isLink: false, isExternal: false, visible: [DRAWER_NAVIGATION_OPTIONS.lineage], @@ -591,7 +591,7 @@ const getDataModelOverview = (dataModelDetails: DashboardDataModel) => { dataModelType, fullyQualifiedName, } = dataModelDetails; - const tier = getTierFromTableTags(tags ?? []); + const tier = getTierTags(tags ?? []); const overview = [ { @@ -633,7 +633,7 @@ const getDataModelOverview = (dataModelDetails: DashboardDataModel) => { { name: i18next.t('label.tier'), - value: tier ? tier.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, + value: tier ? tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, isLink: false, isExternal: false, visible: [ @@ -667,7 +667,7 @@ const getStoredProcedureOverview = ( FQN_SEPARATOR_CHAR ).split(FQN_SEPARATOR_CHAR); - const tier = getTierFromTableTags(tags ?? []); + const tier = getTierTags(tags ?? []); const overview = [ { @@ -717,7 +717,7 @@ const getStoredProcedureOverview = ( }, { name: i18next.t('label.tier'), - value: tier ? tier.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, + value: tier ? tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, isLink: false, visible: [ DRAWER_NAVIGATION_OPTIONS.lineage, @@ -747,7 +747,7 @@ const getStoredProcedureOverview = ( const getDatabaseOverview = (databaseDetails: Database) => { const { owner, service, tags, usageSummary } = databaseDetails; - const tier = getTierFromTableTags(tags ?? []); + const tier = getTierTags(tags ?? []); const overview = [ { @@ -760,7 +760,7 @@ const getDatabaseOverview = (databaseDetails: Database) => { { name: i18next.t('label.tier'), - value: tier ? tier.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, + value: tier ? tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, isLink: false, visible: [DRAWER_NAVIGATION_OPTIONS.explore], }, @@ -790,7 +790,7 @@ const getDatabaseSchemaOverview = (databaseSchemaDetails: DatabaseSchema) => { const { owner, service, tags, usageSummary, database } = databaseSchemaDetails; - const tier = getTierFromTableTags(tags ?? []); + const tier = getTierTags(tags ?? []); const overview = [ { @@ -803,7 +803,7 @@ const getDatabaseSchemaOverview = (databaseSchemaDetails: DatabaseSchema) => { { name: i18next.t('label.tier'), - value: tier ? tier.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, + value: tier ? tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, isLink: false, visible: [DRAWER_NAVIGATION_OPTIONS.explore], }, @@ -841,7 +841,7 @@ const getDatabaseSchemaOverview = (databaseSchemaDetails: DatabaseSchema) => { const getEntityServiceOverview = (serviceDetails: EntityServiceUnion) => { const { owner, tags, serviceType } = serviceDetails; - const tier = getTierFromTableTags(tags ?? []); + const tier = getTierTags(tags ?? []); const overview = [ { @@ -854,7 +854,7 @@ const getEntityServiceOverview = (serviceDetails: EntityServiceUnion) => { { name: i18next.t('label.tier'), - value: tier ? tier.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, + value: tier ? tier.tagFQN.split(FQN_SEPARATOR_CHAR)[1] : NO_DATA, isLink: false, visible: [DRAWER_NAVIGATION_OPTIONS.explore], }, diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx index 61f8f1e319b5..8220708f32aa 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx @@ -103,18 +103,6 @@ export const getUsagePercentile = (pctRank: number, isLiteral = false) => { return usagePercentile; }; -export const getTierFromTableTags = ( - tags: Array -): EntityTags['tagFQN'] => { - const tierTag = tags.find( - (item) => - item.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) && - !isNaN(parseInt(item.tagFQN.substring(9).trim())) - ); - - return tierTag?.tagFQN || ''; -}; - export const getTierTags = (tags: Array) => { const tierTag = tags.find((item) => item.tagFQN.startsWith(`Tier${FQN_SEPARATOR_CHAR}`) From 8a84a347e0b7b9186e506e770dcf1120ba057ae7 Mon Sep 17 00:00:00 2001 From: Chira Madlani Date: Thu, 27 Jun 2024 18:32:34 +0530 Subject: [PATCH 4/6] fix async select list loading issue --- .../src/components/common/AsyncSelectList/AsyncSelectList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/AsyncSelectList/AsyncSelectList.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/AsyncSelectList/AsyncSelectList.tsx index 80944d895674..2a36c2ee3751 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/AsyncSelectList/AsyncSelectList.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/AsyncSelectList/AsyncSelectList.tsx @@ -39,7 +39,6 @@ import { LabelType } from '../../../generated/entity/data/table'; import { Paging } from '../../../generated/type/paging'; import { TagLabel } from '../../../generated/type/tagLabel'; import Fqn from '../../../utils/Fqn'; -import { getTagsWithoutTier } from '../../../utils/TableUtils'; import { getTagDisplay, tagRender } from '../../../utils/TagsUtils'; import { showErrorToast } from '../../../utils/ToastUtils'; import TagsV1 from '../../Tag/TagsV1/TagsV1.component'; @@ -122,7 +121,8 @@ const AsyncSelectList: FC = ({ ); const tagOptions = useMemo(() => { - const newTags = getTagsWithoutTier(options) // To filter out Tier tags + const newTags = options + .filter((tag) => !tag.label?.startsWith(`Tier${FQN_SEPARATOR_CHAR}`)) // To filter out Tier tags .map((tag) => { const displayName = tag.data?.displayName; const parts = Fqn.split(tag.label); From 7565f0489a3220f8cba80f4cc510ca76caf12c6a Mon Sep 17 00:00:00 2001 From: Chira Madlani Date: Thu, 27 Jun 2024 20:49:24 +0530 Subject: [PATCH 5/6] address comments --- .../ui/playwright/support/tag/TagClass.ts | 44 ++++++++----------- .../main/resources/ui/playwright/utils/tag.ts | 4 +- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/support/tag/TagClass.ts b/openmetadata-ui/src/main/resources/ui/playwright/support/tag/TagClass.ts index 4c3fecaf51f6..c5aa76bbc287 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/support/tag/TagClass.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/support/tag/TagClass.ts @@ -15,15 +15,22 @@ import { visitClassificationPage } from '../../utils/tag'; import { getRandomLastName } from '../../utils/user'; type ResponseDataType = { - name: string; - displayName: string; + style?: { + color: string; + }; description: string; - reviewers: unknown[]; - relatedTerms: unknown[]; - synonyms: unknown[]; - mutuallyExclusive: boolean; - tags: unknown[]; - glossary: Record; + displayName: string; + classification: { + id: string; + type: 'classification'; + name: string; + fullyQualifiedName: string; + description: string; + displayName: string; + deleted: boolean; + href: string; + }; + name: string; id: string; fullyQualifiedName: string; }; @@ -57,7 +64,10 @@ export class TagClass { } async visitPage(page: Page) { - await visitClassificationPage(page, this.responseData.glossary.displayName); + await visitClassificationPage( + page, + this.responseData.classification.displayName + ); } async create(apiContext: APIRequestContext) { @@ -70,22 +80,6 @@ export class TagClass { return await response.json(); } - // async patch(apiContext: APIRequestContext, data: Record[]) { - // const response = await apiContext.patch( - // `/api/v1/glossaryTerms/${this.responseData.id}`, - // { - // data, - // headers: { - // 'Content-Type': 'application/json-patch+json', - // }, - // } - // ); - - // this.responseData = await response.json(); - - // return await response.json(); - // } - get() { return this.responseData; } diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts index b81227d0f4bc..6b50234dd009 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts @@ -20,8 +20,8 @@ export const visitClassificationPage = async ( classificationName: string ) => { await redirectToHomePage(page); - const glossaryResponse = page.waitForResponse('/api/v1/glossaries?fields=*'); - await sidebarClick(page, SidebarItem.GLOSSARY); + const glossaryResponse = page.waitForResponse('/api/v1/classifications?**'); + await sidebarClick(page, SidebarItem.TAGS); await glossaryResponse; await page.getByRole('menuitem', { name: classificationName }).click(); }; From 0782268821fb6f545ebe14321f9edb6a0decee75 Mon Sep 17 00:00:00 2001 From: Chira Madlani Date: Thu, 27 Jun 2024 21:45:40 +0530 Subject: [PATCH 6/6] update variable --- .../src/main/resources/ui/playwright/utils/tag.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts index 6b50234dd009..6d5e32682f16 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts @@ -20,8 +20,10 @@ export const visitClassificationPage = async ( classificationName: string ) => { await redirectToHomePage(page); - const glossaryResponse = page.waitForResponse('/api/v1/classifications?**'); + const classificationResponse = page.waitForResponse( + '/api/v1/classifications?**' + ); await sidebarClick(page, SidebarItem.TAGS); - await glossaryResponse; + await classificationResponse; await page.getByRole('menuitem', { name: classificationName }).click(); };