Skip to content

Commit 2a29000

Browse files
thibaut1304bastienwirtz
authored andcommitted
add service matrix, view status and version
1 parent b11bee7 commit 2a29000

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

docs/customservices.md

+13
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ within Homer:
2525
- [Immich](#immich)
2626
- [Jellystat](#jellystat)
2727
- [Lidarr, Prowlarr, Sonarr, Readarr and Radarr](#lidarr-prowlarr-sonarr-readarr-and-radarr)
28+
- [Matrix](#matrix)
2829
- [Mealie](#mealie)
2930
- [Medusa](#medusa)
3031
- [Nextcloud](#nextcloud)
@@ -276,6 +277,18 @@ If you are using an older version of Radarr or Sonarr which don't support the ne
276277
legacyApi: true
277278
```
278279

280+
## Matrix
281+
282+
This service displays a version string instead of a subtitle. The indicator
283+
shows if Matrix Server is online, offline
284+
285+
```yaml
286+
- name: "Matrix - Server"
287+
type: "Matrix"
288+
logo: "assets/tools/sample.png"
289+
url: "http://matrix.example.com"
290+
```
291+
279292
## Mealie
280293

281294
First off make sure to remove an existing `subtitle` as it will take precedence if set.

src/components/services/Matrix.vue

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<template>
2+
<Generic :item="item">
3+
<template #content>
4+
<p class="title is-4">{{ item.name }}</p>
5+
<p class="subtitle is-6">
6+
<template v-if="item.subtitle">
7+
{{ item.subtitle }}
8+
</template>
9+
<template v-else-if="versionstring">
10+
Version {{ versionstring }}
11+
</template>
12+
</p>
13+
</template>
14+
<template #indicator>
15+
<div v-if="status" class="status" :class="status">
16+
{{ status }}
17+
</div>
18+
</template>
19+
</Generic>
20+
</template>
21+
22+
<script>
23+
import service from "@/mixins/service.js";
24+
import Generic from "./Generic.vue";
25+
26+
export default {
27+
name: "Matrix",
28+
components: {
29+
Generic,
30+
},
31+
mixins: [service],
32+
props: {
33+
item: Object,
34+
},
35+
data: () => ({
36+
fetchOk: null,
37+
versionstring: null,
38+
}),
39+
computed: {
40+
status: function () {
41+
return this.fetchOk ? "online" : "offline";
42+
},
43+
},
44+
created() {
45+
this.fetchStatus();
46+
},
47+
methods: {
48+
fetchStatus: async function () {
49+
this.fetch("_matrix/federation/v1/version")
50+
.then((response) => {
51+
this.fetchOk = true;
52+
this.versionstring = response.server.version;
53+
})
54+
.catch((e) => {
55+
this.fetchOk = false;
56+
console.log(e);
57+
});
58+
},
59+
},
60+
};
61+
</script>
62+
63+
<style scoped lang="scss">
64+
.status {
65+
font-size: 0.8rem;
66+
color: var(--text-title);
67+
white-space: nowrap;
68+
margin-left: 0.25rem;
69+
70+
&.online:before {
71+
background-color: #94e185;
72+
border-color: #78d965;
73+
box-shadow: 0 0 5px 1px #94e185;
74+
}
75+
76+
&.offline:before {
77+
background-color: #c9404d;
78+
border-color: #c42c3b;
79+
box-shadow: 0 0 5px 1px #c9404d;
80+
}
81+
82+
&:before {
83+
content: " ";
84+
display: inline-block;
85+
width: 7px;
86+
height: 7px;
87+
margin-right: 10px;
88+
border: 1px solid #000;
89+
border-radius: 7px;
90+
}
91+
}
92+
</style>

0 commit comments

Comments
 (0)