diff options
author | Bram Ceulemans <bramceulemans@me.com> | 2020-12-08 13:20:26 +0100 |
---|---|---|
committer | Bram Ceulemans <bramceulemans@me.com> | 2020-12-08 13:26:18 +0100 |
commit | c5eab80d765ab03155399ce669c25cc17eb736c9 (patch) | |
tree | 5a12113524d9a49535b8d9b0b2da88369912fe06 /src/components/services | |
parent | 71a7d3cce4f94ffe51e6fbfbcfb1140594db06db (diff) | |
download | homer-c5eab80d765ab03155399ce669c25cc17eb736c9.tar.gz homer-c5eab80d765ab03155399ce669c25cc17eb736c9.tar.zst homer-c5eab80d765ab03155399ce669c25cc17eb736c9.zip |
Added extended PiHole statistics
Diffstat (limited to 'src/components/services')
-rw-r--r-- | src/components/services/PiHole.vue | 29 |
1 files changed, 25 insertions, 4 deletions
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 @@ | |||
11 | </div> | 11 | </div> |
12 | <div v-if="item.icon" class="media-left"> | 12 | <div v-if="item.icon" class="media-left"> |
13 | <figure class="image is-48x48"> | 13 | <figure class="image is-48x48"> |
14 | <i style="font-size: 35px;" :class="['fa-fw', item.icon]"></i> | 14 | <i style="font-size: 35px" :class="['fa-fw', item.icon]"></i> |
15 | </figure> | 15 | </figure> |
16 | </div> | 16 | </div> |
17 | <div class="media-content"> | 17 | <div class="media-content"> |
18 | <p class="title is-4">{{ item.name }}</p> | 18 | <p class="title is-4">{{ item.name }}</p> |
19 | <p class="subtitle is-6">{{ item.subtitle }}</p> | 19 | <p class="subtitle is-6"> |
20 | <template v-if="item.subtitle"> | ||
21 | {{ item.subtitle }} | ||
22 | </template> | ||
23 | <template v-else-if="status"> | ||
24 | {{ percentage }}% blocked | ||
25 | </template> | ||
26 | </p> | ||
20 | </div> | 27 | </div> |
21 | <div v-if="status" class="status" :class="status.status"> | 28 | <div v-if="status" class="status" :class="status.status"> |
22 | {{ status.status }} | 29 | {{ status.status }} |
@@ -42,6 +49,20 @@ export default { | |||
42 | status: null, | 49 | status: null, |
43 | }; | 50 | }; |
44 | }, | 51 | }, |
52 | computed: { | ||
53 | percentage: function () { | ||
54 | if (this.status) { | ||
55 | return this.status.ads_percentage_today.toFixed(1); | ||
56 | } | ||
57 | return ""; | ||
58 | }, | ||
59 | blocked: function () { | ||
60 | if (this.status) { | ||
61 | return this.status.dns_queries_today.toFixed(0); | ||
62 | } | ||
63 | return ""; | ||
64 | }, | ||
65 | }, | ||
45 | created: function () { | 66 | created: function () { |
46 | this.fetchStatus(); | 67 | this.fetchStatus(); |
47 | }, | 68 | }, |
@@ -66,13 +87,13 @@ export default { | |||
66 | &.enabled:before { | 87 | &.enabled:before { |
67 | background-color: #94e185; | 88 | background-color: #94e185; |
68 | border-color: #78d965; | 89 | border-color: #78d965; |
69 | box-shadow: 0px 0px 4px 1px #94e185; | 90 | box-shadow: 0 0 4px 1px #94e185; |
70 | } | 91 | } |
71 | 92 | ||
72 | &.disabled:before { | 93 | &.disabled:before { |
73 | background-color: #c9404d; | 94 | background-color: #c9404d; |
74 | border-color: #c42c3b; | 95 | border-color: #c42c3b; |
75 | box-shadow: 0px 0px 4px 1px #c9404d; | 96 | box-shadow: 0 0 4px 1px #c9404d; |
76 | } | 97 | } |
77 | 98 | ||
78 | &:before { | 99 | &:before { |