mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
Fix: rename pialert to netalertx (#3253)
This commit is contained in:
parent
9904c2db2f
commit
d49a06efd9
16
docs/widgets/services/netalertx.md
Normal file
16
docs/widgets/services/netalertx.md
Normal file
@ -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
|
||||||
|
```
|
@ -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
|
|
||||||
```
|
|
@ -277,7 +277,7 @@
|
|||||||
"approved": "Approved",
|
"approved": "Approved",
|
||||||
"available": "Available"
|
"available": "Available"
|
||||||
},
|
},
|
||||||
"pialert": {
|
"netalertx": {
|
||||||
"total": "Total",
|
"total": "Total",
|
||||||
"connected": "Connected",
|
"connected": "Connected",
|
||||||
"new_devices": "New Devices",
|
"new_devices": "New Devices",
|
||||||
|
@ -63,6 +63,7 @@ const components = {
|
|||||||
moonraker: dynamic(() => import("./moonraker/component")),
|
moonraker: dynamic(() => import("./moonraker/component")),
|
||||||
mylar: dynamic(() => import("./mylar/component")),
|
mylar: dynamic(() => import("./mylar/component")),
|
||||||
navidrome: dynamic(() => import("./navidrome/component")),
|
navidrome: dynamic(() => import("./navidrome/component")),
|
||||||
|
netalertx: dynamic(() => import("./netalertx/component")),
|
||||||
netdata: dynamic(() => import("./netdata/component")),
|
netdata: dynamic(() => import("./netdata/component")),
|
||||||
nextcloud: dynamic(() => import("./nextcloud/component")),
|
nextcloud: dynamic(() => import("./nextcloud/component")),
|
||||||
nextdns: dynamic(() => import("./nextdns/component")),
|
nextdns: dynamic(() => import("./nextdns/component")),
|
||||||
@ -80,7 +81,7 @@ const components = {
|
|||||||
pfsense: dynamic(() => import("./pfsense/component")),
|
pfsense: dynamic(() => import("./pfsense/component")),
|
||||||
photoprism: dynamic(() => import("./photoprism/component")),
|
photoprism: dynamic(() => import("./photoprism/component")),
|
||||||
proxmoxbackupserver: dynamic(() => import("./proxmoxbackupserver/component")),
|
proxmoxbackupserver: dynamic(() => import("./proxmoxbackupserver/component")),
|
||||||
pialert: dynamic(() => import("./pialert/component")),
|
pialert: dynamic(() => import("./netalertx/component")),
|
||||||
pihole: dynamic(() => import("./pihole/component")),
|
pihole: dynamic(() => import("./pihole/component")),
|
||||||
plantit: dynamic(() => import("./plantit/component")),
|
plantit: dynamic(() => import("./plantit/component")),
|
||||||
plex: dynamic(() => import("./plex/component")),
|
plex: dynamic(() => import("./plex/component")),
|
||||||
|
37
src/widgets/netalertx/component.jsx
Normal file
37
src/widgets/netalertx/component.jsx
Normal file
@ -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 <Container service={service} error={netalertxError} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!netalertxData) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="netalertx.total" />
|
||||||
|
<Block label="netalertx.connected" />
|
||||||
|
<Block label="netalertx.new_devices" />
|
||||||
|
<Block label="netalertx.down_alerts" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="netalertx.total" value={t("common.number", { value: parseInt(netalertxData[0], 10) })} />
|
||||||
|
<Block label="netalertx.connected" value={t("common.number", { value: parseInt(netalertxData[1], 10) })} />
|
||||||
|
<Block label="netalertx.new_devices" value={t("common.number", { value: parseInt(netalertxData[3], 10) })} />
|
||||||
|
<Block label="netalertx.down_alerts" value={t("common.number", { value: parseInt(netalertxData[4], 10) })} />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
@ -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 <Container service={service} error={pialertError} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pialertData) {
|
|
||||||
return (
|
|
||||||
<Container service={service}>
|
|
||||||
<Block label="pialert.total" />
|
|
||||||
<Block label="pialert.connected" />
|
|
||||||
<Block label="pialert.new_devices" />
|
|
||||||
<Block label="pialert.down_alerts" />
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Container service={service}>
|
|
||||||
<Block label="pialert.total" value={t("common.number", { value: parseInt(pialertData[0], 10) })} />
|
|
||||||
<Block label="pialert.connected" value={t("common.number", { value: parseInt(pialertData[1], 10) })} />
|
|
||||||
<Block label="pialert.new_devices" value={t("common.number", { value: parseInt(pialertData[3], 10) })} />
|
|
||||||
<Block label="pialert.down_alerts" value={t("common.number", { value: parseInt(pialertData[4], 10) })} />
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
}
|
|
@ -55,6 +55,7 @@ import mjpeg from "./mjpeg/widget";
|
|||||||
import moonraker from "./moonraker/widget";
|
import moonraker from "./moonraker/widget";
|
||||||
import mylar from "./mylar/widget";
|
import mylar from "./mylar/widget";
|
||||||
import navidrome from "./navidrome/widget";
|
import navidrome from "./navidrome/widget";
|
||||||
|
import netalertx from "./netalertx/widget";
|
||||||
import netdata from "./netdata/widget";
|
import netdata from "./netdata/widget";
|
||||||
import nextcloud from "./nextcloud/widget";
|
import nextcloud from "./nextcloud/widget";
|
||||||
import nextdns from "./nextdns/widget";
|
import nextdns from "./nextdns/widget";
|
||||||
@ -73,7 +74,6 @@ import peanut from "./peanut/widget";
|
|||||||
import pfsense from "./pfsense/widget";
|
import pfsense from "./pfsense/widget";
|
||||||
import photoprism from "./photoprism/widget";
|
import photoprism from "./photoprism/widget";
|
||||||
import proxmoxbackupserver from "./proxmoxbackupserver/widget";
|
import proxmoxbackupserver from "./proxmoxbackupserver/widget";
|
||||||
import pialert from "./pialert/widget";
|
|
||||||
import pihole from "./pihole/widget";
|
import pihole from "./pihole/widget";
|
||||||
import plantit from "./plantit/widget";
|
import plantit from "./plantit/widget";
|
||||||
import plex from "./plex/widget";
|
import plex from "./plex/widget";
|
||||||
@ -171,6 +171,7 @@ const widgets = {
|
|||||||
moonraker,
|
moonraker,
|
||||||
mylar,
|
mylar,
|
||||||
navidrome,
|
navidrome,
|
||||||
|
netalertx,
|
||||||
netdata,
|
netdata,
|
||||||
nextcloud,
|
nextcloud,
|
||||||
nextdns,
|
nextdns,
|
||||||
@ -189,7 +190,7 @@ const widgets = {
|
|||||||
pfsense,
|
pfsense,
|
||||||
photoprism,
|
photoprism,
|
||||||
proxmoxbackupserver,
|
proxmoxbackupserver,
|
||||||
pialert,
|
pialert: netalertx,
|
||||||
pihole,
|
pihole,
|
||||||
plantit,
|
plantit,
|
||||||
plex,
|
plex,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user