Merge pull request #556 from Tarow/paperless-ngx_widget

Add paperless-ngx widget
pull/561/head
shamoon 2 years ago committed by GitHub
commit f3c1063013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -349,5 +349,9 @@
"passed": "Passed",
"failed": "Failed",
"unknown": "Unknown"
},
"paperlessngx": {
"inbox": "Inbox",
"total": "Total"
}
}

@ -23,6 +23,7 @@ const components = {
nzbget: dynamic(() => import("./nzbget/component")),
ombi: dynamic(() => import("./ombi/component")),
overseerr: dynamic(() => import("./overseerr/component")),
paperlessngx: dynamic(() => import("./paperlessngx/component")),
pihole: dynamic(() => import("./pihole/component")),
plex: dynamic(() => import("./plex/component")),
portainer: dynamic(() => import("./portainer/component")),

@ -0,0 +1,29 @@
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: statisticsData, error: statisticsError } = useWidgetAPI(widget, "statistics");
if (statisticsError) {
return <Container error={statisticsError} />;
}
if (!statisticsData) {
return (
<Container service={service}>
<Block label="paperlessngx.inbox" />
<Block label="paperlessngx.total" />
</Container>
);
}
return (
<Container service={service}>
{statisticsData.documents_inbox !== undefined && <Block label="paperlessngx.inbox" value={statisticsData.documents_inbox} />}
<Block label="paperlessngx.total" value={statisticsData.documents_total} />
</Container>
);
}

@ -0,0 +1,17 @@
import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/api/{endpoint}",
proxyHandler: genericProxyHandler,
mappings: {
"statistics": {
endpoint: "statistics/?format=json",
validate: [
"documents_total"
]
},
},
};
export default widget;

@ -18,6 +18,7 @@ import npm from "./npm/widget";
import nzbget from "./nzbget/widget";
import ombi from "./ombi/widget";
import overseerr from "./overseerr/widget";
import paperlessngx from "./paperlessngx/widget";
import pihole from "./pihole/widget";
import plex from "./plex/widget";
import portainer from "./portainer/widget";
@ -63,6 +64,7 @@ const widgets = {
nzbget,
ombi,
overseerr,
paperlessngx,
pihole,
plex,
portainer,

Loading…
Cancel
Save