mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 08:20:58 +00:00 
			
		
		
		
	
						commit
						3ebfad821c
					
				@ -344,5 +344,10 @@
 | 
				
			|||||||
    "hdhomerun": {
 | 
					    "hdhomerun": {
 | 
				
			||||||
        "channels": "Channels",
 | 
					        "channels": "Channels",
 | 
				
			||||||
        "hd": "HD"
 | 
					        "hd": "HD"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "scrutiny": {
 | 
				
			||||||
 | 
					        "passed": "Passed",
 | 
				
			||||||
 | 
					        "failed": "Failed",
 | 
				
			||||||
 | 
					        "unknown": "Unknown"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -34,6 +34,7 @@ const components = {
 | 
				
			|||||||
  readarr: dynamic(() => import("./readarr/component")),
 | 
					  readarr: dynamic(() => import("./readarr/component")),
 | 
				
			||||||
  rutorrent: dynamic(() => import("./rutorrent/component")),
 | 
					  rutorrent: dynamic(() => import("./rutorrent/component")),
 | 
				
			||||||
  sabnzbd: dynamic(() => import("./sabnzbd/component")),
 | 
					  sabnzbd: dynamic(() => import("./sabnzbd/component")),
 | 
				
			||||||
 | 
					  scrutiny: dynamic(() => import("./scrutiny/component")),
 | 
				
			||||||
  sonarr: dynamic(() => import("./sonarr/component")),
 | 
					  sonarr: dynamic(() => import("./sonarr/component")),
 | 
				
			||||||
  speedtest: dynamic(() => import("./speedtest/component")),
 | 
					  speedtest: dynamic(() => import("./speedtest/component")),
 | 
				
			||||||
  strelaysrv: dynamic(() => import("./strelaysrv/component")),
 | 
					  strelaysrv: dynamic(() => import("./strelaysrv/component")),
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										37
									
								
								src/widgets/scrutiny/component.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/widgets/scrutiny/component.jsx
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					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: scrutinyData, error: scrutinyError } = useWidgetAPI(widget, "summary");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (scrutinyError) {
 | 
				
			||||||
 | 
					    return <Container error={scrutinyError} />;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!scrutinyData) {
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					      <Container service={service}>
 | 
				
			||||||
 | 
					        <Block label="scrutiny.passed" />
 | 
				
			||||||
 | 
					        <Block label="scrutiny.failed" />
 | 
				
			||||||
 | 
					        <Block label="scrutiny.unknown" />
 | 
				
			||||||
 | 
					      </Container>
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const deviceIds = Object.values(scrutinyData.data.summary);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  const passed = deviceIds.filter(deviceId => deviceId.device.device_status === 0)?.length || 0;
 | 
				
			||||||
 | 
					  const failed = deviceIds.filter(deviceId => deviceId.device.device_status > 0 && deviceId.device.device_status <= 3)?.length || 0;
 | 
				
			||||||
 | 
					  const unknown = deviceIds.length - (passed + failed) || 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return (
 | 
				
			||||||
 | 
					    <Container service={service}>
 | 
				
			||||||
 | 
					      <Block label="scrutiny.passed" value={passed} />
 | 
				
			||||||
 | 
					      <Block label="scrutiny.failed" value={failed} />
 | 
				
			||||||
 | 
					      <Block label="scrutiny.unknown" value={unknown} />
 | 
				
			||||||
 | 
					    </Container>
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										17
									
								
								src/widgets/scrutiny/widget.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/widgets/scrutiny/widget.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					import genericProxyHandler from "utils/proxy/handlers/generic";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const widget = {
 | 
				
			||||||
 | 
					  api: "{url}/api/{endpoint}",
 | 
				
			||||||
 | 
					  proxyHandler: genericProxyHandler,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  mappings: {
 | 
				
			||||||
 | 
					    summary: {
 | 
				
			||||||
 | 
					      endpoint: "summary",
 | 
				
			||||||
 | 
					      validate: [
 | 
				
			||||||
 | 
					        "data",
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default widget;
 | 
				
			||||||
@ -29,6 +29,7 @@ import radarr from "./radarr/widget";
 | 
				
			|||||||
import readarr from "./readarr/widget";
 | 
					import readarr from "./readarr/widget";
 | 
				
			||||||
import rutorrent from "./rutorrent/widget";
 | 
					import rutorrent from "./rutorrent/widget";
 | 
				
			||||||
import sabnzbd from "./sabnzbd/widget";
 | 
					import sabnzbd from "./sabnzbd/widget";
 | 
				
			||||||
 | 
					import scrutiny from "./scrutiny/widget";
 | 
				
			||||||
import sonarr from "./sonarr/widget";
 | 
					import sonarr from "./sonarr/widget";
 | 
				
			||||||
import speedtest from "./speedtest/widget";
 | 
					import speedtest from "./speedtest/widget";
 | 
				
			||||||
import strelaysrv from "./strelaysrv/widget";
 | 
					import strelaysrv from "./strelaysrv/widget";
 | 
				
			||||||
@ -73,6 +74,7 @@ const widgets = {
 | 
				
			|||||||
  readarr,
 | 
					  readarr,
 | 
				
			||||||
  rutorrent,
 | 
					  rutorrent,
 | 
				
			||||||
  sabnzbd,
 | 
					  sabnzbd,
 | 
				
			||||||
 | 
					  scrutiny,
 | 
				
			||||||
  sonarr,
 | 
					  sonarr,
 | 
				
			||||||
  speedtest,
 | 
					  speedtest,
 | 
				
			||||||
  strelaysrv,
 | 
					  strelaysrv,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user