mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 10:39:30 +00:00 
			
		
		
		
	Fix UI : Change tags label to Value and tooltip to it's FQN in Explorer Page (#7624)
* Change tags label to Value and tooltip to it's FQN in Explorer Page * fix unit test issue * fix unit test issue * move function to tags utlis and added comments
This commit is contained in:
		
							parent
							
								
									680a186209
								
							
						
					
					
						commit
						e3473487b8
					
				| @ -79,14 +79,17 @@ const aggregations = [ | |||||||
|       { |       { | ||||||
|         key: 'PII.Sensitive', |         key: 'PII.Sensitive', | ||||||
|         doc_count: 1, |         doc_count: 1, | ||||||
|  |         label: 'Sensitive', | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         key: 'PersonalData.Personal', |         key: 'PersonalData.Personal', | ||||||
|         doc_count: 1, |         doc_count: 1, | ||||||
|  |         label: 'Personal', | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         key: 'User.Address', |         key: 'User.Address', | ||||||
|         doc_count: 1, |         doc_count: 1, | ||||||
|  |         label: 'Address', | ||||||
|       }, |       }, | ||||||
|     ], |     ], | ||||||
|   }, |   }, | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ import { | |||||||
|   LIST_SIZE, |   LIST_SIZE, | ||||||
| } from '../../../constants/constants'; | } from '../../../constants/constants'; | ||||||
| import { checkSelected } from '../../../utils/FilterUtils'; | import { checkSelected } from '../../../utils/FilterUtils'; | ||||||
|  | import { getTagsWithLabel } from '../../../utils/TagsUtils'; | ||||||
| import { FacetProp } from './FacetTypes'; | import { FacetProp } from './FacetTypes'; | ||||||
| import FilterContainer from './FilterContainer'; | import FilterContainer from './FilterContainer'; | ||||||
| 
 | 
 | ||||||
| @ -115,8 +116,7 @@ const FacetFilter: FunctionComponent<FacetProp> = ({ | |||||||
|       case 'Service': |       case 'Service': | ||||||
|         return getBuckets(buckets, showAllServices, true); |         return getBuckets(buckets, showAllServices, true); | ||||||
|       case 'Tags': |       case 'Tags': | ||||||
|         return getBuckets(buckets, showAllTags, true); |         return getTagsWithLabel(getBuckets(buckets, showAllTags, true)); | ||||||
| 
 |  | ||||||
|       case 'Tier': |       case 'Tier': | ||||||
|         return getBuckets(buckets, showAllTier); |         return getBuckets(buckets, showAllTier); | ||||||
|       case 'Database': |       case 'Database': | ||||||
| @ -142,6 +142,7 @@ const FacetFilter: FunctionComponent<FacetProp> = ({ | |||||||
|                 bucket.key.replace(/ /g, '+') |                 bucket.key.replace(/ /g, '+') | ||||||
|               )} |               )} | ||||||
|               key={index} |               key={index} | ||||||
|  |               label={bucket.label} | ||||||
|               name={bucket.key} |               name={bucket.key} | ||||||
|               type={toLower(aggregation.title) as keyof FilterObject} |               type={toLower(aggregation.title) as keyof FilterObject} | ||||||
|               onSelect={onSelectHandler} |               onSelect={onSelectHandler} | ||||||
|  | |||||||
| @ -37,4 +37,5 @@ export type FilterContainerProp = { | |||||||
|   isSelected: boolean; |   isSelected: boolean; | ||||||
|   type?: keyof FilterObject; |   type?: keyof FilterObject; | ||||||
|   isDisabled?: boolean; |   isDisabled?: boolean; | ||||||
|  |   label?: string; | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -25,6 +25,7 @@ const FilterContainer: FunctionComponent<FilterContainerProp> = ({ | |||||||
|   isSelected, |   isSelected, | ||||||
|   type = '', |   type = '', | ||||||
|   isDisabled = false, |   isDisabled = false, | ||||||
|  |   label, | ||||||
| }: FilterContainerProp) => { | }: FilterContainerProp) => { | ||||||
|   const getFilterName = (name = '') => { |   const getFilterName = (name = '') => { | ||||||
|     const formattedName = name.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) |     const formattedName = name.startsWith(`Tier${FQN_SEPARATOR_CHAR}Tier`) | ||||||
| @ -33,7 +34,7 @@ const FilterContainer: FunctionComponent<FilterContainerProp> = ({ | |||||||
| 
 | 
 | ||||||
|     return ( |     return ( | ||||||
|       <PopOver position="top" title={formattedName} trigger="mouseenter"> |       <PopOver position="top" title={formattedName} trigger="mouseenter"> | ||||||
|         <>{formattedName}</> |         <>{label || formattedName}</> | ||||||
|       </PopOver> |       </PopOver> | ||||||
|     ); |     ); | ||||||
|   }; |   }; | ||||||
|  | |||||||
| @ -155,6 +155,7 @@ declare module 'Models' { | |||||||
|   export type Bucket = { |   export type Bucket = { | ||||||
|     key: string; |     key: string; | ||||||
|     doc_count: number; |     doc_count: number; | ||||||
|  |     label?: string; | ||||||
|   }; |   }; | ||||||
|   type AggregationType = { |   type AggregationType = { | ||||||
|     title: string; |     title: string; | ||||||
|  | |||||||
| @ -12,8 +12,8 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| import { AxiosError } from 'axios'; | import { AxiosError } from 'axios'; | ||||||
| import { flatten } from 'lodash'; | import { flatten, isEmpty } from 'lodash'; | ||||||
| import { EntityTags, TableColumn, TagOption } from 'Models'; | import { Bucket, EntityTags, TableColumn, TagOption } from 'Models'; | ||||||
| import { getCategory, getTags } from '../axiosAPIs/tagAPI'; | import { getCategory, getTags } from '../axiosAPIs/tagAPI'; | ||||||
| import { TagCategory, TagClass } from '../generated/entity/tags/tagCategory'; | import { TagCategory, TagClass } from '../generated/entity/tags/tagCategory'; | ||||||
| import { LabelType, State, TagSource } from '../generated/type/tagLabel'; | import { LabelType, State, TagSource } from '../generated/type/tagLabel'; | ||||||
| @ -100,3 +100,15 @@ export const getTagOptions = (tags: Array<string>): Array<EntityTags> => { | |||||||
|     }; |     }; | ||||||
|   }); |   }); | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | // Will add a label of value in the data object without it's FQN
 | ||||||
|  | export const getTagsWithLabel = (tags: Array<Bucket>) => { | ||||||
|  |   return tags.map((tag) => { | ||||||
|  |     const containQuotes = tag.key.split('"')[1]; | ||||||
|  | 
 | ||||||
|  |     return { | ||||||
|  |       ...tag, | ||||||
|  |       label: isEmpty(containQuotes) ? tag.key.split('.').pop() : containQuotes, | ||||||
|  |     }; | ||||||
|  |   }); | ||||||
|  | }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ashish Gupta
						Ashish Gupta