fix the glossary terms not showing when expand click (#16239)

* fix the glossary terms not showing when expand click

* supported cypress to check term after click on expand icon of term
This commit is contained in:
Ashish Gupta 2024-05-13 18:44:41 +05:30 committed by GitHub
parent db3bff19af
commit 1ca86f8889
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 9 deletions

View File

@ -1318,8 +1318,14 @@ describe('Glossary page should work properly', { tags: 'Governance' }, () => {
NEW_GLOSSARY_TERMS.term_2.name, NEW_GLOSSARY_TERMS.term_2.name,
NEW_GLOSSARY_TERMS.term_1.name NEW_GLOSSARY_TERMS.term_1.name
); );
// verify the term is moved under the parent term
cy.get('[data-testid="expand-collapse-all-button"]').click(); // clicking on the expand icon to view the child term
cy.get(
`[data-row-key=${Cypress.$.escapeSelector(
NEW_GLOSSARY_TERMS.term_1.fullyQualifiedName
)}] [data-testid="expand-icon"] > svg`
).click();
cy.get( cy.get(
`.ant-table-row-level-1[data-row-key="${Cypress.$.escapeSelector( `.ant-table-row-level-1[data-row-key="${Cypress.$.escapeSelector(
NEW_GLOSSARY_TERMS.term_1.fullyQualifiedName NEW_GLOSSARY_TERMS.term_1.fullyQualifiedName

View File

@ -188,7 +188,8 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
...searchOptions, ...searchOptions,
...(initialOptions ?? []), ...(initialOptions ?? []),
] as ModifiedGlossaryTerm[], ] as ModifiedGlossaryTerm[],
value value,
false
); );
return initialData return initialData

View File

@ -148,17 +148,23 @@ export const getGlossaryBreadcrumbs = (fqn: string) => {
return breadcrumbList; return breadcrumbList;
}; };
// This function finds and gives you the glossary term you're looking for.
// You can then use this term or update its information in the Glossary or Term with it's reference created
// Reference will only be created if withReference is true
export const findGlossaryTermByFqn = ( export const findGlossaryTermByFqn = (
list: ModifiedGlossaryTerm[], list: ModifiedGlossaryTerm[],
fullyQualifiedName: string fullyQualifiedName: string,
withReference = true
): GlossaryTerm | Glossary | ModifiedGlossary | null => { ): GlossaryTerm | Glossary | ModifiedGlossary | null => {
for (const item of list) { for (const item of list) {
if ((item.fullyQualifiedName ?? item.value) === fullyQualifiedName) { if ((item.fullyQualifiedName ?? item.value) === fullyQualifiedName) {
return { return withReference
...item, ? item
fullyQualifiedName: item.fullyQualifiedName ?? item.data?.tagFQN, : {
...(item.data ?? {}), ...item,
}; fullyQualifiedName: item.fullyQualifiedName ?? item.data?.tagFQN,
...(item.data ?? {}),
};
} }
if (item.children) { if (item.children) {
const found = findGlossaryTermByFqn( const found = findGlossaryTermByFqn(