mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-10-30 22:13:59 +00:00 
			
		
		
		
	Fix: omada widget missing switches field, enforce default and max fields (#3047)
This commit is contained in:
		
							parent
							
								
									89fe819681
								
							
						
					
					
						commit
						4d68f55dfa
					
				| @ -17,12 +17,20 @@ export default function Component({ service }) { | ||||
|     return <Container service={service} error={omadaAPIError} />; | ||||
|   } | ||||
| 
 | ||||
|   if (!widget.fields) { | ||||
|     widget.fields = ["connectedAp", "activeUser", "alerts", "connectedGateway"]; | ||||
|   } else if (widget.fields?.length > 4) { | ||||
|     widget.fields = widget.fields.slice(0, 4); | ||||
|   } | ||||
| 
 | ||||
|   if (!omadaData) { | ||||
|     return ( | ||||
|       <Container service={service}> | ||||
|         <Block label="omada.connectedAp" /> | ||||
|         <Block label="omada.activeUser" /> | ||||
|         <Block label="omada.alerts" /> | ||||
|         <Block label="omada.connectedGateway" /> | ||||
|         <Block label="omada.connectedSwitches" /> | ||||
|       </Container> | ||||
|     ); | ||||
|   } | ||||
| @ -32,9 +40,8 @@ export default function Component({ service }) { | ||||
|       <Block label="omada.connectedAp" value={t("common.number", { value: omadaData.connectedAp })} /> | ||||
|       <Block label="omada.activeUser" value={t("common.number", { value: omadaData.activeUser })} /> | ||||
|       <Block label="omada.alerts" value={t("common.number", { value: omadaData.alerts })} /> | ||||
|       {omadaData.connectedGateways > 0 && ( | ||||
|         <Block label="omada.connectedGateway" value={t("common.number", { value: omadaData.connectedGateways })} /> | ||||
|       )} | ||||
|       <Block label="omada.connectedGateway" value={t("common.number", { value: omadaData.connectedGateways })} /> | ||||
|       <Block label="omada.connectedSwitches" value={t("common.number", { value: omadaData.connectedSwitches })} /> | ||||
|     </Container> | ||||
|   ); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 shamoon
						shamoon