|
|
|
@ -15,6 +15,10 @@ export default function Component({ service }) {
|
|
|
|
|
return <Container service={service} error={piholeError} />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!widget.fields) {
|
|
|
|
|
widget.fields = ["queries", "blocked", "gravity"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!piholeData) {
|
|
|
|
|
return (
|
|
|
|
|
<Container service={service}>
|
|
|
|
@ -26,10 +30,15 @@ export default function Component({ service }) {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let blockedValue = `${t("common.number", { value: parseInt(piholeData.ads_blocked_today, 10) })}`;
|
|
|
|
|
if (!widget.fields.includes("blocked_percent")) {
|
|
|
|
|
blockedValue += ` (${t("common.percent", { value: parseFloat(piholeData.ads_percentage_today.toPrecision(3)) })})`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Container service={service}>
|
|
|
|
|
<Block label="pihole.queries" value={t("common.number", { value: parseInt(piholeData.dns_queries_today, 10) })} />
|
|
|
|
|
<Block label="pihole.blocked" value={t("common.number", { value: parseInt(piholeData.ads_blocked_today, 10) })} />
|
|
|
|
|
<Block label="pihole.blocked" value={blockedValue} />
|
|
|
|
|
<Block
|
|
|
|
|
label="pihole.blocked_percent"
|
|
|
|
|
value={t("common.percent", { value: parseFloat(piholeData.ads_percentage_today.toPrecision(3)) })}
|
|
|
|
|