mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 10:39:30 +00:00 
			
		
		
		
	fix(ui): displayName as optional field (#11685)
* fix(ui): displayName as optional field * fix cypress * fix cypress * fixed cypress * fix glossary spec --------- Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com>
This commit is contained in:
		
							parent
							
								
									cf603812fd
								
							
						
					
					
						commit
						cd464c4272
					
				| @ -359,7 +359,7 @@ export const deleteCreatedService = ( | |||||||
|     .should('be.visible') |     .should('be.visible') | ||||||
|     .click(); |     .click(); | ||||||
| 
 | 
 | ||||||
|   cy.get(`[data-testid="entity-header-name"]`) |   cy.get(`[data-testid="entity-header-display-name"]`) | ||||||
|     .should('exist') |     .should('exist') | ||||||
|     .should('be.visible') |     .should('be.visible') | ||||||
|     .invoke('text') |     .invoke('text') | ||||||
|  | |||||||
| @ -38,7 +38,7 @@ export const visitServiceDetailsPage = (service, verifyHeader = true) => { | |||||||
|     .click(); |     .click(); | ||||||
| 
 | 
 | ||||||
|   if (verifyHeader) { |   if (verifyHeader) { | ||||||
|     cy.get(`[data-testid="entity-header-name"]`) |     cy.get(`[data-testid="entity-header-display-name"]`) | ||||||
|       .should('exist') |       .should('exist') | ||||||
|       .should('be.visible') |       .should('be.visible') | ||||||
|       .invoke('text') |       .invoke('text') | ||||||
|  | |||||||
| @ -43,8 +43,6 @@ const updateDisplayName = (displayName, apiPath) => { | |||||||
|   cy.get('#name').should('be.visible').should('be.disabled'); |   cy.get('#name').should('be.visible').should('be.disabled'); | ||||||
|   cy.get('#displayName').should('be.visible').should('not.be.disabled').clear(); |   cy.get('#displayName').should('be.visible').should('not.be.disabled').clear(); | ||||||
|   cy.get('.ant-modal-footer').should('contain', 'Cancel'); |   cy.get('.ant-modal-footer').should('contain', 'Cancel'); | ||||||
|   cy.get('[data-testid="save-button"]').should('be.visible').click(); |  | ||||||
|   cy.get('.ant-modal-body').should('contain', 'Display Name is required'); |  | ||||||
|   cy.get('#displayName').type(displayName); |   cy.get('#displayName').type(displayName); | ||||||
|   cy.get('[data-testid="save-button"]').should('be.visible').click(); |   cy.get('[data-testid="save-button"]').should('be.visible').click(); | ||||||
| 
 | 
 | ||||||
| @ -588,7 +588,7 @@ describe('Data Quality and Profiler should work properly', () => { | |||||||
|     const { term, entity, serviceName, testCaseName } = |     const { term, entity, serviceName, testCaseName } = | ||||||
|       DATA_QUALITY_SAMPLE_DATA_TABLE; |       DATA_QUALITY_SAMPLE_DATA_TABLE; | ||||||
|     visitEntityDetailsPage(term, serviceName, entity); |     visitEntityDetailsPage(term, serviceName, entity); | ||||||
|     cy.get('[data-testid="entity-header-name"]') |     cy.get('[data-testid="entity-header-display-name"]') | ||||||
|       .should('be.visible') |       .should('be.visible') | ||||||
|       .contains(term); |       .contains(term); | ||||||
|     cy.get('[data-testid="Profiler & Data Quality"]') |     cy.get('[data-testid="Profiler & Data Quality"]') | ||||||
| @ -643,7 +643,7 @@ describe('Data Quality and Profiler should work properly', () => { | |||||||
|     ); |     ); | ||||||
|     visitEntityDetailsPage(term, serviceName, entity); |     visitEntityDetailsPage(term, serviceName, entity); | ||||||
|     verifyResponseStatusCode('@waitForPageLoad', 200); |     verifyResponseStatusCode('@waitForPageLoad', 200); | ||||||
|     cy.get('[data-testid="entity-header-name"]') |     cy.get('[data-testid="entity-header-display-name"]') | ||||||
|       .should('be.visible') |       .should('be.visible') | ||||||
|       .contains(term); |       .contains(term); | ||||||
|     cy.get('[data-testid="Profiler & Data Quality"]') |     cy.get('[data-testid="Profiler & Data Quality"]') | ||||||
|  | |||||||
| @ -386,14 +386,12 @@ describe('Glossary page should work properly', () => { | |||||||
|     cy.wait('@createGlossary').then(({ request }) => { |     cy.wait('@createGlossary').then(({ request }) => { | ||||||
|       expect(request.body).to.have.all.keys( |       expect(request.body).to.have.all.keys( | ||||||
|         'description', |         'description', | ||||||
|         'displayName', |  | ||||||
|         'mutuallyExclusive', |         'mutuallyExclusive', | ||||||
|         'name', |         'name', | ||||||
|         'owner', |         'owner', | ||||||
|         'reviewers', |         'reviewers', | ||||||
|         'tags' |         'tags' | ||||||
|       ); |       ); | ||||||
|       expect(request.body.displayName).equals(NEW_GLOSSARY.name); |  | ||||||
|       expect(request.body.name).equals(NEW_GLOSSARY.name); |       expect(request.body.name).equals(NEW_GLOSSARY.name); | ||||||
|       expect(request.body.description).equals(NEW_GLOSSARY.description); |       expect(request.body.description).equals(NEW_GLOSSARY.description); | ||||||
|       expect(request.body.mutuallyExclusive).equals(true); |       expect(request.body.mutuallyExclusive).equals(true); | ||||||
| @ -430,14 +428,14 @@ describe('Glossary page should work properly', () => { | |||||||
|     cy.wait('@createGlossary').then(({ request }) => { |     cy.wait('@createGlossary').then(({ request }) => { | ||||||
|       expect(request.body).to.have.all.keys( |       expect(request.body).to.have.all.keys( | ||||||
|         'description', |         'description', | ||||||
|         'displayName', | 
 | ||||||
|         'mutuallyExclusive', |         'mutuallyExclusive', | ||||||
|         'name', |         'name', | ||||||
|         'owner', |         'owner', | ||||||
|         'reviewers', |         'reviewers', | ||||||
|         'tags' |         'tags' | ||||||
|       ); |       ); | ||||||
|       expect(request.body.displayName).equals(NEW_GLOSSARY_1.name); | 
 | ||||||
|       expect(request.body.name).equals(NEW_GLOSSARY_1.name); |       expect(request.body.name).equals(NEW_GLOSSARY_1.name); | ||||||
|       expect(request.body.description).equals(NEW_GLOSSARY_1.description); |       expect(request.body.description).equals(NEW_GLOSSARY_1.description); | ||||||
|       expect(request.body.mutuallyExclusive).equals(false); |       expect(request.body.mutuallyExclusive).equals(false); | ||||||
|  | |||||||
| @ -66,7 +66,7 @@ const AddGlossary = ({ | |||||||
|     }; |     }; | ||||||
|     const data: CreateGlossary = { |     const data: CreateGlossary = { | ||||||
|       name: name.trim(), |       name: name.trim(), | ||||||
|       displayName: (displayName || name).trim(), |       displayName: displayName?.trim(), | ||||||
|       description: description, |       description: description, | ||||||
|       reviewers: |       reviewers: | ||||||
|         reviewer.map((d) => toString(d.fullyQualifiedName)).filter(Boolean) ?? |         reviewer.map((d) => toString(d.fullyQualifiedName)).filter(Boolean) ?? | ||||||
|  | |||||||
| @ -122,7 +122,7 @@ const AddGlossaryTermForm = ({ | |||||||
| 
 | 
 | ||||||
|     const data = { |     const data = { | ||||||
|       name: name.trim(), |       name: name.trim(), | ||||||
|       displayName: (displayName || name).trim(), |       displayName: displayName?.trim(), | ||||||
|       description: description, |       description: description, | ||||||
|       reviewers: reviewer, |       reviewers: reviewer, | ||||||
|       relatedTerms: updatedTerms.length > 0 ? updatedTerms : undefined, |       relatedTerms: updatedTerms.length > 0 ? updatedTerms : undefined, | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ import TitleBreadcrumb from 'components/common/title-breadcrumb/title-breadcrumb | |||||||
| import { TitleBreadcrumbProps } from 'components/common/title-breadcrumb/title-breadcrumb.interface'; | import { TitleBreadcrumbProps } from 'components/common/title-breadcrumb/title-breadcrumb.interface'; | ||||||
| import { EntityType } from 'enums/entity.enum'; | import { EntityType } from 'enums/entity.enum'; | ||||||
| import React, { ReactNode } from 'react'; | import React, { ReactNode } from 'react'; | ||||||
| import { getEntityLinkFromType, getEntityName } from 'utils/EntityUtils'; | import { getEntityLinkFromType } from 'utils/EntityUtils'; | ||||||
| import { getEncodedFqn } from 'utils/StringsUtils'; | import { getEncodedFqn } from 'utils/StringsUtils'; | ||||||
| import EntityHeaderTitle from '../EntityHeaderTitle/EntityHeaderTitle.component'; | import EntityHeaderTitle from '../EntityHeaderTitle/EntityHeaderTitle.component'; | ||||||
| 
 | 
 | ||||||
| @ -59,7 +59,7 @@ export const EntityHeader = ({ | |||||||
| 
 | 
 | ||||||
|       <EntityHeaderTitle |       <EntityHeaderTitle | ||||||
|         deleted={entityData.deleted} |         deleted={entityData.deleted} | ||||||
|         displayName={getEntityName(entityData)} |         displayName={entityData.displayName} | ||||||
|         icon={icon} |         icon={icon} | ||||||
|         link={ |         link={ | ||||||
|           titleIsLink && entityData.fullyQualifiedName && entityType |           titleIsLink && entityData.fullyQualifiedName && entityType | ||||||
|  | |||||||
| @ -14,6 +14,7 @@ import { ExclamationCircleFilled } from '@ant-design/icons'; | |||||||
| import { Col, Row, Typography } from 'antd'; | import { Col, Row, Typography } from 'antd'; | ||||||
| import { ReactComponent as IconExternalLink } from 'assets/svg/external-link-grey.svg'; | import { ReactComponent as IconExternalLink } from 'assets/svg/external-link-grey.svg'; | ||||||
| import { ROUTES } from 'constants/constants'; | import { ROUTES } from 'constants/constants'; | ||||||
|  | import { isEmpty } from 'lodash'; | ||||||
| import React, { useMemo } from 'react'; | import React, { useMemo } from 'react'; | ||||||
| import { useTranslation } from 'react-i18next'; | import { useTranslation } from 'react-i18next'; | ||||||
| import { Link, useLocation } from 'react-router-dom'; | import { Link, useLocation } from 'react-router-dom'; | ||||||
| @ -46,17 +47,21 @@ const EntityHeaderTitle = ({ | |||||||
|       wrap={false}> |       wrap={false}> | ||||||
|       <Col>{icon}</Col> |       <Col>{icon}</Col> | ||||||
|       <Col className={deleted || badge ? 'w-max-full-140' : 'w-max-full-45'}> |       <Col className={deleted || badge ? 'w-max-full-140' : 'w-max-full-45'}> | ||||||
|         <Typography.Text |         {/* If we do not have displayName name only be shown in the bold from the below code */} | ||||||
|           className="m-b-0 d-block text-grey-muted text-md font-medium" |         {!isEmpty(displayName) ? ( | ||||||
|           data-testid="entity-header-name"> |           <Typography.Text | ||||||
|           {stringToHTML(name)} |             className="m-b-0 d-block text-grey-muted text-md font-medium" | ||||||
|         </Typography.Text> |             data-testid="entity-header-name"> | ||||||
|  |             {stringToHTML(name)} | ||||||
|  |           </Typography.Text> | ||||||
|  |         ) : null} | ||||||
| 
 | 
 | ||||||
|  |         {/* It will render displayName fallback to name */} | ||||||
|         <Typography.Text |         <Typography.Text | ||||||
|           className="m-b-0 d-block entity-header-display-name text-lg font-bold" |           className="m-b-0 d-block entity-header-display-name text-lg font-bold" | ||||||
|           data-testid="entity-header-display-name" |           data-testid="entity-header-display-name" | ||||||
|           ellipsis={{ tooltip: true }}> |           ellipsis={{ tooltip: true }}> | ||||||
|           {stringToHTML(displayName ?? name)} |           {stringToHTML(displayName || name)} | ||||||
|           {openEntityInNewPage && ( |           {openEntityInNewPage && ( | ||||||
|             <IconExternalLink |             <IconExternalLink | ||||||
|               className="anticon vertical-baseline m-l-xss" |               className="anticon vertical-baseline m-l-xss" | ||||||
| @ -67,14 +72,14 @@ const EntityHeaderTitle = ({ | |||||||
|         </Typography.Text> |         </Typography.Text> | ||||||
|       </Col> |       </Col> | ||||||
|       {deleted && ( |       {deleted && ( | ||||||
|         <Col className="self-end text-xs"> |         <Col className="text-xs"> | ||||||
|           <div className="deleted-badge-button" data-testid="deleted-badge"> |           <div className="deleted-badge-button" data-testid="deleted-badge"> | ||||||
|             <ExclamationCircleFilled className="m-r-xss font-medium text-xs" /> |             <ExclamationCircleFilled className="m-r-xss font-medium text-xs" /> | ||||||
|             {t('label.deleted')} |             {t('label.deleted')} | ||||||
|           </div> |           </div> | ||||||
|         </Col> |         </Col> | ||||||
|       )} |       )} | ||||||
|       {badge && <Col className="self-end">{badge}</Col>} |       {badge && <Col>{badge}</Col>} | ||||||
|     </Row> |     </Row> | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ | |||||||
| export interface EntityHeaderTitleProps { | export interface EntityHeaderTitleProps { | ||||||
|   icon: React.ReactNode; |   icon: React.ReactNode; | ||||||
|   name: string; |   name: string; | ||||||
|   displayName: string; |   displayName?: string; | ||||||
|   link?: string; |   link?: string; | ||||||
|   openEntityInNewPage?: boolean; |   openEntityInNewPage?: boolean; | ||||||
|   deleted?: boolean; |   deleted?: boolean; | ||||||
|  | |||||||
| @ -18,10 +18,11 @@ import { ReactComponent as IconFlatDoc } from 'assets/svg/ic-flat-doc.svg'; | |||||||
| import TagButton from 'components/TagButton/TagButton.component'; | import TagButton from 'components/TagButton/TagButton.component'; | ||||||
| import { NO_PERMISSION_FOR_ACTION } from 'constants/HelperTextUtil'; | import { NO_PERMISSION_FOR_ACTION } from 'constants/HelperTextUtil'; | ||||||
| import { t } from 'i18next'; | import { t } from 'i18next'; | ||||||
| import { cloneDeep, debounce, includes, toString } from 'lodash'; | import { cloneDeep, debounce, includes } from 'lodash'; | ||||||
| import React, { useCallback, useEffect, useState } from 'react'; | import React, { useCallback, useEffect, useState } from 'react'; | ||||||
| import { useHistory } from 'react-router-dom'; | import { useHistory } from 'react-router-dom'; | ||||||
| import { searchData } from 'rest/miscAPI'; | import { searchData } from 'rest/miscAPI'; | ||||||
|  | import { getEntityName } from 'utils/EntityUtils'; | ||||||
| import { getGlossaryPath } from 'utils/RouterUtils'; | import { getGlossaryPath } from 'utils/RouterUtils'; | ||||||
| import { ReactComponent as PlusIcon } from '../../../assets/svg/plus-primary.svg'; | import { ReactComponent as PlusIcon } from '../../../assets/svg/plus-primary.svg'; | ||||||
| import { | import { | ||||||
| @ -178,7 +179,7 @@ const RelatedTerms = ({ | |||||||
|               className="cursor-pointer" |               className="cursor-pointer" | ||||||
|               icon={<IconFlatDoc height={12} name="folder" />} |               icon={<IconFlatDoc height={12} name="folder" />} | ||||||
|               key={entity.fullyQualifiedName} |               key={entity.fullyQualifiedName} | ||||||
|               label={toString(entity.displayName)} |               label={getEntityName(entity)} | ||||||
|               tooltip={ |               tooltip={ | ||||||
|                 <div className="p-xss"> |                 <div className="p-xss"> | ||||||
|                   <strong>{entity.fullyQualifiedName}</strong> |                   <strong>{entity.fullyQualifiedName}</strong> | ||||||
|  | |||||||
| @ -85,17 +85,7 @@ const EntityNameModal: React.FC<EntityNameModalProps> = ({ | |||||||
|             })} |             })} | ||||||
|           /> |           /> | ||||||
|         </Form.Item> |         </Form.Item> | ||||||
|         <Form.Item |         <Form.Item label={t('label.display-name')} name="displayName"> | ||||||
|           label={t('label.display-name')} |  | ||||||
|           name="displayName" |  | ||||||
|           rules={[ |  | ||||||
|             { |  | ||||||
|               required: true, |  | ||||||
|               message: `${t('label.field-required', { |  | ||||||
|                 field: t('label.display-name'), |  | ||||||
|               })}`,
 |  | ||||||
|             }, |  | ||||||
|           ]}> |  | ||||||
|           <Input placeholder={t('message.enter-display-name')} /> |           <Input placeholder={t('message.enter-display-name')} /> | ||||||
|         </Form.Item> |         </Form.Item> | ||||||
|       </Form> |       </Form> | ||||||
|  | |||||||
| @ -792,13 +792,12 @@ const TagsPage = () => { | |||||||
|                     badge={ |                     badge={ | ||||||
|                       currentClassification.provider === ProviderType.System ? ( |                       currentClassification.provider === ProviderType.System ? ( | ||||||
|                         <AppBadge |                         <AppBadge | ||||||
|                           className="m--t-xss" |  | ||||||
|                           icon={<LockIcon height={12} />} |                           icon={<LockIcon height={12} />} | ||||||
|                           label={capitalize(currentClassification.provider)} |                           label={capitalize(currentClassification.provider)} | ||||||
|                         /> |                         /> | ||||||
|                       ) : null |                       ) : null | ||||||
|                     } |                     } | ||||||
|                     displayName={getEntityName(currentClassification)} |                     displayName={currentClassification.displayName} | ||||||
|                     icon={ |                     icon={ | ||||||
|                       <IconTag |                       <IconTag | ||||||
|                         className="h-9" |                         className="h-9" | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Chirag Madlani
						Chirag Madlani