mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 08:20:58 +00:00 
			
		
		
		
	Merge branch 'add-romm' into LocalMain
This commit is contained in:
		
						commit
						93f1736ec9
					
				@ -818,5 +818,9 @@
 | 
				
			|||||||
        "totalTemplates": "Total Templates",
 | 
					        "totalTemplates": "Total Templates",
 | 
				
			||||||
        "totalSyncs": "Total Syncs",
 | 
					        "totalSyncs": "Total Syncs",
 | 
				
			||||||
        "loadedCards": "Loaded Cards"      
 | 
					        "loadedCards": "Loaded Cards"      
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "romm": {
 | 
				
			||||||
 | 
					        "platforms": "Platforms",
 | 
				
			||||||
 | 
					        "totalRoms": "Total ROMs"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -88,6 +88,7 @@ const components = {
 | 
				
			|||||||
  qnap: dynamic(() => import("./qnap/component")),
 | 
					  qnap: dynamic(() => import("./qnap/component")),
 | 
				
			||||||
  radarr: dynamic(() => import("./radarr/component")),
 | 
					  radarr: dynamic(() => import("./radarr/component")),
 | 
				
			||||||
  readarr: dynamic(() => import("./readarr/component")),
 | 
					  readarr: dynamic(() => import("./readarr/component")),
 | 
				
			||||||
 | 
					  romm: dynamic(() => import("./romm/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")),
 | 
					  scrutiny: dynamic(() => import("./scrutiny/component")),
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										32
									
								
								src/widgets/romm/component.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/widgets/romm/component.jsx
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					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: response, error: responseError } = useWidgetAPI(widget, "statistics");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (responseError) {
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					      <Container service={service}>
 | 
				
			||||||
 | 
					        <Block label="Error" value={responseError.message} />
 | 
				
			||||||
 | 
					      </Container>
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (responseError) {
 | 
				
			||||||
 | 
					    return <Container service={service} error={responseError} />;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (response) {
 | 
				
			||||||
 | 
					    const platforms = response.filter(x => x.n_roms!==0).length
 | 
				
			||||||
 | 
					    const totalRoms = response.reduce((total, stat) => total + stat.n_roms, 0);
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					        <Container service={service}>
 | 
				
			||||||
 | 
					          <Block label="romm.platforms" value={platforms} />
 | 
				
			||||||
 | 
					          <Block label="romm.totalRoms" value={totalRoms} />
 | 
				
			||||||
 | 
					        </Container>
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								src/widgets/romm/widget.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/widgets/romm/widget.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					import genericProxyHandler from "utils/proxy/handlers/generic";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const widget = {
 | 
				
			||||||
 | 
					  api: "{url}/api/{endpoint}",
 | 
				
			||||||
 | 
					  proxyHandler: genericProxyHandler,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  mappings: {
 | 
				
			||||||
 | 
					    statistics: {
 | 
				
			||||||
 | 
					      endpoint: "platforms",
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default widget;
 | 
				
			||||||
@ -80,6 +80,7 @@ import qbittorrent from "./qbittorrent/widget";
 | 
				
			|||||||
import qnap from "./qnap/widget";
 | 
					import qnap from "./qnap/widget";
 | 
				
			||||||
import radarr from "./radarr/widget";
 | 
					import radarr from "./radarr/widget";
 | 
				
			||||||
import readarr from "./readarr/widget";
 | 
					import readarr from "./readarr/widget";
 | 
				
			||||||
 | 
					import romm from "./romm/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 scrutiny from "./scrutiny/widget";
 | 
				
			||||||
@ -190,6 +191,7 @@ const widgets = {
 | 
				
			|||||||
  qnap,
 | 
					  qnap,
 | 
				
			||||||
  radarr,
 | 
					  radarr,
 | 
				
			||||||
  readarr,
 | 
					  readarr,
 | 
				
			||||||
 | 
					  romm,
 | 
				
			||||||
  rutorrent,
 | 
					  rutorrent,
 | 
				
			||||||
  sabnzbd,
 | 
					  sabnzbd,
 | 
				
			||||||
  scrutiny,
 | 
					  scrutiny,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user