aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJulien Roy <royto81+github@gmail.com>2022-11-05 22:44:25 +0100
committerGitHub <noreply@github.com>2022-11-05 14:44:25 -0700
commitc9a649518616f3cf4e8c39d772dfbc2eff330a03 (patch)
tree9ec3632dc00272d23bba605ce21ca5e721084c7e
parentd141a69a7debea39aa17bff52cef3b8ce5e63f45 (diff)
downloadhomer-c9a649518616f3cf4e8c39d772dfbc2eff330a03.tar.gz
homer-c9a649518616f3cf4e8c39d772dfbc2eff330a03.tar.zst
homer-c9a649518616f3cf4e8c39d772dfbc2eff330a03.zip
What's up docker custom service (#444)
Add WUD
-rw-r--r--docs/customservices.md16
-rw-r--r--src/components/services/WUD.vue92
2 files changed, 108 insertions, 0 deletions
diff --git a/docs/customservices.md b/docs/customservices.md
index b81094e..a2d5f02 100644
--- a/docs/customservices.md
+++ b/docs/customservices.md
@@ -28,6 +28,8 @@ within Homer:
28 - [rTorrent](#rtorrent) 28 - [rTorrent](#rtorrent)
29 - [qBittorrent](#qbittorrent) 29 - [qBittorrent](#qbittorrent)
30 - [CopyToClipboard](#copy-to-clipboard) 30 - [CopyToClipboard](#copy-to-clipboard)
31 - [Speedtest Tracker](#SpeedtestTracker)
32 - [What's Up Docker](#whats-up-docker)
31 33
32If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page. 34If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page.
33 35
@@ -344,3 +346,17 @@ Configuration example:
344## SpeedtestTracker 346## SpeedtestTracker
345 347
346For the SpeedtestTracker service you just need to define a entry with type `SpeedtestTracker`. 348For the SpeedtestTracker service you just need to define a entry with type `SpeedtestTracker`.
349
350## What's up Docker
351
352What's up Docker allow to display info about the number of container running and the number for which an update is available on your Homer dashboard.
353
354The following configuration is available for the WUD service.
355
356```yaml
357- name: "What's Up Docker"
358 logo: "assets/tools/sample.png"
359 subtitle: "Docker image update notifier"
360 url: "http://192.168.1.12:3001"
361 type: "WUD"
362``` \ No newline at end of file
diff --git a/src/components/services/WUD.vue b/src/components/services/WUD.vue
new file mode 100644
index 0000000..917f3bd
--- /dev/null
+++ b/src/components/services/WUD.vue
@@ -0,0 +1,92 @@
1<template>
2 <Generic :item="item">
3 <template #indicator>
4 <div class="notifs">
5 <strong v-if="running > 0" class="notif warnings" title="Running">
6 {{ running }}
7 </strong>
8 <strong v-if="update > 0" class="notif errors" title="Update">
9 {{ update }}
10 </strong>
11 <strong
12 v-if="serverError"
13 class="notif errors"
14 title="Connection error to WUD API, check url in config.yml"
15 >
16 ?
17 </strong>
18 </div>
19 </template>
20 </Generic>
21</template>
22
23<script>
24import service from "@/mixins/service.js";
25import Generic from "./Generic.vue";
26
27export default {
28 name: "WUD",
29 mixins: [service],
30 props: {
31 item: Object,
32 },
33 components: {
34 Generic,
35 },
36 data: () => {
37 return {
38 running: null,
39 update: null,
40 serverError: false,
41 };
42 },
43 created: function () {
44 this.fetchConfig();
45 },
46 methods: {
47 fetchConfig: function () {
48 this.fetch(`/api/containers`)
49 .then((containers) => {
50 this.running = 0;
51 this.update = 0;
52 for (var i = 0; i < containers.length; i++) {
53 this.running++;
54 if (containers[i].updateAvailable) {
55 this.update++;
56 }
57 }
58 })
59 .catch(() => {
60 this.serverError = true;
61 });
62 },
63 },
64};
65</script>
66
67<style scoped lang="scss">
68.notifs {
69 position: absolute;
70 color: white;
71 font-family: sans-serif;
72 top: 0.3em;
73 right: 0.5em;
74
75 .notif {
76 display: inline-block;
77 padding: 0.2em 0.35em;
78 border-radius: 0.25em;
79 position: relative;
80 margin-left: 0.3em;
81 font-size: 0.8em;
82
83 &.warnings {
84 background-color: #d08d2e;
85 }
86
87 &.errors {
88 background-color: #e51111;
89 }
90 }
91}
92</style>