mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
Change: default merge pihole blocked fields (#3065)
This commit is contained in:
parent
b05b9b1420
commit
9caede1cc3
2 changed files with 13 additions and 2 deletions
|
@ -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)) })}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue