aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/services/Ping.vue
diff options
context:
space:
mode:
authorAndreas Waschinski <25221082+waschinski@users.noreply.github.com>2021-07-14 11:48:54 +0200
committerAndreas Waschinski <25221082+waschinski@users.noreply.github.com>2021-07-14 11:48:54 +0200
commit73a102f3facf8716ba890423260bd733701f0c06 (patch)
treea4f9d4dd6feb428f54f19d868ecf89cf0a783d92 /src/components/services/Ping.vue
parentc3878bca0bbaa2dd076ef83bf46a051139d67426 (diff)
parentf9cc1d27cc295498cc04b6965b88a366da7122e5 (diff)
downloadhomer-73a102f3facf8716ba890423260bd733701f0c06.tar.gz
homer-73a102f3facf8716ba890423260bd733701f0c06.tar.zst
homer-73a102f3facf8716ba890423260bd733701f0c06.zip
Merge branch 'main' into mealie-service
Diffstat (limited to 'src/components/services/Ping.vue')
-rw-r--r--src/components/services/Ping.vue93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/components/services/Ping.vue b/src/components/services/Ping.vue
new file mode 100644
index 0000000..a9114a8
--- /dev/null
+++ b/src/components/services/Ping.vue
@@ -0,0 +1,93 @@
1<template>
2 <div>
3 <div class="card" :class="item.class">
4 <a :href="item.url" :target="item.target" rel="noreferrer">
5 <div class="card-content">
6 <div class="media">
7 <div v-if="item.logo" class="media-left">
8 <figure class="image is-48x48">
9 <img :src="item.logo" :alt="`${item.name} logo`" />
10 </figure>
11 </div>
12 <div v-if="item.icon" class="media-left">
13 <figure class="image is-48x48">
14 <i style="font-size: 35px" :class="['fa-fw', item.icon]"></i>
15 </figure>
16 </div>
17 <div class="media-content">
18 <p class="title is-4">{{ item.name }}</p>
19 <p class="subtitle is-6">
20 <template v-if="item.subtitle">
21 {{ item.subtitle }}
22 </template>
23 </p>
24 </div>
25 <div v-if="api" class="status" :class="api.status">
26 {{ api.status }}
27 </div>
28 </div>
29 <div class="tag" :class="item.tagstyle" v-if="item.tag">
30 <strong class="tag-text">#{{ item.tag }}</strong>
31 </div>
32 </div>
33 </a>
34 </div>
35 </div>
36</template>
37
38<script>
39export default {
40 name: "Ping",
41 props: {
42 item: Object,
43 },
44 data: () => ({
45 api: {
46 status: "",
47 },
48 }),
49 created() {
50 this.fetchStatus();
51 },
52 methods: {
53 fetchStatus: async function () {
54 const url = `${this.item.url}`;
55 this.api.status = await fetch(url)
56 .then((response) => "enabled")
57 .catch((e) => "disabled");
58 },
59 },
60};
61</script>
62
63<style scoped lang="scss">
64.media-left img {
65 max-height: 100%;
66}
67.status {
68 font-size: 0.8rem;
69 color: var(--text-title);
70
71 &.enabled:before {
72 background-color: #94e185;
73 border-color: #78d965;
74 box-shadow: 0 0 4px 1px #94e185;
75 }
76
77 &.disabled:before {
78 background-color: #c9404d;
79 border-color: #c42c3b;
80 box-shadow: 0 0 4px 1px #c9404d;
81 }
82
83 &:before {
84 content: " ";
85 display: inline-block;
86 width: 7px;
87 height: 7px;
88 margin-right: 10px;
89 border: 1px solid #000;
90 border-radius: 7px;
91 }
92}
93</style>