add Channels DVR Server widget

pull/1384/head
Jon Maddox 2 years ago
parent 0904776971
commit 3acbdda45e

@ -106,6 +106,12 @@
"totalObserved": "Total Observed",
"diffsDetected": "Diffs Detected"
},
"channelsdvrserver": {
"shows": "Shows",
"recordings": "Recordings",
"scheduled": "Scheduled",
"passes": "Passes"
},
"tautulli": {
"playing": "Playing",
"transcoding": "Transcoding",

@ -0,0 +1,36 @@
import { useTranslation } from "next-i18next";
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 { t } = useTranslation();
const { widget } = service;
const { data: channelsData, error: channelsError } = useWidgetAPI(widget, "status");
if (channelsError) {
return <Container error={channelsError} />;
}
if (!channelsData) {
return (
<Container service={service}>
<Block label="channelsdvrserver.shows" />
<Block label="channelsdvrserver.recordings" />
<Block label="channelsdvrserver.scheduled" />
<Block label="channelsdvrserver.passes" />
</Container>
);
}
return (
<Container service={service}>
<Block label="channelsdvrserver.shows" value={t("common.number", { value: channelsData.stats.groups })} />
<Block label="channelsdvrserver.recordings" value={t("common.number", { value: channelsData.stats.files })} />
<Block label="channelsdvrserver.scheduled" value={t("common.number", { value: channelsData.stats.jobs })} />
<Block label="channelsdvrserver.passes" value={t("common.number", { value: channelsData.stats.rules })} />
</Container>
);
}

@ -0,0 +1,14 @@
import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/{endpoint}",
proxyHandler: genericProxyHandler,
mappings: {
status: {
endpoint: "dvr",
},
},
};
export default widget;

@ -7,6 +7,7 @@ const components = {
autobrr: dynamic(() => import("./autobrr/component")),
bazarr: dynamic(() => import("./bazarr/component")),
changedetectionio: dynamic(() => import("./changedetectionio/component")),
channelsdvrserver: dynamic(() => import("./channelsdvrserver/component")),
cloudflared: dynamic(() => import("./cloudflared/component")),
coinmarketcap: dynamic(() => import("./coinmarketcap/component")),
deluge: dynamic(() => import("./deluge/component")),

@ -4,6 +4,7 @@ import authentik from "./authentik/widget";
import autobrr from "./autobrr/widget";
import bazarr from "./bazarr/widget";
import changedetectionio from "./changedetectionio/widget";
import channelsdvrserver from "./channelsdvrserver/widget";
import cloudflared from "./cloudflared/widget";
import coinmarketcap from "./coinmarketcap/widget";
import deluge from "./deluge/widget";
@ -13,7 +14,7 @@ import emby from "./emby/widget";
import fileflows from "./fileflows/widget";
import flood from "./flood/widget";
import freshrss from "./freshrss/widget";
import ghostfolio from "./ghostfolio/widget"
import ghostfolio from "./ghostfolio/widget";
import gluetun from "./gluetun/widget";
import gotify from "./gotify/widget";
import grafana from "./grafana/widget";
@ -83,6 +84,7 @@ const widgets = {
autobrr,
bazarr,
changedetectionio,
channelsdvrserver,
cloudflared,
coinmarketcap,
deluge,

Loading…
Cancel
Save