mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 21:43:39 +01:00
Merge branch 'add-romm' into LocalMain
This commit is contained in:
commit
93f1736ec9
@ -818,5 +818,9 @@
|
||||
"totalTemplates": "Total Templates",
|
||||
"totalSyncs": "Total Syncs",
|
||||
"loadedCards": "Loaded Cards"
|
||||
},
|
||||
"romm": {
|
||||
"platforms": "Platforms",
|
||||
"totalRoms": "Total ROMs"
|
||||
}
|
||||
}
|
@ -88,6 +88,7 @@ const components = {
|
||||
qnap: dynamic(() => import("./qnap/component")),
|
||||
radarr: dynamic(() => import("./radarr/component")),
|
||||
readarr: dynamic(() => import("./readarr/component")),
|
||||
romm: dynamic(() => import("./romm/component")),
|
||||
rutorrent: dynamic(() => import("./rutorrent/component")),
|
||||
sabnzbd: dynamic(() => import("./sabnzbd/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 radarr from "./radarr/widget";
|
||||
import readarr from "./readarr/widget";
|
||||
import romm from "./romm/widget";
|
||||
import rutorrent from "./rutorrent/widget";
|
||||
import sabnzbd from "./sabnzbd/widget";
|
||||
import scrutiny from "./scrutiny/widget";
|
||||
@ -190,6 +191,7 @@ const widgets = {
|
||||
qnap,
|
||||
radarr,
|
||||
readarr,
|
||||
romm,
|
||||
rutorrent,
|
||||
sabnzbd,
|
||||
scrutiny,
|
||||
|
Loading…
x
Reference in New Issue
Block a user