mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-31 02:37:05 +00:00 
			
		
		
		
	fix(ui) Fix changing color and icon for domains in UI (#12792)
This commit is contained in:
		
							parent
							
								
									9cb5886d6d
								
							
						
					
					
						commit
						1068e2b512
					
				| @ -40,7 +40,8 @@ public class DomainType | |||||||
|           Constants.OWNERSHIP_ASPECT_NAME, |           Constants.OWNERSHIP_ASPECT_NAME, | ||||||
|           Constants.INSTITUTIONAL_MEMORY_ASPECT_NAME, |           Constants.INSTITUTIONAL_MEMORY_ASPECT_NAME, | ||||||
|           Constants.STRUCTURED_PROPERTIES_ASPECT_NAME, |           Constants.STRUCTURED_PROPERTIES_ASPECT_NAME, | ||||||
|           Constants.FORMS_ASPECT_NAME); |           Constants.FORMS_ASPECT_NAME, | ||||||
|  |           Constants.DISPLAY_PROPERTIES_ASPECT_NAME); | ||||||
|   private final EntityClient _entityClient; |   private final EntityClient _entityClient; | ||||||
| 
 | 
 | ||||||
|   public DomainType(final EntityClient entityClient) { |   public DomainType(final EntityClient entityClient) { | ||||||
|  | |||||||
| @ -196,6 +196,7 @@ export const DomainsList = () => { | |||||||
|                                     }, |                                     }, | ||||||
|                                     ownership: null, |                                     ownership: null, | ||||||
|                                     entities: null, |                                     entities: null, | ||||||
|  |                                     displayProperties: null, | ||||||
|                                 }, |                                 }, | ||||||
|                                 pageSize, |                                 pageSize, | ||||||
|                             ); |                             ); | ||||||
|  | |||||||
| @ -72,6 +72,7 @@ export const updateListDomainsCache = ( | |||||||
|             children: null, |             children: null, | ||||||
|             dataProducts: null, |             dataProducts: null, | ||||||
|             parentDomains: null, |             parentDomains: null, | ||||||
|  |             displayProperties: null, | ||||||
|         }, |         }, | ||||||
|         1000, |         1000, | ||||||
|         parentDomain, |         parentDomain, | ||||||
|  | |||||||
| @ -1,5 +1,4 @@ | |||||||
| import { Input, Modal } from 'antd'; | import { Input, Modal } from 'antd'; | ||||||
| import { debounce } from 'lodash'; |  | ||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import styled from 'styled-components'; | import styled from 'styled-components'; | ||||||
| 
 | 
 | ||||||
