From c5eab80d765ab03155399ce669c25cc17eb736c9 Mon Sep 17 00:00:00 2001 From: Bram Ceulemans Date: Tue, 8 Dec 2020 13:20:26 +0100 Subject: Added extended PiHole statistics --- docs/configuration.md | 2 +- src/components/services/PiHole.vue | 29 +++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 681d62a..a43d7f1 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -109,7 +109,7 @@ services: items: - name: "Pi-hole" logo: "assets/tools/sample.png" - subtitle: "Network-wide Ad Blocking" + # subtitle: "Network-wide Ad Blocking" # optional, if no subtitle is defined, PiHole statistics will be shown tag: "other" url: "http://192.168.0.151/admin" type: "PiHole" # optional, loads a specific component that provides extra features. MUST MATCH a file name (without file extension) available in `src/components/services` diff --git a/src/components/services/PiHole.vue b/src/components/services/PiHole.vue index c08e1fa..47b1261 100644 --- a/src/components/services/PiHole.vue +++ b/src/components/services/PiHole.vue @@ -11,12 +11,19 @@
- +

{{ item.name }}

-

{{ item.subtitle }}

+

+ + +

{{ status.status }} @@ -42,6 +49,20 @@ export default { status: null, }; }, + computed: { + percentage: function () { + if (this.status) { + return this.status.ads_percentage_today.toFixed(1); + } + return ""; + }, + blocked: function () { + if (this.status) { + return this.status.dns_queries_today.toFixed(0); + } + return ""; + }, + }, created: function () { this.fetchStatus(); }, @@ -66,13 +87,13 @@ export default { &.enabled:before { background-color: #94e185; border-color: #78d965; - box-shadow: 0px 0px 4px 1px #94e185; + box-shadow: 0 0 4px 1px #94e185; } &.disabled:before { background-color: #c9404d; border-color: #c42c3b; - box-shadow: 0px 0px 4px 1px #c9404d; + box-shadow: 0 0 4px 1px #c9404d; } &:before { -- cgit v1.2.3