mirror of
				https://github.com/gethomepage/homepage.git
				synced 2025-11-03 19:17:03 -05:00 
			
		
		
		
	Add Immich Widget
This commit is contained in:
		
							parent
							
								
									e5d65f410c
								
							
						
					
					
						commit
						6b5e8ab0c7
					
				@ -439,5 +439,11 @@
 | 
				
			|||||||
        "failed_tasks_24h": "Failed Tasks 24h",
 | 
					        "failed_tasks_24h": "Failed Tasks 24h",
 | 
				
			||||||
        "cpu_usage": "CPU",
 | 
					        "cpu_usage": "CPU",
 | 
				
			||||||
        "memory_usage": "Memory"
 | 
					        "memory_usage": "Memory"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "immich": {
 | 
				
			||||||
 | 
					        "users": "Users",
 | 
				
			||||||
 | 
					        "photos": "Photos",
 | 
				
			||||||
 | 
					        "videos": "Videos",
 | 
				
			||||||
 | 
					        "storage": "Storage"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -62,6 +62,7 @@ const components = {
 | 
				
			|||||||
  unifi: dynamic(() => import("./unifi/component")),
 | 
					  unifi: dynamic(() => import("./unifi/component")),
 | 
				
			||||||
  watchtower: dynamic(() => import("./watchtower/component")),
 | 
					  watchtower: dynamic(() => import("./watchtower/component")),
 | 
				
			||||||
  xteve: dynamic(() => import("./xteve/component")),
 | 
					  xteve: dynamic(() => import("./xteve/component")),
 | 
				
			||||||
 | 
					  immich: dynamic(() => import("./immich/component")),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default components;
 | 
					export default components;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										22
									
								
								src/widgets/immich/component.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/widgets/immich/component.jsx
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					import Container from "components/services/widget/container";
 | 
				
			||||||
 | 
					import Block from "components/services/widget/block";
 | 
				
			||||||
 | 
					import useWidgetAPI from "utils/proxy/use-widget-api";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default function Component({ service }) {
 | 
				
			||||||
 | 
					  const { widget } = service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const { data: immichData, error: immichError } = useWidgetAPI(widget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (immichError) {
 | 
				
			||||||
 | 
					    return <Container error={immichError} />;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return (
 | 
				
			||||||
 | 
					    <Container service={service}>
 | 
				
			||||||
 | 
					      <Block label="immich.users" value={immichData?.usageByUser.length} />
 | 
				
			||||||
 | 
					      <Block label="immich.photos" value={immichData?.photos} />
 | 
				
			||||||
 | 
					      <Block label="immich.videos" value={immichData?.videos} />
 | 
				
			||||||
 | 
					      <Block label="immich.storage" value={immichData?.usage} />
 | 
				
			||||||
 | 
					    </Container>
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										8
									
								
								src/widgets/immich/widget.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/widgets/immich/widget.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const widget = {
 | 
				
			||||||
 | 
					  api: "{url}/api/server-info/stats",
 | 
				
			||||||
 | 
					  proxyHandler: credentialedProxyHandler,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default widget;
 | 
				
			||||||
@ -56,6 +56,7 @@ import truenas from "./truenas/widget";
 | 
				
			|||||||
import unifi from "./unifi/widget";
 | 
					import unifi from "./unifi/widget";
 | 
				
			||||||
import watchtower from "./watchtower/widget";
 | 
					import watchtower from "./watchtower/widget";
 | 
				
			||||||
import xteve from "./xteve/widget";
 | 
					import xteve from "./xteve/widget";
 | 
				
			||||||
 | 
					import immich from "./immich/widget";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const widgets = {
 | 
					const widgets = {
 | 
				
			||||||
  adguard,
 | 
					  adguard,
 | 
				
			||||||
@ -119,6 +120,7 @@ const widgets = {
 | 
				
			|||||||
  unifi_console: unifi,
 | 
					  unifi_console: unifi,
 | 
				
			||||||
  watchtower,
 | 
					  watchtower,
 | 
				
			||||||
  xteve,
 | 
					  xteve,
 | 
				
			||||||
 | 
					  immich,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default widgets;
 | 
					export default widgets;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user