mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-06 21:57:48 +01:00
Change: default merge pihole blocked fields (#3065)
This commit is contained in:
@@ -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)) })}
|
||||
|
||||
Reference in New Issue
Block a user