| @ -53,13 +52,6 @@ const IconColorPicker: React.FC<IconColorPickerProps> = ({ | |||||||
|     const [stagedColor, setStagedColor] = React.useState<string>(color || '#000000'); |     const [stagedColor, setStagedColor] = React.useState<string>(color || '#000000'); | ||||||
|     const [stagedIcon, setStagedIcon] = React.useState<string>(icon || 'account_circle'); |     const [stagedIcon, setStagedIcon] = React.useState<string>(icon || 'account_circle'); | ||||||
| 
 | 
 | ||||||
|     // a debounced version of updateDisplayProperties that takes in the same arguments
 |  | ||||||
|     // eslint-disable-next-line react-hooks/exhaustive-deps
 |  | ||||||
|     const debouncedUpdateDisplayProperties = React.useCallback( |  | ||||||
|         debounce((...args) => updateDisplayProperties(...args).then(() => setTimeout(() => refetch(), 1000)), 500), |  | ||||||
|         [], |  | ||||||
|     ); |  | ||||||
| 
 |  | ||||||
|     return ( |     return ( | ||||||
|         <Modal |         <Modal | ||||||
|             open={open} |             open={open} | ||||||
| @ -77,7 +69,7 @@ const IconColorPicker: React.FC<IconColorPickerProps> = ({ | |||||||
|                             }, |                             }, | ||||||
|                         }, |                         }, | ||||||
|                     }, |                     }, | ||||||
|                 }); |                 }).then(() => refetch()); | ||||||
|                 onChangeColor?.(stagedColor); |                 onChangeColor?.(stagedColor); | ||||||
|                 onChangeIcon?.(stagedIcon); |                 onChangeIcon?.(stagedIcon); | ||||||
|                 onClose(); |                 onClose(); | ||||||
| @ -93,44 +85,10 @@ const IconColorPicker: React.FC<IconColorPickerProps> = ({ | |||||||
|                     marginBottom: 30, |                     marginBottom: 30, | ||||||
|                     marginTop: 15, |                     marginTop: 15, | ||||||
|                 }} |                 }} | ||||||
|                 onChange={(e) => { |                 onChange={(e) => setStagedColor(e.target.value)} | ||||||
|                     setStagedColor(e.target.value); |  | ||||||
|                     debouncedUpdateDisplayProperties?.({ |  | ||||||
|                         variables: { |  | ||||||
|                             urn, |  | ||||||
|                             input: { |  | ||||||
|                                 colorHex: e.target.value, |  | ||||||
|                                 icon: { |  | ||||||
|                                     iconLibrary: IconLibrary.Material, |  | ||||||
|                                     name: stagedIcon, |  | ||||||
|                                     style: 'Outlined', |  | ||||||
|                                 }, |  | ||||||
|                             }, |  | ||||||
|                         }, |  | ||||||
|                     }); |  | ||||||
|                 }} |  | ||||||
|             /> |             /> | ||||||
|             <Title>Choose an icon for {name || 'Domain'}</Title> |             <Title>Choose an icon for {name || 'Domain'}</Title> | ||||||
|             <ChatIconPicker |             <ChatIconPicker color={stagedColor} onIconPick={(i) => setStagedIcon(i)} /> | ||||||
|                 color={stagedColor} |  | ||||||
|                 onIconPick={(i) => { |  | ||||||
|                     console.log('picking icon', i); |  | ||||||
|                     debouncedUpdateDisplayProperties?.({ |  | ||||||
|                         variables: { |  | ||||||
|                             urn, |  | ||||||
|                             input: { |  | ||||||
|                                 colorHex: stagedColor, |  | ||||||
|                                 icon: { |  | ||||||
|                                     iconLibrary: IconLibrary.Material, |  | ||||||
|                                     name: capitalize(snakeToCamel(i)), |  | ||||||
|                                     style: 'Outlined', |  | ||||||
|                                 }, |  | ||||||
|                             }, |  | ||||||
|                         }, |  | ||||||
|                     }); |  | ||||||
|                     setStagedIcon(i); |  | ||||||
|                 }} |  | ||||||
|             /> |  | ||||||
|         </Modal> |         </Modal> | ||||||
|     ); |     ); | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -40,6 +40,9 @@ query getDomain($urn: String!) { | |||||||
|         forms { |         forms { | ||||||
|             ...formsFields |             ...formsFields | ||||||
|         } |         } | ||||||
|  |         displayProperties { | ||||||
|  |             ...displayPropertiesFields | ||||||
|  |         } | ||||||
|         ...domainEntitiesFields |         ...domainEntitiesFields | ||||||
|         ...notes |         ...notes | ||||||
|     } |     } | ||||||
| @ -64,6 +67,9 @@ query listDomains($input: ListDomainsInput!) { | |||||||
|             ownership { |             ownership { | ||||||
|                 ...ownershipFields |                 ...ownershipFields | ||||||
|             } |             } | ||||||
|  |             displayProperties { | ||||||
|  |                 ...displayPropertiesFields | ||||||
|  |             } | ||||||
|             ...domainEntitiesFields |             ...domainEntitiesFields | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -229,6 +229,9 @@ fragment parentNodesFields on ParentNodesResult { | |||||||
|         properties { |         properties { | ||||||
|             name |             name | ||||||
|         } |         } | ||||||
|  |         displayProperties { | ||||||
|  |             ...displayPropertiesFields | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -238,6 +241,9 @@ fragment parentDomainsFields on ParentDomainsResult { | |||||||
|         urn |         urn | ||||||
|         type |         type | ||||||
|         ... on Domain { |         ... on Domain { | ||||||
|  |             displayProperties { | ||||||
|  |                 ...displayPropertiesFields | ||||||
|  |             } | ||||||
|             properties { |             properties { | ||||||
|                 name |                 name | ||||||
|                 description |                 description | ||||||
| @ -1259,6 +1265,9 @@ fragment entityDomain on DomainAssociation { | |||||||
|             ...parentDomainsFields |             ...parentDomainsFields | ||||||
|         } |         } | ||||||
|         ...domainEntitiesFields |         ...domainEntitiesFields | ||||||
|  |         displayProperties { | ||||||
|  |             ...displayPropertiesFields | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     associatedUrn |     associatedUrn | ||||||
| } | } | ||||||
|  | |||||||
| @ -54,6 +54,9 @@ query getGlossaryNode($urn: String!) { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         displayProperties { | ||||||
|  |             ...displayPropertiesFields | ||||||
|  |         } | ||||||
|         ...notes |         ...notes | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -341,6 +341,9 @@ fragment entityPreview on Entity { | |||||||
|         parentDomains { |         parentDomains { | ||||||
|             ...parentDomainsFields |             ...parentDomainsFields | ||||||
|         } |         } | ||||||
|  |         displayProperties { | ||||||
|  |             ...displayPropertiesFields | ||||||
|  |         } | ||||||
|         ...domainEntitiesFields |         ...domainEntitiesFields | ||||||
|     } |     } | ||||||
|     ... on Container { |     ... on Container { | ||||||
|  | |||||||
| @ -845,6 +845,9 @@ fragment searchResultsWithoutSchemaField on Entity { | |||||||
|         parentDomains { |         parentDomains { | ||||||
|             ...parentDomainsFields |             ...parentDomainsFields | ||||||
|         } |         } | ||||||
|  |         displayProperties { | ||||||
|  |             ...displayPropertiesFields | ||||||
|  |         } | ||||||
|         ...domainEntitiesFields |         ...domainEntitiesFields | ||||||
|         structuredProperties { |         structuredProperties { | ||||||
|             properties { |             properties { | ||||||
|  | |||||||
| @ -239,6 +239,7 @@ entities: | |||||||
|       - structuredProperties |       - structuredProperties | ||||||
|       - forms |       - forms | ||||||
|       - testResults |       - testResults | ||||||
|  |       - displayProperties | ||||||
|   - name: container |   - name: container | ||||||
|     doc: A container of related data assets. |     doc: A container of related data assets. | ||||||
|     category: core |     category: core | ||||||
| @ -300,6 +301,7 @@ entities: | |||||||
|       - forms |       - forms | ||||||
|       - testResults |       - testResults | ||||||
|       - subTypes |       - subTypes | ||||||
|  |       - displayProperties | ||||||
|   - name: dataHubIngestionSource |   - name: dataHubIngestionSource | ||||||
|     category: internal |     category: internal | ||||||
|     keyAspect: dataHubIngestionSourceKey |     keyAspect: dataHubIngestionSourceKey | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Chris Collins
						Chris Collins