diff options
Diffstat (limited to 'src/components')
-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 { |