diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index d8367de3f..15740d22b 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -118,7 +118,6 @@ export function cleanServiceGroups(groups) { container, currency, // coinmarketcap widget symbols, - inboxTag, // paperlessngx widget } = cleanedService.widget; cleanedService.widget = { @@ -130,8 +129,6 @@ export function cleanServiceGroups(groups) { if (currency) cleanedService.widget.currency = currency; if (symbols) cleanedService.widget.symbols = symbols; - - if (inboxTag) cleanedService.widget.inboxTag = inboxTag; if (type === "docker") { if (server) cleanedService.widget.server = server; diff --git a/src/widgets/paperlessngx/component.jsx b/src/widgets/paperlessngx/component.jsx index 131c0419e..d0c2e12f3 100644 --- a/src/widgets/paperlessngx/component.jsx +++ b/src/widgets/paperlessngx/component.jsx @@ -5,26 +5,13 @@ import useWidgetAPI from "utils/proxy/use-widget-api"; export default function Component({ service }) { const { widget } = service; - const { data: inboxData, error: inboxError } = useWidgetAPI(widget, "inbox", - { - query: `tag:${widget.inboxTag}`, - format: "json", - fields: "count" - }); + const { data: statisticsData, error: statisticsError } = useWidgetAPI(widget, "statistics"); - - const { data: documentData, error: documentError } = useWidgetAPI(widget, "documents", - { - fields: "count", - format: "json", - }); - - if (inboxError || documentError) { - const finalError = inboxError ?? documentError; - return ; + if (statisticsError) { + return ; } - if (!inboxData || !documentData) { + if (!statisticsData) { return ( @@ -35,8 +22,8 @@ export default function Component({ service }) { return ( - - + {statisticsData.documents_inbox !== undefined && } + ); } diff --git a/src/widgets/paperlessngx/widget.js b/src/widgets/paperlessngx/widget.js index 9671a0537..8af8079db 100644 --- a/src/widgets/paperlessngx/widget.js +++ b/src/widgets/paperlessngx/widget.js @@ -5,18 +5,10 @@ const widget = { proxyHandler: genericProxyHandler, mappings: { - "inbox": { - endpoint: "documents/", - params: ["format", "query", "fields"], + "statistics": { + endpoint: "statistics/?format=json", validate: [ - "count" - ] - }, - "documents": { - endpoint: "documents/", - params: ["format", "fields"], - validate: [ - "count" + "documents_total" ] }, },