From d49a06efd983c36b37af941ec1574048d0fee10f Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Sat, 6 Apr 2024 17:35:12 -0700
Subject: [PATCH] Fix: rename pialert to netalertx (#3253)
---
docs/widgets/services/netalertx.md | 16 +++++++++
docs/widgets/services/pialert.md | 16 ---------
public/locales/en/common.json | 2 +-
src/widgets/components.js | 3 +-
src/widgets/netalertx/component.jsx | 37 ++++++++++++++++++++
src/widgets/{pialert => netalertx}/widget.js | 0
src/widgets/pialert/component.jsx | 37 --------------------
src/widgets/widgets.js | 5 +--
8 files changed, 59 insertions(+), 57 deletions(-)
create mode 100644 docs/widgets/services/netalertx.md
delete mode 100644 docs/widgets/services/pialert.md
create mode 100644 src/widgets/netalertx/component.jsx
rename src/widgets/{pialert => netalertx}/widget.js (100%)
delete mode 100644 src/widgets/pialert/component.jsx
diff --git a/docs/widgets/services/netalertx.md b/docs/widgets/services/netalertx.md
new file mode 100644
index 00000000..4579d74c
--- /dev/null
+++ b/docs/widgets/services/netalertx.md
@@ -0,0 +1,16 @@
+---
+title: NetAlertX
+description: NetAlertX (formerly PiAlert) Widget Configuration
+---
+
+Learn more about [NetAlertX](https://github.com/jokob-sk/NetAlertX).
+
+_Note that the project was renamed from PiAlert to NetAlertX._
+
+Allowed fields: `["total", "connected", "new_devices", "down_alerts"]`.
+
+```yaml
+widget:
+ type: netalertx
+ url: http://ip:port
+```
diff --git a/docs/widgets/services/pialert.md b/docs/widgets/services/pialert.md
deleted file mode 100644
index ab8fb1e9..00000000
--- a/docs/widgets/services/pialert.md
+++ /dev/null
@@ -1,16 +0,0 @@
----
-title: PiAlert
-description: PiAlert Widget Configuration
----
-
-Learn more about [PiAlert](https://github.com/jokob-sk/Pi.Alert).
-
-Note that [pucherot/PiAlert](https://github.com/pucherot/Pi.Alert) has been abandoned and might not work properly.
-
-Allowed fields: `["total", "connected", "new_devices", "down_alerts"]`.
-
-```yaml
-widget:
- type: pialert
- url: http://ip:port
-```
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 98daae9e..3ac3ed0d 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -277,7 +277,7 @@
"approved": "Approved",
"available": "Available"
},
- "pialert": {
+ "netalertx": {
"total": "Total",
"connected": "Connected",
"new_devices": "New Devices",
diff --git a/src/widgets/components.js b/src/widgets/components.js
index 8c85bd77..500fe0ce 100644
--- a/src/widgets/components.js
+++ b/src/widgets/components.js
@@ -63,6 +63,7 @@ const components = {
moonraker: dynamic(() => import("./moonraker/component")),
mylar: dynamic(() => import("./mylar/component")),
navidrome: dynamic(() => import("./navidrome/component")),
+ netalertx: dynamic(() => import("./netalertx/component")),
netdata: dynamic(() => import("./netdata/component")),
nextcloud: dynamic(() => import("./nextcloud/component")),
nextdns: dynamic(() => import("./nextdns/component")),
@@ -80,7 +81,7 @@ const components = {
pfsense: dynamic(() => import("./pfsense/component")),
photoprism: dynamic(() => import("./photoprism/component")),
proxmoxbackupserver: dynamic(() => import("./proxmoxbackupserver/component")),
- pialert: dynamic(() => import("./pialert/component")),
+ pialert: dynamic(() => import("./netalertx/component")),
pihole: dynamic(() => import("./pihole/component")),
plantit: dynamic(() => import("./plantit/component")),
plex: dynamic(() => import("./plex/component")),
diff --git a/src/widgets/netalertx/component.jsx b/src/widgets/netalertx/component.jsx
new file mode 100644
index 00000000..5172121e
--- /dev/null
+++ b/src/widgets/netalertx/component.jsx
@@ -0,0 +1,37 @@
+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: netalertxData, error: netalertxError } = useWidgetAPI(widget, "data");
+
+ if (netalertxError) {
+ return ;
+ }
+
+ if (!netalertxData) {
+ return (
+
+
+
+
+
+
+ );
+ }
+
+ return (
+
+
+
+
+
+
+ );
+}
diff --git a/src/widgets/pialert/widget.js b/src/widgets/netalertx/widget.js
similarity index 100%
rename from src/widgets/pialert/widget.js
rename to src/widgets/netalertx/widget.js
diff --git a/src/widgets/pialert/component.jsx b/src/widgets/pialert/component.jsx
deleted file mode 100644
index 49bef897..00000000
--- a/src/widgets/pialert/component.jsx
+++ /dev/null
@@ -1,37 +0,0 @@
-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: pialertData, error: pialertError } = useWidgetAPI(widget, "data");
-
- if (pialertError) {
- return ;
- }
-
- if (!pialertData) {
- return (
-
-
-
-
-
-
- );
- }
-
- return (
-
-
-
-
-
-
- );
-}
diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js
index 6e02d932..7ed98bfb 100644
--- a/src/widgets/widgets.js
+++ b/src/widgets/widgets.js
@@ -55,6 +55,7 @@ import mjpeg from "./mjpeg/widget";
import moonraker from "./moonraker/widget";
import mylar from "./mylar/widget";
import navidrome from "./navidrome/widget";
+import netalertx from "./netalertx/widget";
import netdata from "./netdata/widget";
import nextcloud from "./nextcloud/widget";
import nextdns from "./nextdns/widget";
@@ -73,7 +74,6 @@ import peanut from "./peanut/widget";
import pfsense from "./pfsense/widget";
import photoprism from "./photoprism/widget";
import proxmoxbackupserver from "./proxmoxbackupserver/widget";
-import pialert from "./pialert/widget";
import pihole from "./pihole/widget";
import plantit from "./plantit/widget";
import plex from "./plex/widget";
@@ -171,6 +171,7 @@ const widgets = {
moonraker,
mylar,
navidrome,
+ netalertx,
netdata,
nextcloud,
nextdns,
@@ -189,7 +190,7 @@ const widgets = {
pfsense,
photoprism,
proxmoxbackupserver,
- pialert,
+ pialert: netalertx,
pihole,
plantit,
plex,