mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-06 23:52:29 +00:00
fix: glossary term incorrect relationship (#12426)
* fix: glossary term incorrect relationship * revert tier changes
This commit is contained in:
parent
4c63398736
commit
d8e64b4f30
@ -11,6 +11,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable max-len */
|
||||
import { OperationPermission } from 'components/PermissionProvider/PermissionProvider.interface';
|
||||
import { ProviderType, Status } from '../generated/entity/data/glossaryTerm';
|
||||
|
||||
@ -451,6 +452,7 @@ export const MOCKED_GLOSSARY_TERMS = [
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.1,
|
||||
type: 'glossaryTerm',
|
||||
updatedAt: 1682348752125,
|
||||
updatedBy: 'karan',
|
||||
reviewers: [],
|
||||
@ -610,13 +612,14 @@ export const MOCKED_GLOSSARY_TERMS_TREE = [
|
||||
name: 'karan',
|
||||
type: 'user',
|
||||
},
|
||||
provider: 'user',
|
||||
provider: ProviderType.User,
|
||||
references: [],
|
||||
relatedTerms: [],
|
||||
reviewers: [],
|
||||
status: 'Draft',
|
||||
status: 'Draft' as Status,
|
||||
synonyms: [],
|
||||
tags: [],
|
||||
type: 'glossaryTerm',
|
||||
updatedAt: 1682348752125,
|
||||
updatedBy: 'karan',
|
||||
version: 0.1,
|
||||
@ -658,7 +661,7 @@ export const MOCKED_GLOSSARY_TERMS_TREE = [
|
||||
name: 'Mobiles',
|
||||
type: 'glossaryTerm',
|
||||
},
|
||||
provider: 'user',
|
||||
provider: ProviderType.User,
|
||||
references: [{ endpoint: 'https://www.google.com', name: 'google' }],
|
||||
relatedTerms: [
|
||||
{
|
||||
@ -672,9 +675,10 @@ export const MOCKED_GLOSSARY_TERMS_TREE = [
|
||||
},
|
||||
],
|
||||
reviewers: [],
|
||||
status: 'Draft',
|
||||
status: 'Draft' as Status,
|
||||
synonyms: ['accessory'],
|
||||
tags: [],
|
||||
type: 'glossaryTerm',
|
||||
updatedAt: 1682348835466,
|
||||
updatedBy: 'karan',
|
||||
version: 0.4,
|
||||
@ -704,11 +708,11 @@ export const MOCKED_GLOSSARY_TERMS_TREE = [
|
||||
name: 'karan',
|
||||
type: 'user',
|
||||
},
|
||||
provider: 'user',
|
||||
provider: ProviderType.User,
|
||||
references: [{ endpoint: 'https://www.google.com', name: 'google' }],
|
||||
relatedTerms: [],
|
||||
reviewers: [],
|
||||
status: 'Draft',
|
||||
status: 'Draft' as Status,
|
||||
synonyms: ['accessory'],
|
||||
tags: [],
|
||||
updatedAt: 1682348731309,
|
||||
@ -717,6 +721,548 @@ export const MOCKED_GLOSSARY_TERMS_TREE = [
|
||||
},
|
||||
];
|
||||
|
||||
export const MOCKED_GLOSSARY_TERMS_1 = [
|
||||
{
|
||||
id: 'e01f0674-4963-43d9-a9eb-0967c63e1385',
|
||||
name: 'A_bg1',
|
||||
displayName: '',
|
||||
description: 'fsff',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.BG1.A_bg1',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
parent: {
|
||||
id: 'd88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
type: 'glossaryTerm',
|
||||
name: 'BG1',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.BG1',
|
||||
description: 'fsff',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/d88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
},
|
||||
children: [],
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.1,
|
||||
updatedAt: 1689250053292,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/e01f0674-4963-43d9-a9eb-0967c63e1385',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
},
|
||||
{
|
||||
id: '0471d1f3-d0c8-49b6-a7ee-6ef3a716a6a3',
|
||||
name: 'A_start',
|
||||
displayName: '',
|
||||
description: 'fsggs',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.A_start',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
parent: {
|
||||
id: '50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
type: 'glossaryTerm',
|
||||
name: 'Term2f',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f',
|
||||
description: 'afa',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
},
|
||||
children: [],
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.1,
|
||||
updatedAt: 1689250037364,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/0471d1f3-d0c8-49b6-a7ee-6ef3a716a6a3',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
},
|
||||
{
|
||||
id: 'd88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
name: 'BG1',
|
||||
displayName: '',
|
||||
description: 'fsff',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.BG1',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
parent: {
|
||||
id: '50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
type: 'glossaryTerm',
|
||||
name: 'Term2f',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f',
|
||||
description: 'afa',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: 'e01f0674-4963-43d9-a9eb-0967c63e1385',
|
||||
type: 'glossaryTerm',
|
||||
name: 'A_bg1',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.BG1.A_bg1',
|
||||
description: 'fsff',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/e01f0674-4963-43d9-a9eb-0967c63e1385',
|
||||
},
|
||||
],
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.2,
|
||||
updatedAt: 1689247414058,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/d88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
changeDescription: {
|
||||
fieldsAdded: [],
|
||||
fieldsUpdated: [
|
||||
{
|
||||
name: 'parent',
|
||||
oldValue:
|
||||
'{"id":"4242d926-8b80-4b03-9dbe-ab7138c45494","type":"glossaryTerm","name":"Term1","fullyQualifiedName":"Banking.Term1","description":"test","displayName":"","deleted":false}',
|
||||
newValue:
|
||||
'{"id":"50f1f9ab-50f2-45c5-a1b8-06aa03ece34a","type":"glossaryTerm","name":"Term2f","fullyQualifiedName":"Banking.Term1.Term2f","description":"afa","displayName":"","deleted":false}',
|
||||
},
|
||||
],
|
||||
fieldsDeleted: [],
|
||||
previousVersion: 0.1,
|
||||
},
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
},
|
||||
{
|
||||
id: '4242d926-8b80-4b03-9dbe-ab7138c45494',
|
||||
name: 'Term1',
|
||||
displayName: '',
|
||||
description: 'test',
|
||||
fullyQualifiedName: 'Banking.Term1',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: '50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
type: 'glossaryTerm',
|
||||
name: 'Term2f',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f',
|
||||
description: 'afa',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
},
|
||||
],
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.1,
|
||||
updatedAt: 1689247367690,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/4242d926-8b80-4b03-9dbe-ab7138c45494',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
},
|
||||
{
|
||||
id: '50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
name: 'Term2f',
|
||||
displayName: '',
|
||||
description: 'afa',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
parent: {
|
||||
id: '4242d926-8b80-4b03-9dbe-ab7138c45494',
|
||||
type: 'glossaryTerm',
|
||||
name: 'Term1',
|
||||
fullyQualifiedName: 'Banking.Term1',
|
||||
description: 'test',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/4242d926-8b80-4b03-9dbe-ab7138c45494',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: '0471d1f3-d0c8-49b6-a7ee-6ef3a716a6a3',
|
||||
type: 'glossaryTerm',
|
||||
name: 'A_start',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.A_start',
|
||||
description: 'fsggs',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/0471d1f3-d0c8-49b6-a7ee-6ef3a716a6a3',
|
||||
},
|
||||
{
|
||||
id: 'd88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
type: 'glossaryTerm',
|
||||
name: 'BG1',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.BG1',
|
||||
description: 'fsff',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/d88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
},
|
||||
],
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.1,
|
||||
updatedAt: 1689247376963,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
},
|
||||
];
|
||||
|
||||
export const MOCKED_GLOSSARY_TERMS_TREE_1 = [
|
||||
{
|
||||
id: '4242d926-8b80-4b03-9dbe-ab7138c45494',
|
||||
name: 'Term1',
|
||||
displayName: '',
|
||||
description: 'test',
|
||||
fullyQualifiedName: 'Banking.Term1',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: '50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
name: 'Term2f',
|
||||
displayName: '',
|
||||
description: 'afa',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
parent: {
|
||||
id: '4242d926-8b80-4b03-9dbe-ab7138c45494',
|
||||
type: 'glossaryTerm',
|
||||
name: 'Term1',
|
||||
fullyQualifiedName: 'Banking.Term1',
|
||||
description: 'test',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/4242d926-8b80-4b03-9dbe-ab7138c45494',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: '0471d1f3-d0c8-49b6-a7ee-6ef3a716a6a3',
|
||||
name: 'A_start',
|
||||
displayName: '',
|
||||
description: 'fsggs',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.A_start',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
parent: {
|
||||
id: '50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
type: 'glossaryTerm',
|
||||
name: 'Term2f',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f',
|
||||
description: 'afa',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
},
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.1,
|
||||
updatedAt: 1689250037364,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/0471d1f3-d0c8-49b6-a7ee-6ef3a716a6a3',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
type: 'glossaryTerm',
|
||||
},
|
||||
{
|
||||
id: 'd88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
name: 'BG1',
|
||||
displayName: '',
|
||||
description: 'fsff',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.BG1',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
parent: {
|
||||
id: '50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
type: 'glossaryTerm',
|
||||
name: 'Term2f',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f',
|
||||
description: 'afa',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: 'e01f0674-4963-43d9-a9eb-0967c63e1385',
|
||||
name: 'A_bg1',
|
||||
displayName: '',
|
||||
description: 'fsff',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.BG1.A_bg1',
|
||||
synonyms: [],
|
||||
glossary: {
|
||||
id: '36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
type: 'glossary',
|
||||
name: 'Banking',
|
||||
fullyQualifiedName: 'Banking',
|
||||
description: 'Test',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaries/36b9b2b0-e031-4aff-93f3-5e01996cd85e',
|
||||
},
|
||||
parent: {
|
||||
id: 'd88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
type: 'glossaryTerm',
|
||||
name: 'BG1',
|
||||
fullyQualifiedName: 'Banking.Term1.Term2f.BG1',
|
||||
description: 'fsff',
|
||||
displayName: '',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/d88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
},
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.1,
|
||||
updatedAt: 1689250053292,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/e01f0674-4963-43d9-a9eb-0967c63e1385',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
type: 'glossaryTerm',
|
||||
},
|
||||
],
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.2,
|
||||
updatedAt: 1689247414058,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/d88adce6-4cc3-4088-b436-4630c87307f0',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
changeDescription: {
|
||||
fieldsAdded: [],
|
||||
fieldsUpdated: [
|
||||
{
|
||||
name: 'parent',
|
||||
oldValue:
|
||||
'{"id":"4242d926-8b80-4b03-9dbe-ab7138c45494","type":"glossaryTerm","name":"Term1","fullyQualifiedName":"Banking.Term1","description":"test","displayName":"","deleted":false}',
|
||||
newValue:
|
||||
'{"id":"50f1f9ab-50f2-45c5-a1b8-06aa03ece34a","type":"glossaryTerm","name":"Term2f","fullyQualifiedName":"Banking.Term1.Term2f","description":"afa","displayName":"","deleted":false}',
|
||||
},
|
||||
],
|
||||
fieldsDeleted: [],
|
||||
previousVersion: 0.1,
|
||||
},
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
type: 'glossaryTerm',
|
||||
},
|
||||
],
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.1,
|
||||
updatedAt: 1689247376963,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/50f1f9ab-50f2-45c5-a1b8-06aa03ece34a',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
type: 'glossaryTerm',
|
||||
},
|
||||
],
|
||||
relatedTerms: [],
|
||||
references: [],
|
||||
version: 0.1,
|
||||
updatedAt: 1689247367690,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://localhost:8585/api/v1/glossaryTerms/4242d926-8b80-4b03-9dbe-ab7138c45494',
|
||||
reviewers: [],
|
||||
owner: {
|
||||
id: '6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
type: 'user',
|
||||
name: 'admin',
|
||||
fullyQualifiedName: 'admin',
|
||||
deleted: false,
|
||||
href: 'http://localhost:8585/api/v1/users/6c5e77d7-8e4f-4f0e-a746-477702901997',
|
||||
},
|
||||
tags: [],
|
||||
status: 'Draft' as Status,
|
||||
deleted: false,
|
||||
provider: ProviderType.User,
|
||||
mutuallyExclusive: false,
|
||||
},
|
||||
];
|
||||
|
||||
export const MOCK_CSV_GLOSSARY_DATA = {
|
||||
rowData: [
|
||||
[
|
||||
|
@ -12,7 +12,9 @@
|
||||
*/
|
||||
import {
|
||||
MOCKED_GLOSSARY_TERMS,
|
||||
MOCKED_GLOSSARY_TERMS_1,
|
||||
MOCKED_GLOSSARY_TERMS_TREE,
|
||||
MOCKED_GLOSSARY_TERMS_TREE_1,
|
||||
} from 'mocks/Glossary.mock';
|
||||
import {
|
||||
buildTree,
|
||||
@ -58,6 +60,12 @@ describe('Glossary Utils', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should build the tree correctly when the terms with empty children are received as initial items in array', () => {
|
||||
expect(buildTree(MOCKED_GLOSSARY_TERMS_1)).toEqual(
|
||||
MOCKED_GLOSSARY_TERMS_TREE_1
|
||||
);
|
||||
});
|
||||
|
||||
it('formatRelatedTermOptions - should format related term options correctly', () => {
|
||||
const data = [
|
||||
{ id: 'term1', displayName: 'Term One', type: 'glossaryTerm' },
|
||||
|
@ -110,34 +110,26 @@ export const getRootLevelGlossaryTerm = (
|
||||
|
||||
export const buildTree = (data: GlossaryTerm[]): GlossaryTerm[] => {
|
||||
const nodes: Record<string, GlossaryTerm> = {};
|
||||
const tree: GlossaryTerm[] = [];
|
||||
|
||||
// Sorting children having parent first to avoid duplicates
|
||||
const sortedData = [...data].sort((a, b) => {
|
||||
if (a.parent && !b.parent) {
|
||||
return 1;
|
||||
} else if (!a.parent && b.parent) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
// Create nodes first
|
||||
data.forEach((obj) => {
|
||||
nodes[obj.fullyQualifiedName ?? ''] = {
|
||||
...obj,
|
||||
children: obj.children?.length ? [] : undefined,
|
||||
};
|
||||
});
|
||||
|
||||
sortedData.forEach((obj) => {
|
||||
if (obj.fullyQualifiedName) {
|
||||
nodes[obj.fullyQualifiedName] = {
|
||||
...obj,
|
||||
children: obj.children?.length ? [] : undefined,
|
||||
};
|
||||
const parentNode =
|
||||
obj.parent?.fullyQualifiedName && nodes[obj.parent.fullyQualifiedName];
|
||||
// Build the tree structure
|
||||
const tree: GlossaryTerm[] = [];
|
||||
data.forEach((obj) => {
|
||||
const current = nodes[obj.fullyQualifiedName ?? ''];
|
||||
const parent = nodes[obj.parent?.fullyQualifiedName || ''];
|
||||
|
||||
parentNode &&
|
||||
nodes[obj.fullyQualifiedName] &&
|
||||
parentNode.children?.push(
|
||||
nodes[obj.fullyQualifiedName] as unknown as EntityReference
|
||||
);
|
||||
parentNode ? null : tree.push(nodes[obj.fullyQualifiedName]);
|
||||
if (parent && parent.children) {
|
||||
// converting glossaryTerm to EntityReference
|
||||
parent.children.push({ ...current, type: 'glossaryTerm' });
|
||||
} else {
|
||||
tree.push(current);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user