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
---
src/components/services/PiHole.vue | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
(limited to 'src/components/services/PiHole.vue')
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 }}
+
+
+ {{ item.subtitle }}
+
+
+ {{ percentage }}% blocked
+
+
{{ 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
From 273a268ac4b9637e28522e2a9f6d543c43761380 Mon Sep 17 00:00:00 2001
From: Bram Ceulemans
Date: Wed, 9 Dec 2020 22:57:35 +0100
Subject: Remove unused computed property
---
src/components/services/PiHole.vue | 6 ------
1 file changed, 6 deletions(-)
(limited to 'src/components/services/PiHole.vue')
diff --git a/src/components/services/PiHole.vue b/src/components/services/PiHole.vue
index 47b1261..10d5ece 100644
--- a/src/components/services/PiHole.vue
+++ b/src/components/services/PiHole.vue
@@ -50,12 +50,6 @@ export default {
};
},
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);
--
cgit v1.2.3
From f81dc6f4888dbb64c7f86972016c1a7cb750fe99 Mon Sep 17 00:00:00 2001
From: Bram Ceulemans
Date: Thu, 10 Dec 2020 00:05:30 +0100
Subject: Fixed wrongly removed computed property
---
src/components/services/PiHole.vue | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
(limited to 'src/components/services/PiHole.vue')
diff --git a/src/components/services/PiHole.vue b/src/components/services/PiHole.vue
index 10d5ece..03d3ae3 100644
--- a/src/components/services/PiHole.vue
+++ b/src/components/services/PiHole.vue
@@ -21,7 +21,7 @@
{{ item.subtitle }}
- {{ percentage }}% blocked
+ {{ percentage }}% blocked
@@ -44,27 +44,29 @@ export default {
props: {
item: Object,
},
- data: () => {
- return {
- status: null,
- };
- },
+ data: () => ({
+ status: {
+ status: "",
+ ads_percentage_today: 0,
+ },
+ }),
computed: {
- blocked: function () {
+ percentage: function () {
if (this.status) {
- return this.status.dns_queries_today.toFixed(0);
+ return this.status.ads_percentage_today.toFixed(1);
}
return "";
},
},
- created: function () {
+ created() {
this.fetchStatus();
},
methods: {
fetchStatus: async function () {
- this.status = await fetch(`${this.item.url}/api.php`).then((response) =>
- response.json()
- );
+ const url = `${this.item.url}/api.php`;
+ this.status = await fetch(url)
+ .then((response) => response.json())
+ .catch((e) => console.log(e));
},
},
};
--
cgit v1.2.3
From 4ce53b68ea7143433bac39aa955a49981ceb6536 Mon Sep 17 00:00:00 2001
From: Bram Ceulemans
Date: Thu, 10 Dec 2020 00:07:53 +0100
Subject: Fixed wrongly removed computed property
---
src/components/services/PiHole.vue | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
(limited to 'src/components/services/PiHole.vue')
diff --git a/src/components/services/PiHole.vue b/src/components/services/PiHole.vue
index 03d3ae3..a9fd369 100644
--- a/src/components/services/PiHole.vue
+++ b/src/components/services/PiHole.vue
@@ -20,13 +20,13 @@
{{ item.subtitle }}
-
+
{{ percentage }}% blocked
-
- {{ status.status }}
+
+ {{ api.status }}
@@ -45,15 +45,15 @@ export default {
item: Object,
},
data: () => ({
- status: {
+ api: {
status: "",
ads_percentage_today: 0,
},
}),
computed: {
percentage: function () {
- if (this.status) {
- return this.status.ads_percentage_today.toFixed(1);
+ if (this.api) {
+ return this.api.ads_percentage_today.toFixed(1);
}
return "";
},
@@ -64,7 +64,7 @@ export default {
methods: {
fetchStatus: async function () {
const url = `${this.item.url}/api.php`;
- this.status = await fetch(url)
+ this.api = await fetch(url)
.then((response) => response.json())
.catch((e) => console.log(e));
},
--
cgit v1.2.3