Syntax changes to piAlert widget
This commit is contained in:
parent
3e093d2989
commit
52a04209d0
@ -9,27 +9,29 @@ export default function Component({ service }) {
|
|||||||
|
|
||||||
const { widget } = service;
|
const { widget } = service;
|
||||||
|
|
||||||
const { data: piholeData, error: piholeError } = useWidgetAPI(widget, "data");
|
const { data: pialertData, error: pialertError } = useWidgetAPI(widget, "data");
|
||||||
|
|
||||||
if (piholeError) {
|
if (pialertError) {
|
||||||
return <Container service={service} error={piholeError} />;
|
return <Container service={service} error={pialertError} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!piholeData) {
|
if (!pialertData) {
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<Block label="pialert.total" />
|
<Block label="pialert.total" />
|
||||||
<Block label="pialert.connected" />
|
<Block label="pialert.connected" />
|
||||||
|
<Block label="pialert.new_devices" />
|
||||||
|
<Block label="pialert.down_alerts" />
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<Block label="pialert.total" value={t("common.number", { value: parseInt(piholeData[0], 10) })} />
|
<Block label="pialert.total" value={t("common.number", { value: parseInt(pialertData[0], 10) })} />
|
||||||
<Block label="pialert.connected" value={t("common.number", { value: parseInt(piholeData[1], 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(piholeData[3], 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(piholeData[4], 10) })} />
|
<Block label="pialert.down_alerts" value={t("common.number", { value: parseInt(pialertData[4], 10) })} />
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user