mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-26 15:41:49 +00:00 
			
		
		
		
	fix(history): update relations display (#20081)
This commit is contained in:
		
							parent
							
								
									0a031cc777
								
							
						
					
					
						commit
						a1b6aeee27
					
				| @ -65,16 +65,7 @@ const CustomRelationInput = (props: RelationsFieldProps) => { | |||||||
|   return ( |   return ( | ||||||
|     <Box> |     <Box> | ||||||
|       <FieldLabel>{props.label}</FieldLabel> |       <FieldLabel>{props.label}</FieldLabel> | ||||||
|       {results.length === 0 ? ( |       {results.length > 0 && ( | ||||||
|         <Box marginTop={1}> |  | ||||||
|           <StyledAlert variant="default"> |  | ||||||
|             {formatMessage({ |  | ||||||
|               id: 'content-manager.history.content.no-relations', |  | ||||||
|               defaultMessage: 'No relations.', |  | ||||||
|             })} |  | ||||||
|           </StyledAlert> |  | ||||||
|         </Box> |  | ||||||
|       ) : ( |  | ||||||
|         <Flex direction="column" gap={2} marginTop={1} alignItems="stretch"> |         <Flex direction="column" gap={2} marginTop={1} alignItems="stretch"> | ||||||
|           {results.map((relationData) => { |           {results.map((relationData) => { | ||||||
|             // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.
 |             // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.
 | ||||||
| @ -104,30 +95,41 @@ const CustomRelationInput = (props: RelationsFieldProps) => { | |||||||
|               </Flex> |               </Flex> | ||||||
|             ); |             ); | ||||||
|           })} |           })} | ||||||
|           {meta.missingCount > 0 && ( |  | ||||||
|             <StyledAlert |  | ||||||
|               variant="warning" |  | ||||||
|               title={formatMessage( |  | ||||||
|                 { |  | ||||||
|                   id: 'content-manager.history.content.missing-relations.title', |  | ||||||
|                   defaultMessage: |  | ||||||
|                     '{number, plural, =1 {Missing relation} other {{number} missing relations}}', |  | ||||||
|                 }, |  | ||||||
|                 { number: meta.missingCount } |  | ||||||
|               )} |  | ||||||
|             > |  | ||||||
|               {formatMessage( |  | ||||||
|                 { |  | ||||||
|                   id: 'content-manager.history.content.missing-relations.message', |  | ||||||
|                   defaultMessage: |  | ||||||
|                     "{number, plural, =1 {It has} other {They have}} been deleted and can't be restored.", |  | ||||||
|                 }, |  | ||||||
|                 { number: meta.missingCount } |  | ||||||
|               )} |  | ||||||
|             </StyledAlert> |  | ||||||
|           )} |  | ||||||
|         </Flex> |         </Flex> | ||||||
|       )} |       )} | ||||||
|  |       {meta.missingCount > 0 && ( | ||||||
|  |         <StyledAlert | ||||||
|  |           marginTop={1} | ||||||
|  |           variant="warning" | ||||||
|  |           title={formatMessage( | ||||||
|  |             { | ||||||
|  |               id: 'content-manager.history.content.missing-relations.title', | ||||||
|  |               defaultMessage: | ||||||
|  |                 '{number, plural, =1 {Missing relation} other {{number} missing relations}}', | ||||||
|  |             }, | ||||||
|  |             { number: meta.missingCount } | ||||||
|  |           )} | ||||||
|  |         > | ||||||
|  |           {formatMessage( | ||||||
|  |             { | ||||||
|  |               id: 'content-manager.history.content.missing-relations.message', | ||||||
|  |               defaultMessage: | ||||||
|  |                 "{number, plural, =1 {It has} other {They have}} been deleted and can't be restored.", | ||||||
|  |             }, | ||||||
|  |             { number: meta.missingCount } | ||||||
|  |           )} | ||||||
|  |         </StyledAlert> | ||||||
|  |       )} | ||||||
|  |       {results.length === 0 && meta.missingCount === 0 && ( | ||||||
|  |         <Box marginTop={1}> | ||||||
|  |           <StyledAlert variant="default"> | ||||||
|  |             {formatMessage({ | ||||||
|  |               id: 'content-manager.history.content.no-relations', | ||||||
|  |               defaultMessage: 'No relations.', | ||||||
|  |             })} | ||||||
|  |           </StyledAlert> | ||||||
|  |         </Box> | ||||||
|  |       )} | ||||||
|     </Box> |     </Box> | ||||||
|   ); |   ); | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 markkaylor
						markkaylor