diff options
author | Andreas Waschinski <25221082+waschinski@users.noreply.github.com> | 2021-07-14 11:48:54 +0200 |
---|---|---|
committer | Andreas Waschinski <25221082+waschinski@users.noreply.github.com> | 2021-07-14 11:48:54 +0200 |
commit | 73a102f3facf8716ba890423260bd733701f0c06 (patch) | |
tree | a4f9d4dd6feb428f54f19d868ecf89cf0a783d92 /src | |
parent | c3878bca0bbaa2dd076ef83bf46a051139d67426 (diff) | |
parent | f9cc1d27cc295498cc04b6965b88a366da7122e5 (diff) | |
download | homer-73a102f3facf8716ba890423260bd733701f0c06.tar.gz homer-73a102f3facf8716ba890423260bd733701f0c06.tar.zst homer-73a102f3facf8716ba890423260bd733701f0c06.zip |
Merge branch 'main' into mealie-service
Diffstat (limited to 'src')
-rw-r--r-- | src/assets/app.scss | 11 | ||||
-rw-r--r-- | src/components/Message.vue | 2 | ||||
-rw-r--r-- | src/components/services/Medusa.vue | 128 | ||||
-rw-r--r-- | src/components/services/PaperlessNG.vue | 81 | ||||
-rw-r--r-- | src/components/services/Ping.vue | 93 | ||||
-rw-r--r-- | src/components/services/Radarr.vue | 157 | ||||
-rw-r--r-- | src/components/services/Sonarr.vue | 157 |
7 files changed, 623 insertions, 6 deletions
diff --git a/src/assets/app.scss b/src/assets/app.scss index 48c60ae..6bb5068 100644 --- a/src/assets/app.scss +++ b/src/assets/app.scss | |||
@@ -211,7 +211,7 @@ body { | |||
211 | color: var(--highlight-secondary); | 211 | color: var(--highlight-secondary); |
212 | background-color: var(--highlight-secondary); | 212 | background-color: var(--highlight-secondary); |
213 | position: absolute; | 213 | position: absolute; |
214 | top: 1rem; | 214 | bottom: 1rem; |
215 | right: -0.2rem; | 215 | right: -0.2rem; |
216 | width: 3px; | 216 | width: 3px; |
217 | overflow: hidden; | 217 | overflow: hidden; |
@@ -224,7 +224,6 @@ body { | |||
224 | } | 224 | } |
225 | 225 | ||
226 | .card { | 226 | .card { |
227 | border-radius: 5px; | ||
228 | border: none; | 227 | border: none; |
229 | box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.1); | 228 | box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.1); |
230 | transition: cubic-bezier(0.165, 0.84, 0.44, 1) 300ms; | 229 | transition: cubic-bezier(0.165, 0.84, 0.44, 1) 300ms; |
@@ -260,11 +259,13 @@ body { | |||
260 | } | 259 | } |
261 | 260 | ||
262 | .column div:first-of-type .card { | 261 | .column div:first-of-type .card { |
263 | border-radius: 5px 5px 0 0; | 262 | border-top-left-radius: 0.25rem; |
263 | border-top-right-radius: 0.25rem; | ||
264 | } | 264 | } |
265 | 265 | ||
266 | .column div:last-child .card { | 266 | .column div:last-child .card { |
267 | border-radius: 0 0 5px 5px; | 267 | border-bottom-left-radius: 0.25rem; |
268 | border-bottom-right-radius: 0.25rem; | ||
268 | } | 269 | } |
269 | } | 270 | } |
270 | 271 | ||
@@ -348,4 +349,4 @@ body { | |||
348 | 349 | ||
349 | .group-logo { | 350 | .group-logo { |
350 | float: left; | 351 | float: left; |
351 | } \ No newline at end of file | 352 | } |
diff --git a/src/components/Message.vue b/src/components/Message.vue index 6cc649a..00ce158 100644 --- a/src/components/Message.vue +++ b/src/components/Message.vue | |||
@@ -54,7 +54,7 @@ export default { | |||
54 | 54 | ||
55 | // keep the original config value if no value is provided by the endpoint | 55 | // keep the original config value if no value is provided by the endpoint |
56 | const message = this.message; | 56 | const message = this.message; |
57 | for (const prop of ["title", "style", "content"]) { | 57 | for (const prop of ["title", "style", "content", "icon"]) { |
58 | if (prop in fetchedMessage && fetchedMessage[prop] !== null) { | 58 | if (prop in fetchedMessage && fetchedMessage[prop] !== null) { |
59 | message[prop] = fetchedMessage[prop]; | 59 | message[prop] = fetchedMessage[prop]; |
60 | } | 60 | } |
diff --git a/src/components/services/Medusa.vue b/src/components/services/Medusa.vue new file mode 100644 index 0000000..5720649 --- /dev/null +++ b/src/components/services/Medusa.vue | |||
@@ -0,0 +1,128 @@ | |||
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">{{ item.subtitle }}</p> | ||
20 | </div> | ||
21 | <div class="notifs"> | ||
22 | <strong | ||
23 | v-if="config !== null && config.system.news.unread > 0" | ||
24 | class="notif news" | ||
25 | title="News" | ||
26 | >{{ config.system.news.unread }}</strong | ||
27 | > | ||
28 | <strong | ||
29 | v-if="config !== null && config.main.logs.numWarnings > 0" | ||
30 | class="notif warnings" | ||
31 | title="Warning" | ||
32 | >{{ config.main.logs.numWarnings }}</strong | ||
33 | > | ||
34 | <strong | ||
35 | v-if="config !== null && config.main.logs.numErrors > 0" | ||
36 | class="notif errors" | ||
37 | title="Error" | ||
38 | >{{ config.main.logs.numErrors }}</strong | ||
39 | > | ||
40 | <strong | ||
41 | v-if="serverError" | ||
42 | class="notif errors" | ||
43 | title="Connection error to Medusa API, check url and apikey in config.yml" | ||
44 | >?</strong | ||
45 | > | ||
46 | </div> | ||
47 | </div> | ||
48 | <div class="tag" :class="item.tagstyle" v-if="item.tag"> | ||
49 | <strong class="tag-text">#{{ item.tag }}</strong> | ||
50 | </div> | ||
51 | </div> | ||
52 | </a> | ||
53 | </div> | ||
54 | </div> | ||
55 | </template> | ||
56 | |||
57 | <script> | ||
58 | export default { | ||
59 | name: "Medusa", | ||
60 | props: { | ||
61 | item: Object, | ||
62 | }, | ||
63 | data: () => { | ||
64 | return { | ||
65 | config: null, | ||
66 | serverError: false, | ||
67 | }; | ||
68 | }, | ||
69 | created: function () { | ||
70 | this.fetchConfig(); | ||
71 | }, | ||
72 | methods: { | ||
73 | fetchConfig: function () { | ||
74 | fetch(`${this.item.url}/api/v2/config`, { | ||
75 | credentials: "include", | ||
76 | headers: { "X-Api-Key": `${this.item.apikey}` }, | ||
77 | }) | ||
78 | .then((response) => { | ||
79 | if (response.status != 200) { | ||
80 | throw new Error(response.statusText); | ||
81 | } | ||
82 | return response.json(); | ||
83 | }) | ||
84 | .then((conf) => { | ||
85 | this.config = conf; | ||
86 | }) | ||
87 | .catch((e) => { | ||
88 | console.log(e); | ||
89 | this.serverError = true; | ||
90 | }); | ||
91 | }, | ||
92 | }, | ||
93 | }; | ||
94 | </script> | ||
95 | |||
96 | <style scoped lang="scss"> | ||
97 | .media-left img { | ||
98 | max-height: 100%; | ||
99 | } | ||
100 | .notifs { | ||
101 | position: absolute; | ||
102 | color: white; | ||
103 | font-family: sans-serif; | ||
104 | top: 0.3em; | ||
105 | right: 0.5em; | ||
106 | } | ||
107 | .notif { | ||
108 | padding-right: 0.35em; | ||
109 | padding-left: 0.35em; | ||
110 | padding-top: 0.2em; | ||
111 | padding-bottom: 0.2em; | ||
112 | border-radius: 0.25em; | ||
113 | position: relative; | ||
114 | margin-left: 0.3em; | ||
115 | font-size: 0.8em; | ||
116 | } | ||
117 | .news { | ||
118 | background-color: #777777; | ||
119 | } | ||
120 | |||
121 | .warnings { | ||
122 | background-color: #d08d2e; | ||
123 | } | ||
124 | |||
125 | .errors { | ||
126 | background-color: #e51111; | ||
127 | } | ||
128 | </style> | ||
diff --git a/src/components/services/PaperlessNG.vue b/src/components/services/PaperlessNG.vue new file mode 100644 index 0000000..c4f50eb --- /dev/null +++ b/src/components/services/PaperlessNG.vue | |||
@@ -0,0 +1,81 @@ | |||
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 | <template v-else-if="api"> | ||
24 | happily storing {{ api.count }} documents | ||
25 | </template> | ||
26 | </p> | ||
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> | ||
39 | export default { | ||
40 | name: "Paperless", | ||
41 | props: { | ||
42 | item: Object, | ||
43 | }, | ||
44 | data: () => ({ | ||
45 | api: null, | ||
46 | }), | ||
47 | created() { | ||
48 | this.fetchStatus(); | ||
49 | }, | ||
50 | methods: { | ||
51 | fetchStatus: async function () { | ||
52 | if (this.item.subtitle != null) return; // omitting unnecessary ajax call as the subtitle is showing | ||
53 | var apikey = this.item.apikey; | ||
54 | if (!apikey) { | ||
55 | console.error("apikey is not present in config.yml for the paperless entry!"); | ||
56 | return; | ||
57 | } | ||
58 | const url = `${this.item.url}/api/documents/`; | ||
59 | this.api = await fetch(url, { | ||
60 | headers: { | ||
61 | "Authorization": "Token " + this.item.apikey | ||
62 | } | ||
63 | }) | ||
64 | .then(function(response) { | ||
65 | if (!response.ok) { | ||
66 | throw new Error("Not 2xx response") | ||
67 | } else { | ||
68 | return response.json() | ||
69 | } | ||
70 | }) | ||
71 | .catch((e) => console.log(e)); | ||
72 | }, | ||
73 | }, | ||
74 | }; | ||
75 | </script> | ||
76 | |||
77 | <style scoped lang="scss"> | ||
78 | .media-left img { | ||
79 | max-height: 100%; | ||
80 | } | ||
81 | </style> | ||
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> | ||
39 | export 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> | ||
diff --git a/src/components/services/Radarr.vue b/src/components/services/Radarr.vue new file mode 100644 index 0000000..93831a7 --- /dev/null +++ b/src/components/services/Radarr.vue | |||
@@ -0,0 +1,157 @@ | |||
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">{{ item.subtitle }}</p> | ||
20 | </div> | ||
21 | <div class="notifs"> | ||
22 | <strong | ||
23 | v-if="activity > 0" | ||
24 | class="notif activity" | ||
25 | title="Activity" | ||
26 | >{{ activity }}</strong | ||
27 | > | ||
28 | <strong | ||
29 | v-if="warnings > 0" | ||
30 | class="notif warnings" | ||
31 | title="Warning" | ||
32 | >{{ warnings }}</strong | ||
33 | > | ||
34 | <strong v-if="errors > 0" class="notif errors" title="Error">{{ | ||
35 | errors | ||
36 | }}</strong> | ||
37 | <strong | ||
38 | v-if="serverError" | ||
39 | class="notif errors" | ||
40 | title="Connection error to Radarr API, check url and apikey in config.yml" | ||
41 | >?</strong | ||
42 | > | ||
43 | </div> | ||
44 | </div> | ||
45 | <div class="tag" :class="item.tagstyle" v-if="item.tag"> | ||
46 | <strong class="tag-text">#{{ item.tag }}</strong> | ||
47 | </div> | ||
48 | </div> | ||
49 | </a> | ||
50 | </div> | ||
51 | </div> | ||
52 | </template> | ||
53 | |||
54 | <script> | ||
55 | export default { | ||
56 | name: "Radarr", | ||
57 | props: { | ||
58 | item: Object, | ||
59 | }, | ||
60 | data: () => { | ||
61 | return { | ||
62 | activity: null, | ||
63 | warnings: null, | ||
64 | errors: null, | ||
65 | serverError: false, | ||
66 | }; | ||
67 | }, | ||
68 | created: function () { | ||
69 | this.fetchConfig(); | ||
70 | }, | ||
71 | methods: { | ||
72 | fetchConfig: function () { | ||
73 | fetch(`${this.item.url}/api/health`, { | ||
74 | credentials: "include", | ||
75 | headers: { "X-Api-Key": `${this.item.apikey}` }, | ||
76 | }) | ||
77 | .then((response) => { | ||
78 | if (response.status != 200) { | ||
79 | throw new Error(response.statusText); | ||
80 | } | ||
81 | return response.json(); | ||
82 | }) | ||
83 | .then((health) => { | ||
84 | this.warnings = 0; | ||
85 | this.errors = 0; | ||
86 | for (var i = 0; i < health.length; i++) { | ||
87 | if (health[i].type == "warning") { | ||
88 | this.warnings++; | ||
89 | } else if (health[i].type == "error") { | ||
90 | this.errors++; | ||
91 | } | ||
92 | } | ||
93 | }) | ||
94 | .catch((e) => { | ||
95 | console.error(e); | ||
96 | this.serverError = true; | ||
97 | }); | ||
98 | fetch(`${this.item.url}/api/queue`, { | ||
99 | credentials: "include", | ||
100 | headers: { "X-Api-Key": `${this.item.apikey}` }, | ||
101 | }) | ||
102 | .then((response) => { | ||
103 | if (response.status != 200) { | ||
104 | throw new Error(response.statusText); | ||
105 | } | ||
106 | return response.json(); | ||
107 | }) | ||
108 | .then((queue) => { | ||
109 | this.activity = 0; | ||
110 | for (var i = 0; i < queue.length; i++) { | ||
111 | if (queue[i].movie) { | ||
112 | this.activity++; | ||
113 | } | ||
114 | } | ||
115 | }) | ||
116 | .catch((e) => { | ||
117 | console.error(e); | ||
118 | this.serverError = true; | ||
119 | }); | ||
120 | }, | ||
121 | }, | ||
122 | }; | ||
123 | </script> | ||
124 | |||
125 | <style scoped lang="scss"> | ||
126 | .media-left img { | ||
127 | max-height: 100%; | ||
128 | } | ||
129 | .notifs { | ||
130 | position: absolute; | ||
131 | color: white; | ||
132 | font-family: sans-serif; | ||
133 | top: 0.3em; | ||
134 | right: 0.5em; | ||
135 | } | ||
136 | .notif { | ||
137 | padding-right: 0.35em; | ||
138 | padding-left: 0.35em; | ||
139 | padding-top: 0.2em; | ||
140 | padding-bottom: 0.2em; | ||
141 | border-radius: 0.25em; | ||
142 | position: relative; | ||
143 | margin-left: 0.3em; | ||
144 | font-size: 0.8em; | ||
145 | } | ||
146 | .activity { | ||
147 | background-color: #4fb5d6; | ||
148 | } | ||
149 | |||
150 | .warnings { | ||
151 | background-color: #d08d2e; | ||
152 | } | ||
153 | |||
154 | .errors { | ||
155 | background-color: #e51111; | ||
156 | } | ||
157 | </style> | ||
diff --git a/src/components/services/Sonarr.vue b/src/components/services/Sonarr.vue new file mode 100644 index 0000000..8cebac4 --- /dev/null +++ b/src/components/services/Sonarr.vue | |||
@@ -0,0 +1,157 @@ | |||
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">{{ item.subtitle }}</p> | ||
20 | </div> | ||
21 | <div class="notifs"> | ||
22 | <strong | ||
23 | v-if="activity > 0" | ||
24 | class="notif activity" | ||
25 | title="Activity" | ||
26 | >{{ activity }}</strong | ||
27 | > | ||
28 | <strong | ||
29 | v-if="warnings > 0" | ||
30 | class="notif warnings" | ||
31 | title="Warning" | ||
32 | >{{ warnings }}</strong | ||
33 | > | ||
34 | <strong v-if="errors > 0" class="notif errors" title="Error">{{ | ||
35 | errors | ||
36 | }}</strong> | ||
37 | <strong | ||
38 | v-if="serverError" | ||
39 | class="notif errors" | ||
40 | title="Connection error to Sonarr API, check url and apikey in config.yml" | ||
41 | >?</strong | ||
42 | > | ||
43 | </div> | ||
44 | </div> | ||
45 | <div class="tag" :class="item.tagstyle" v-if="item.tag"> | ||
46 | <strong class="tag-text">#{{ item.tag }}</strong> | ||
47 | </div> | ||
48 | </div> | ||
49 | </a> | ||
50 | </div> | ||
51 | </div> | ||
52 | </template> | ||
53 | |||
54 | <script> | ||
55 | export default { | ||
56 | name: "Sonarr", | ||
57 | props: { | ||
58 | item: Object, | ||
59 | }, | ||
60 | data: () => { | ||
61 | return { | ||
62 | activity: null, | ||
63 | warnings: null, | ||
64 | errors: null, | ||
65 | serverError: false, | ||
66 | }; | ||
67 | }, | ||
68 | created: function () { | ||
69 | this.fetchConfig(); | ||
70 | }, | ||
71 | methods: { | ||
72 | fetchConfig: function () { | ||
73 | fetch(`${this.item.url}/api/health`, { | ||
74 | credentials: "include", | ||
75 | headers: { "X-Api-Key": `${this.item.apikey}` }, | ||
76 | }) | ||
77 | .then((response) => { | ||
78 | if (response.status != 200) { | ||
79 | throw new Error(response.statusText); | ||
80 | } | ||
81 | return response.json(); | ||
82 | }) | ||
83 | .then((health) => { | ||
84 | this.warnings = 0; | ||
85 | this.errors = 0; | ||
86 | for (var i = 0; i < health.length; i++) { | ||
87 | if (health[i].type == "warning") { | ||
88 | this.warnings++; | ||
89 | } else if (health[i].type == "error") { | ||
90 | this.errors++; | ||
91 | } | ||
92 | } | ||
93 | }) | ||
94 | .catch((e) => { | ||
95 | console.error(e); | ||
96 | this.serverError = true; | ||
97 | }); | ||
98 | fetch(`${this.item.url}/api/queue`, { | ||
99 | credentials: "include", | ||
100 | headers: { "X-Api-Key": `${this.item.apikey}` }, | ||
101 | }) | ||
102 | .then((response) => { | ||
103 | if (response.status != 200) { | ||
104 | throw new Error(response.statusText); | ||
105 | } | ||
106 | return response.json(); | ||
107 | }) | ||
108 | .then((queue) => { | ||
109 | this.activity = 0; | ||
110 | for (var i = 0; i < queue.length; i++) { | ||
111 | if (queue[i].series) { | ||
112 | this.activity++; | ||
113 | } | ||
114 | } | ||
115 | }) | ||
116 | .catch((e) => { | ||
117 | console.error(e); | ||
118 | this.serverError = true; | ||
119 | }); | ||
120 | }, | ||
121 | }, | ||
122 | }; | ||
123 | </script> | ||
124 | |||
125 | <style scoped lang="scss"> | ||
126 | .media-left img { | ||
127 | max-height: 100%; | ||
128 | } | ||
129 | .notifs { | ||
130 | position: absolute; | ||
131 | color: white; | ||
132 | font-family: sans-serif; | ||
133 | top: 0.3em; | ||
134 | right: 0.5em; | ||
135 | } | ||
136 | .notif { | ||
137 | padding-right: 0.35em; | ||
138 | padding-left: 0.35em; | ||
139 | padding-top: 0.2em; | ||
140 | padding-bottom: 0.2em; | ||
141 | border-radius: 0.25em; | ||
142 | position: relative; | ||
143 | margin-left: 0.3em; | ||
144 | font-size: 0.8em; | ||
145 | } | ||
146 | .activity { | ||
147 | background-color: #4fb5d6; | ||
148 | } | ||
149 | |||
150 | .warnings { | ||
151 | background-color: #d08d2e; | ||
152 | } | ||
153 | |||
154 | .errors { | ||
155 | background-color: #e51111; | ||
156 | } | ||
157 | </style> | ||