diff --git a/docs/widgets/services/n8n.md b/docs/widgets/services/n8n.md new file mode 100644 index 00000000..5fe17c3f --- /dev/null +++ b/docs/widgets/services/n8n.md @@ -0,0 +1,15 @@ +--- +title: n8n +description: n8n Widget Configuration +--- + +Grab your API key in n8n : Settings -> n8n API. + +Allowed fields: `["workflows", "executions"]`. + +```yaml +widget: + type: n8n + url: http://n8n.host.or.ip:port + key: key +``` diff --git a/mkdocs.yml b/mkdocs.yml index f356c150..695497d3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -82,6 +82,7 @@ nav: - widgets/services/mjpeg.md - widgets/services/moonraker.md - widgets/services/mylar.md + - widgets/services/n8n.md - widgets/services/navidrome.md - widgets/services/nextcloud.md - widgets/services/nextdns.md diff --git a/public/locales/af/common.json b/public/locales/af/common.json index 97bfa4da..06782d4e 100644 --- a/public/locales/af/common.json +++ b/public/locales/af/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/ar/common.json b/public/locales/ar/common.json index e3e194e6..1da2ddb3 100644 --- a/public/locales/ar/common.json +++ b/public/locales/ar/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/bg/common.json b/public/locales/bg/common.json index 68af6856..a60a57d5 100644 --- a/public/locales/bg/common.json +++ b/public/locales/bg/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/ca/common.json b/public/locales/ca/common.json index 0a94fa02..343d4cd4 100644 --- a/public/locales/ca/common.json +++ b/public/locales/ca/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/cs/common.json b/public/locales/cs/common.json index f1c9e9d4..f4f89d74 100644 --- a/public/locales/cs/common.json +++ b/public/locales/cs/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/da/common.json b/public/locales/da/common.json index 6bfb4bd2..1dbe56c4 100644 --- a/public/locales/da/common.json +++ b/public/locales/da/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Fysisk udgivelse", "digitalRelease": "Digitale udgivelser", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 926c2cf2..13c03894 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physische Version", "digitalRelease": "Digitale Version", "noEventsToday": "Heute keine Ereignisse!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/el/common.json b/public/locales/el/common.json index 689ee0e0..11abc957 100644 --- a/public/locales/el/common.json +++ b/public/locales/el/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 3a3f88f1..62d00233 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/eo/common.json b/public/locales/eo/common.json index 198c82d5..920618cd 100644 --- a/public/locales/eo/common.json +++ b/public/locales/eo/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 1ff434b0..d56d4ae3 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Lanzamiento en físico", "digitalRelease": "Lanzamiento en digital", "noEventsToday": "Sin eventos para hoy" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/eu/common.json b/public/locales/eu/common.json index d5189c41..f7723cd4 100644 --- a/public/locales/eu/common.json +++ b/public/locales/eu/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/fi/common.json b/public/locales/fi/common.json index be0f7629..faebee88 100644 --- a/public/locales/fi/common.json +++ b/public/locales/fi/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index a86469d0..1a75b71f 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Sortie physique", "digitalRelease": "Sortie numérique", "noEventsToday": "Rien pour aujourd'hui !" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/he/common.json b/public/locales/he/common.json index c73bce48..bb3f5254 100644 --- a/public/locales/he/common.json +++ b/public/locales/he/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/hi/common.json b/public/locales/hi/common.json index 6d7c87e1..0db2469e 100644 --- a/public/locales/hi/common.json +++ b/public/locales/hi/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/hr/common.json b/public/locales/hr/common.json index e876359d..8125ec28 100644 --- a/public/locales/hr/common.json +++ b/public/locales/hr/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/hu/common.json b/public/locales/hu/common.json index c0923d6a..068c56dc 100644 --- a/public/locales/hu/common.json +++ b/public/locales/hu/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/id/common.json b/public/locales/id/common.json index 6bb4669d..9d358fa0 100644 --- a/public/locales/id/common.json +++ b/public/locales/id/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/it/common.json b/public/locales/it/common.json index cb28bbf2..5830a7bb 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Release fisici", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/ja/common.json b/public/locales/ja/common.json index a651ef4b..ca9d5d78 100644 --- a/public/locales/ja/common.json +++ b/public/locales/ja/common.json @@ -766,5 +766,9 @@ "physicalRelease": "物理的なリリース", "digitalRelease": "デジタル・リリース", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/ko/common.json b/public/locales/ko/common.json index 00ce209c..f15e98b1 100644 --- a/public/locales/ko/common.json +++ b/public/locales/ko/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/lv/common.json b/public/locales/lv/common.json index f8748eb1..1c875fa7 100644 --- a/public/locales/lv/common.json +++ b/public/locales/lv/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/ms/common.json b/public/locales/ms/common.json index b670e077..a5d99859 100644 --- a/public/locales/ms/common.json +++ b/public/locales/ms/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/nb-NO/common.json b/public/locales/nb-NO/common.json index d4597a83..65972814 100644 --- a/public/locales/nb-NO/common.json +++ b/public/locales/nb-NO/common.json @@ -746,5 +746,9 @@ "physicalRelease": "Physical release", "inCinemas": "In cinemas", "digitalRelease": "Digital release" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json index b948f378..6577a1f9 100644 --- a/public/locales/nl/common.json +++ b/public/locales/nl/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Fysieke versie", "digitalRelease": "Digitale versie", "noEventsToday": "Geen gebeurtenissen voor vandaag!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/no/common.json b/public/locales/no/common.json index 6d7c87e1..0db2469e 100644 --- a/public/locales/no/common.json +++ b/public/locales/no/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/pl/common.json b/public/locales/pl/common.json index fb07e215..7906548f 100644 --- a/public/locales/pl/common.json +++ b/public/locales/pl/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/pt-BR/common.json b/public/locales/pt-BR/common.json index 6343d8fe..ade461a9 100644 --- a/public/locales/pt-BR/common.json +++ b/public/locales/pt-BR/common.json @@ -746,5 +746,9 @@ "physicalRelease": "Physical release", "inCinemas": "In cinemas", "digitalRelease": "Digital release" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index 93ad1c75..992a5906 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Lançamento físico", "digitalRelease": "Lançamento digital", "noEventsToday": "Não existem eventos hoje!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/pt_BR/common.json b/public/locales/pt_BR/common.json index 9ac42d57..8bbab92b 100644 --- a/public/locales/pt_BR/common.json +++ b/public/locales/pt_BR/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/ro/common.json b/public/locales/ro/common.json index 0f859545..83ceec9d 100644 --- a/public/locales/ro/common.json +++ b/public/locales/ro/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index 46e07c4e..751351c6 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -746,5 +746,9 @@ "physicalRelease": "Physical release", "inCinemas": "In cinemas", "digitalRelease": "Digital release" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/sk/common.json b/public/locales/sk/common.json index 172e81d2..ab5a6195 100644 --- a/public/locales/sk/common.json +++ b/public/locales/sk/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Fyzické vydanie", "digitalRelease": "Digitálne vydanie", "noEventsToday": "Žiadne udalosti na dnešný deň!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/sl/common.json b/public/locales/sl/common.json index 6ca1771a..b1e62c08 100644 --- a/public/locales/sl/common.json +++ b/public/locales/sl/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/sr/common.json b/public/locales/sr/common.json index 6d7c87e1..0db2469e 100644 --- a/public/locales/sr/common.json +++ b/public/locales/sr/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/sv/common.json b/public/locales/sv/common.json index 4d9d3c95..b556ba2d 100644 --- a/public/locales/sv/common.json +++ b/public/locales/sv/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/te/common.json b/public/locales/te/common.json index 5b3f7c97..a77e7a71 100644 --- a/public/locales/te/common.json +++ b/public/locales/te/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/th/common.json b/public/locales/th/common.json index 6e2f41c5..b16df293 100644 --- a/public/locales/th/common.json +++ b/public/locales/th/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/tr/common.json b/public/locales/tr/common.json index d82e63e2..a11f176d 100644 --- a/public/locales/tr/common.json +++ b/public/locales/tr/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/uk/common.json b/public/locales/uk/common.json index 39bbef59..9f1decca 100644 --- a/public/locales/uk/common.json +++ b/public/locales/uk/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index f7cf8d47..5ca87161 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/yue/common.json b/public/locales/yue/common.json index 35af06b6..1596ae2f 100644 --- a/public/locales/yue/common.json +++ b/public/locales/yue/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json index d9ab4c62..070ae3a6 100644 --- a/public/locales/zh-CN/common.json +++ b/public/locales/zh-CN/common.json @@ -746,5 +746,9 @@ "physicalRelease": "Physical release", "inCinemas": "In cinemas", "digitalRelease": "Digital release" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/zh-Hans/common.json b/public/locales/zh-Hans/common.json index 64173da6..2dbcb033 100644 --- a/public/locales/zh-Hans/common.json +++ b/public/locales/zh-Hans/common.json @@ -766,5 +766,9 @@ "physicalRelease": "实体发行", "digitalRelease": "数字发行", "noEventsToday": "今天没有活动!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/public/locales/zh-Hant/common.json b/public/locales/zh-Hant/common.json index 706989c1..32c69a9a 100644 --- a/public/locales/zh-Hant/common.json +++ b/public/locales/zh-Hant/common.json @@ -766,5 +766,9 @@ "physicalRelease": "Physical release", "digitalRelease": "Digital release", "noEventsToday": "No events for today!" + }, + "n8n":{ + "workflows": "Workflows", + "executions": "Executions" } } diff --git a/src/utils/proxy/handlers/credentialed.js b/src/utils/proxy/handlers/credentialed.js index 0795efd5..faf72d3d 100644 --- a/src/utils/proxy/handlers/credentialed.js +++ b/src/utils/proxy/handlers/credentialed.js @@ -61,6 +61,8 @@ export default async function credentialedProxyHandler(req, res, map) { headers.Authorization = `Basic ${Buffer.from(`$:${widget.key}`).toString("base64")}`; } else if (widget.type === "glances") { headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`; + } else if (widget.type === "n8n") { + headers["X-N8N-API-KEY"] = `${widget.key}`; } else { headers["X-API-Key"] = `${widget.key}`; } diff --git a/src/widgets/components.js b/src/widgets/components.js index 99da81ea..2a37ec71 100644 --- a/src/widgets/components.js +++ b/src/widgets/components.js @@ -58,6 +58,7 @@ const components = { navidrome: dynamic(() => import("./navidrome/component")), nextcloud: dynamic(() => import("./nextcloud/component")), nextdns: dynamic(() => import("./nextdns/component")), + n8n: dynamic(() => import("./n8n/component")), npm: dynamic(() => import("./npm/component")), nzbget: dynamic(() => import("./nzbget/component")), octoprint: dynamic(() => import("./octoprint/component")), diff --git a/src/widgets/n8n/component.jsx b/src/widgets/n8n/component.jsx new file mode 100644 index 00000000..198ffa14 --- /dev/null +++ b/src/widgets/n8n/component.jsx @@ -0,0 +1,33 @@ +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: workflowsData, error: workflowsError } = useWidgetAPI(widget, "workflows"); + const { data: executionsData, error: executionsError } = useWidgetAPI(widget, "executions"); + + if (workflowsError || executionsError) { + const finalError = workflowsError ?? executionsError; + return ; + } + if (!workflowsData || !executionsData) { + return ( + + + + + ); + } + + return ( + + + + + ); +} diff --git a/src/widgets/n8n/widget.js b/src/widgets/n8n/widget.js new file mode 100644 index 00000000..6731efd0 --- /dev/null +++ b/src/widgets/n8n/widget.js @@ -0,0 +1,20 @@ +import credentialedProxyHandler from "utils/proxy/handlers/credentialed"; +// import { jsonArrayFilter } from "utils/proxy/api-helpers"; + +const widget = { + api: "{url}/api/v1/{endpoint}", + proxyHandler: credentialedProxyHandler, + + mappings: { + workflows: { + endpoint: "workflows?active=true", + validate: ["data"], + }, + executions: { + endpoint: "executions?includeData=false&status=success", + validate: ["data"], + }, + }, +}; + +export default widget; diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js index 6bc682da..12c5031c 100644 --- a/src/widgets/widgets.js +++ b/src/widgets/widgets.js @@ -50,6 +50,7 @@ import mylar from "./mylar/widget"; import navidrome from "./navidrome/widget"; import nextcloud from "./nextcloud/widget"; import nextdns from "./nextdns/widget"; +import n8n from "./n8n/widget"; import npm from "./npm/widget"; import nzbget from "./nzbget/widget"; import octoprint from "./octoprint/widget"; @@ -152,6 +153,7 @@ const widgets = { navidrome, nextcloud, nextdns, + n8n, npm, nzbget, octoprint,