mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-10-30 22:13:59 +00:00 
			
		
		
		
	Feature: SWAG dashboard widget (#3523)
This commit is contained in:
		
							parent
							
								
									0a75c831a6
								
							
						
					
					
						commit
						c6770d233c
					
				
							
								
								
									
										14
									
								
								docs/widgets/services/swagdashboard.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								docs/widgets/services/swagdashboard.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | |||||||
|  | --- | ||||||
|  | title: SWAG Dashboard | ||||||
|  | description: SWAG Dashboard Widget Configuration | ||||||
|  | --- | ||||||
|  | 
 | ||||||
|  | Learn more about [SWAG Dashboard](https://github.com/linuxserver/docker-mods/tree/swag-dashboard). | ||||||
|  | 
 | ||||||
|  | Allowed fields: `["proxied", "auth", "outdated", "banned"]`. | ||||||
|  | 
 | ||||||
|  | ```yaml | ||||||
|  | widget: | ||||||
|  |   type: swagdashboard | ||||||
|  |   url: http://swagdashboard.host.or.ip:adminport # default port is 81 | ||||||
|  | ``` | ||||||
| @ -129,6 +129,7 @@ nav: | |||||||
|       - widgets/services/sonarr.md |       - widgets/services/sonarr.md | ||||||
|       - widgets/services/speedtest-tracker.md |       - widgets/services/speedtest-tracker.md | ||||||
|       - widgets/services/stash.md |       - widgets/services/stash.md | ||||||
|  |       - widgets/services/swagdashboard.md | ||||||
|       - widgets/services/syncthing-relay-server.md |       - widgets/services/syncthing-relay-server.md | ||||||
|       - widgets/services/tailscale.md |       - widgets/services/tailscale.md | ||||||
|       - widgets/services/tandoor.md |       - widgets/services/tandoor.md | ||||||
|  | |||||||
| @ -882,5 +882,11 @@ | |||||||
|         "enabled": "Enabled", |         "enabled": "Enabled", | ||||||
|         "disabled": "Disabled", |         "disabled": "Disabled", | ||||||
|         "total": "Total" |         "total": "Total" | ||||||
|  |     }, | ||||||
|  |     "swagdashboard": { | ||||||
|  |         "proxied": "Proxied", | ||||||
|  |         "auth": "With Auth", | ||||||
|  |         "outdated": "Outdated", | ||||||
|  |         "banned": "Banned" | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -103,6 +103,7 @@ const components = { | |||||||
|   speedtest: dynamic(() => import("./speedtest/component")), |   speedtest: dynamic(() => import("./speedtest/component")), | ||||||
|   stash: dynamic(() => import("./stash/component")), |   stash: dynamic(() => import("./stash/component")), | ||||||
|   strelaysrv: dynamic(() => import("./strelaysrv/component")), |   strelaysrv: dynamic(() => import("./strelaysrv/component")), | ||||||
|  |   swagdashboard: dynamic(() => import("./swagdashboard/component")), | ||||||
|   tailscale: dynamic(() => import("./tailscale/component")), |   tailscale: dynamic(() => import("./tailscale/component")), | ||||||
|   tandoor: dynamic(() => import("./tandoor/component")), |   tandoor: dynamic(() => import("./tandoor/component")), | ||||||
|   tautulli: dynamic(() => import("./tautulli/component")), |   tautulli: dynamic(() => import("./tautulli/component")), | ||||||
|  | |||||||
							
								
								
									
										33
									
								
								src/widgets/swagdashboard/component.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/widgets/swagdashboard/component.jsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,33 @@ | |||||||
|  | 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: swagData, error: swagError } = useWidgetAPI(widget, "overview"); | ||||||
|  | 
 | ||||||
|  |   if (swagError) { | ||||||
|  |     return <Container service={service} error={swagError} />; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   if (!swagData) { | ||||||
|  |     return ( | ||||||
|  |       <Container service={service}> | ||||||
|  |         <Block label="swagdashboard.proxied" /> | ||||||
|  |         <Block label="swagdashboard.auth" /> | ||||||
|  |         <Block label="swagdashboard.outdated" /> | ||||||
|  |         <Block label="swagdashboard.banned" /> | ||||||
|  |       </Container> | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   return ( | ||||||
|  |     <Container service={service}> | ||||||
|  |       <Block label="swagdashboard.proxied" value={swagData.proxied} /> | ||||||
|  |       <Block label="swagdashboard.auth" value={swagData.auth} /> | ||||||
|  |       <Block label="swagdashboard.outdated" value={swagData.outdated} /> | ||||||
|  |       <Block label="swagdashboard.banned" value={swagData.banned} /> | ||||||
|  |     </Container> | ||||||
|  |   ); | ||||||
|  | } | ||||||
							
								
								
									
										8
									
								
								src/widgets/swagdashboard/widget.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/widgets/swagdashboard/widget.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | import genericProxyHandler from "utils/proxy/handlers/generic"; | ||||||
|  | 
 | ||||||
|  | const widget = { | ||||||
|  |   api: "{url}/?stats=true", | ||||||
|  |   proxyHandler: genericProxyHandler, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | export default widget; | ||||||
| @ -94,6 +94,7 @@ import sonarr from "./sonarr/widget"; | |||||||
| import speedtest from "./speedtest/widget"; | import speedtest from "./speedtest/widget"; | ||||||
| import stash from "./stash/widget"; | import stash from "./stash/widget"; | ||||||
| import strelaysrv from "./strelaysrv/widget"; | import strelaysrv from "./strelaysrv/widget"; | ||||||
|  | import swagdashboard from "./swagdashboard/widget"; | ||||||
| import tailscale from "./tailscale/widget"; | import tailscale from "./tailscale/widget"; | ||||||
| import tandoor from "./tandoor/widget"; | import tandoor from "./tandoor/widget"; | ||||||
| import tautulli from "./tautulli/widget"; | import tautulli from "./tautulli/widget"; | ||||||
| @ -213,6 +214,7 @@ const widgets = { | |||||||
|   speedtest, |   speedtest, | ||||||
|   stash, |   stash, | ||||||
|   strelaysrv, |   strelaysrv, | ||||||
|  |   swagdashboard, | ||||||
|   tailscale, |   tailscale, | ||||||
|   tandoor, |   tandoor, | ||||||
|   tautulli, |   tautulli, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 quietsy
						quietsy