@ -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 ) ) } ) }