mirror of
https://github.com/bastienwirtz/homer.git
synced 2024-12-25 08:09:05 +01:00
Merge branch 'main' into patch-1
This commit is contained in:
commit
a74fa38302
@ -43,8 +43,8 @@
|
||||
- [Features](#features)
|
||||
- [Getting started](#getting-started)
|
||||
- [Configuration](docs/configuration.md)
|
||||
- [Custom services](docs/customservices.md)
|
||||
- [Tips & tricks](docs/tips-and-tricks.md)
|
||||
- [Roadmap](#roadmap)
|
||||
- [Development](docs/development.md)
|
||||
|
||||
|
||||
@ -134,9 +134,3 @@ npm run build
|
||||
```
|
||||
|
||||
Then your dashboard is ready to use in the `/dist` directory.
|
||||
|
||||
|
||||
## Roadmap
|
||||
|
||||
- [ ] Add new themes.
|
||||
- [ ] Add support for custom service card (add custom feature to some service / app link)
|
||||
|
53
docs/customservices.md
Normal file
53
docs/customservices.md
Normal file
@ -0,0 +1,53 @@
|
||||
# Custom Services
|
||||
|
||||
Some service can use a specific a component that provides some extra features by adding a `type` key to the service yaml
|
||||
configuration. Available services are in `src/components/`. Here is an overview of all custom services that are available
|
||||
within Homer.
|
||||
|
||||
## PiHole
|
||||
|
||||
Using the PiHole service you can display info about your local PiHole instance right on your Homer dashboard.
|
||||
|
||||
The following configuration is available for the PiHole service.
|
||||
|
||||
```
|
||||
items:
|
||||
- name: "Pi-hole"
|
||||
logo: "assets/tools/sample.png"
|
||||
# subtitle: "Network-wide Ad Blocking" # optional, if no subtitle is defined, PiHole statistics will be shown
|
||||
url: "http://192.168.0.151/admin"
|
||||
type: "PiHole"
|
||||
```
|
||||
|
||||
## Medusa
|
||||
|
||||
This service displays News (grey), Warning (orange) or Error (red) notifications bubbles from the Medusa application.
|
||||
Two lines are needed in the config.yml :
|
||||
```
|
||||
type: "Medusa"
|
||||
apikey: "01234deb70424befb1f4ef6a23456789"
|
||||
```
|
||||
The url must be the root url of Medusa application.
|
||||
The Medusa API key can be found in General configuration > Interface. It is needed to access Medusa API.
|
||||
|
||||
|
||||
## Sonarr/Radarr
|
||||
|
||||
This service displays Activity (blue), Warning (orange) or Error (red) notifications bubbles from the Radarr/Sonarr application.
|
||||
Two lines are needed in the config.yml :
|
||||
```
|
||||
type: "Radarr" or "Sonarr"
|
||||
apikey: "01234deb70424befb1f4ef6a23456789"
|
||||
```
|
||||
The url must be the root url of Radarr/Sonarr application.
|
||||
The Radarr/Sonarr API key can be found in Settings > General. It is needed to access the API.
|
||||
|
||||
|
||||
## PaperlessNG
|
||||
|
||||
For Paperless you need an API-Key which you have to store at the item in the field `apikey`.
|
||||
|
||||
|
||||
## Ping
|
||||
|
||||
For Paperless you need an API-Key which you have to store at the item in the field `apikey`.
|
10
package.json
10
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "homer",
|
||||
"version": "21.03.2",
|
||||
"version": "21.07.1",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
@ -9,12 +9,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^5.15.3",
|
||||
"bulma": "^0.9.2",
|
||||
"core-js": "^3.10.1",
|
||||
"js-yaml": "^4.0.0",
|
||||
"bulma": "^0.9.3",
|
||||
"core-js": "^3.15.2",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"register-service-worker": "^1.7.2",
|
||||
"vue": "^2.6.12"
|
||||
"vue": "^2.6.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
|
@ -211,7 +211,7 @@ body {
|
||||
color: var(--highlight-secondary);
|
||||
background-color: var(--highlight-secondary);
|
||||
position: absolute;
|
||||
top: 1rem;
|
||||
bottom: 1rem;
|
||||
right: -0.2rem;
|
||||
width: 3px;
|
||||
overflow: hidden;
|
||||
@ -224,7 +224,6 @@ body {
|
||||
}
|
||||
|
||||
.card {
|
||||
border-radius: 5px;
|
||||
border: none;
|
||||
box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.1);
|
||||
transition: cubic-bezier(0.165, 0.84, 0.44, 1) 300ms;
|
||||
@ -260,11 +259,13 @@ body {
|
||||
}
|
||||
|
||||
.column div:first-of-type .card {
|
||||
border-radius: 5px 5px 0 0;
|
||||
border-top-left-radius: 0.25rem;
|
||||
border-top-right-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.column div:last-child .card {
|
||||
border-radius: 0 0 5px 5px;
|
||||
border-bottom-left-radius: 0.25rem;
|
||||
border-bottom-right-radius: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
@ -348,4 +349,4 @@ body {
|
||||
|
||||
.group-logo {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ export default {
|
||||
method: "HEAD",
|
||||
cache: "no-store",
|
||||
})
|
||||
.then(function () {
|
||||
that.offline = false;
|
||||
.then(function (response) {
|
||||
that.offline = !response.ok;
|
||||
})
|
||||
.catch(function () {
|
||||
that.offline = true;
|
||||
|
@ -54,7 +54,7 @@ export default {
|
||||
|
||||
// keep the original config value if no value is provided by the endpoint
|
||||
const message = this.message;
|
||||
for (const prop of ["title", "style", "content"]) {
|
||||
for (const prop of ["title", "style", "content", "icon"]) {
|
||||
if (prop in fetchedMessage && fetchedMessage[prop] !== null) {
|
||||
message[prop] = fetchedMessage[prop];
|
||||
}
|
||||
|
128
src/components/services/Medusa.vue
Normal file
128
src/components/services/Medusa.vue
Normal file
@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="card" :class="item.class">
|
||||
<a :href="item.url" :target="item.target" rel="noreferrer">
|
||||
<div class="card-content">
|
||||
<div class="media">
|
||||
<div v-if="item.logo" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<img :src="item.logo" :alt="`${item.name} logo`" />
|
||||
</figure>
|
||||
</div>
|
||||
<div v-if="item.icon" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<i style="font-size: 35px" :class="['fa-fw', item.icon]"></i>
|
||||
</figure>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<p class="title is-4">{{ item.name }}</p>
|
||||
<p class="subtitle is-6">{{ item.subtitle }}</p>
|
||||
</div>
|
||||
<div class="notifs">
|
||||
<strong
|
||||
v-if="config !== null && config.system.news.unread > 0"
|
||||
class="notif news"
|
||||
title="News"
|
||||
>{{ config.system.news.unread }}</strong
|
||||
>
|
||||
<strong
|
||||
v-if="config !== null && config.main.logs.numWarnings > 0"
|
||||
class="notif warnings"
|
||||
title="Warning"
|
||||
>{{ config.main.logs.numWarnings }}</strong
|
||||
>
|
||||
<strong
|
||||
v-if="config !== null && config.main.logs.numErrors > 0"
|
||||
class="notif errors"
|
||||
title="Error"
|
||||
>{{ config.main.logs.numErrors }}</strong
|
||||
>
|
||||
<strong
|
||||
v-if="serverError"
|
||||
class="notif errors"
|
||||
title="Connection error to Medusa API, check url and apikey in config.yml"
|
||||
>?</strong
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tag" :class="item.tagstyle" v-if="item.tag">
|
||||
<strong class="tag-text">#{{ item.tag }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Medusa",
|
||||
props: {
|
||||
item: Object,
|
||||
},
|
||||
data: () => {
|
||||
return {
|
||||
config: null,
|
||||
serverError: false,
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
this.fetchConfig();
|
||||
},
|
||||
methods: {
|
||||
fetchConfig: function () {
|
||||
fetch(`${this.item.url}/api/v2/config`, {
|
||||
credentials: "include",
|
||||
headers: { "X-Api-Key": `${this.item.apikey}` },
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((conf) => {
|
||||
this.config = conf;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
this.serverError = true;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.media-left img {
|
||||
max-height: 100%;
|
||||
}
|
||||
.notifs {
|
||||
position: absolute;
|
||||
color: white;
|
||||
font-family: sans-serif;
|
||||
top: 0.3em;
|
||||
right: 0.5em;
|
||||
}
|
||||
.notif {
|
||||
padding-right: 0.35em;
|
||||
padding-left: 0.35em;
|
||||
padding-top: 0.2em;
|
||||
padding-bottom: 0.2em;
|
||||
border-radius: 0.25em;
|
||||
position: relative;
|
||||
margin-left: 0.3em;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.news {
|
||||
background-color: #777777;
|
||||
}
|
||||
|
||||
.warnings {
|
||||
background-color: #d08d2e;
|
||||
}
|
||||
|
||||
.errors {
|
||||
background-color: #e51111;
|
||||
}
|
||||
</style>
|
83
src/components/services/PaperlessNG.vue
Normal file
83
src/components/services/PaperlessNG.vue
Normal file
@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="card" :class="item.class">
|
||||
<a :href="item.url" :target="item.target" rel="noreferrer">
|
||||
<div class="card-content">
|
||||
<div class="media">
|
||||
<div v-if="item.logo" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<img :src="item.logo" :alt="`${item.name} logo`" />
|
||||
</figure>
|
||||
</div>
|
||||
<div v-if="item.icon" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<i style="font-size: 35px" :class="['fa-fw', item.icon]"></i>
|
||||
</figure>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<p class="title is-4">{{ item.name }}</p>
|
||||
<p class="subtitle is-6">
|
||||
<template v-if="item.subtitle">
|
||||
{{ item.subtitle }}
|
||||
</template>
|
||||
<template v-else-if="api">
|
||||
happily storing {{ api.count }} documents
|
||||
</template>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tag" :class="item.tagstyle" v-if="item.tag">
|
||||
<strong class="tag-text">#{{ item.tag }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Paperless",
|
||||
props: {
|
||||
item: Object,
|
||||
},
|
||||
data: () => ({
|
||||
api: null,
|
||||
}),
|
||||
created() {
|
||||
this.fetchStatus();
|
||||
},
|
||||
methods: {
|
||||
fetchStatus: async function () {
|
||||
if (this.item.subtitle != null) return; // omitting unnecessary ajax call as the subtitle is showing
|
||||
var apikey = this.item.apikey;
|
||||
if (!apikey) {
|
||||
console.error(
|
||||
"apikey is not present in config.yml for the paperless entry!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
const url = `${this.item.url}/api/documents/`;
|
||||
this.api = await fetch(url, {
|
||||
headers: {
|
||||
Authorization: "Token " + this.item.apikey,
|
||||
},
|
||||
})
|
||||
.then(function (response) {
|
||||
if (!response.ok) {
|
||||
throw new Error("Not 2xx response");
|
||||
} else {
|
||||
return response.json();
|
||||
}
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.media-left img {
|
||||
max-height: 100%;
|
||||
}
|
||||
</style>
|
@ -83,13 +83,13 @@ export default {
|
||||
&.enabled:before {
|
||||
background-color: #94e185;
|
||||
border-color: #78d965;
|
||||
box-shadow: 0 0 4px 1px #94e185;
|
||||
box-shadow: 0 0 5px 1px #94e185;
|
||||
}
|
||||
|
||||
&.disabled:before {
|
||||
background-color: #c9404d;
|
||||
border-color: #c42c3b;
|
||||
box-shadow: 0 0 4px 1px #c9404d;
|
||||
box-shadow: 0 0 5px 1px #c9404d;
|
||||
}
|
||||
|
||||
&:before {
|
||||
|
98
src/components/services/Ping.vue
Normal file
98
src/components/services/Ping.vue
Normal file
@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="card" :class="item.class">
|
||||
<a :href="item.url" :target="item.target" rel="noreferrer">
|
||||
<div class="card-content">
|
||||
<div class="media">
|
||||
<div v-if="item.logo" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<img :src="item.logo" :alt="`${item.name} logo`" />
|
||||
</figure>
|
||||
</div>
|
||||
<div v-if="item.icon" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<i style="font-size: 35px" :class="['fa-fw', item.icon]"></i>
|
||||
</figure>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<p class="title is-4">{{ item.name }}</p>
|
||||
<p class="subtitle is-6">
|
||||
<template v-if="item.subtitle">
|
||||
{{ item.subtitle }}
|
||||
</template>
|
||||
</p>
|
||||
</div>
|
||||
<div v-if="status" class="status" :class="status">
|
||||
{{ status }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tag" :class="item.tagstyle" v-if="item.tag">
|
||||
<strong class="tag-text">#{{ item.tag }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Ping",
|
||||
props: {
|
||||
item: Object,
|
||||
},
|
||||
data: () => ({
|
||||
status: null,
|
||||
}),
|
||||
created() {
|
||||
this.fetchStatus();
|
||||
},
|
||||
methods: {
|
||||
fetchStatus: async function () {
|
||||
const url = `${this.item.url}`;
|
||||
fetch(url, { method: "HEAD", cache: "no-cache" })
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw Error(response.statusText);
|
||||
}
|
||||
this.status = "online";
|
||||
})
|
||||
.catch(() => {
|
||||
this.status = "offline";
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.media-left img {
|
||||
max-height: 100%;
|
||||
}
|
||||
.status {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-title);
|
||||
|
||||
&.online:before {
|
||||
background-color: #94e185;
|
||||
border-color: #78d965;
|
||||
box-shadow: 0 0 5px 1px #94e185;
|
||||
}
|
||||
|
||||
&.offline:before {
|
||||
background-color: #c9404d;
|
||||
border-color: #c42c3b;
|
||||
box-shadow: 0 0 5px 1px #c9404d;
|
||||
}
|
||||
|
||||
&:before {
|
||||
content: " ";
|
||||
display: inline-block;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
margin-right: 10px;
|
||||
border: 1px solid #000;
|
||||
border-radius: 7px;
|
||||
}
|
||||
}
|
||||
</style>
|
157
src/components/services/Radarr.vue
Normal file
157
src/components/services/Radarr.vue
Normal file
@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="card" :class="item.class">
|
||||
<a :href="item.url" :target="item.target" rel="noreferrer">
|
||||
<div class="card-content">
|
||||
<div class="media">
|
||||
<div v-if="item.logo" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<img :src="item.logo" :alt="`${item.name} logo`" />
|
||||
</figure>
|
||||
</div>
|
||||
<div v-if="item.icon" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<i style="font-size: 35px" :class="['fa-fw', item.icon]"></i>
|
||||
</figure>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<p class="title is-4">{{ item.name }}</p>
|
||||
<p class="subtitle is-6">{{ item.subtitle }}</p>
|
||||
</div>
|
||||
<div class="notifs">
|
||||
<strong
|
||||
v-if="activity > 0"
|
||||
class="notif activity"
|
||||
title="Activity"
|
||||
>{{ activity }}</strong
|
||||
>
|
||||
<strong
|
||||
v-if="warnings > 0"
|
||||
class="notif warnings"
|
||||
title="Warning"
|
||||
>{{ warnings }}</strong
|
||||
>
|
||||
<strong v-if="errors > 0" class="notif errors" title="Error">{{
|
||||
errors
|
||||
}}</strong>
|
||||
<strong
|
||||
v-if="serverError"
|
||||
class="notif errors"
|
||||
title="Connection error to Radarr API, check url and apikey in config.yml"
|
||||
>?</strong
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tag" :class="item.tagstyle" v-if="item.tag">
|
||||
<strong class="tag-text">#{{ item.tag }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Radarr",
|
||||
props: {
|
||||
item: Object,
|
||||
},
|
||||
data: () => {
|
||||
return {
|
||||
activity: null,
|
||||
warnings: null,
|
||||
errors: null,
|
||||
serverError: false,
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
this.fetchConfig();
|
||||
},
|
||||
methods: {
|
||||
fetchConfig: function () {
|
||||
fetch(`${this.item.url}/api/health`, {
|
||||
credentials: "include",
|
||||
headers: { "X-Api-Key": `${this.item.apikey}` },
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((health) => {
|
||||
this.warnings = 0;
|
||||
this.errors = 0;
|
||||
for (var i = 0; i < health.length; i++) {
|
||||
if (health[i].type == "warning") {
|
||||
this.warnings++;
|
||||
} else if (health[i].type == "error") {
|
||||
this.errors++;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
this.serverError = true;
|
||||
});
|
||||
fetch(`${this.item.url}/api/queue`, {
|
||||
credentials: "include",
|
||||
headers: { "X-Api-Key": `${this.item.apikey}` },
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((queue) => {
|
||||
this.activity = 0;
|
||||
for (var i = 0; i < queue.length; i++) {
|
||||
if (queue[i].movie) {
|
||||
this.activity++;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
this.serverError = true;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.media-left img {
|
||||
max-height: 100%;
|
||||
}
|
||||
.notifs {
|
||||
position: absolute;
|
||||
color: white;
|
||||
font-family: sans-serif;
|
||||
top: 0.3em;
|
||||
right: 0.5em;
|
||||
}
|
||||
.notif {
|
||||
padding-right: 0.35em;
|
||||
padding-left: 0.35em;
|
||||
padding-top: 0.2em;
|
||||
padding-bottom: 0.2em;
|
||||
border-radius: 0.25em;
|
||||
position: relative;
|
||||
margin-left: 0.3em;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.activity {
|
||||
background-color: #4fb5d6;
|
||||
}
|
||||
|
||||
.warnings {
|
||||
background-color: #d08d2e;
|
||||
}
|
||||
|
||||
.errors {
|
||||
background-color: #e51111;
|
||||
}
|
||||
</style>
|
157
src/components/services/Sonarr.vue
Normal file
157
src/components/services/Sonarr.vue
Normal file
@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="card" :class="item.class">
|
||||
<a :href="item.url" :target="item.target" rel="noreferrer">
|
||||
<div class="card-content">
|
||||
<div class="media">
|
||||
<div v-if="item.logo" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<img :src="item.logo" :alt="`${item.name} logo`" />
|
||||
</figure>
|
||||
</div>
|
||||
<div v-if="item.icon" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<i style="font-size: 35px" :class="['fa-fw', item.icon]"></i>
|
||||
</figure>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<p class="title is-4">{{ item.name }}</p>
|
||||
<p class="subtitle is-6">{{ item.subtitle }}</p>
|
||||
</div>
|
||||
<div class="notifs">
|
||||
<strong
|
||||
v-if="activity > 0"
|
||||
class="notif activity"
|
||||
title="Activity"
|
||||
>{{ activity }}</strong
|
||||
>
|
||||
<strong
|
||||
v-if="warnings > 0"
|
||||
class="notif warnings"
|
||||
title="Warning"
|
||||
>{{ warnings }}</strong
|
||||
>
|
||||
<strong v-if="errors > 0" class="notif errors" title="Error">{{
|
||||
errors
|
||||
}}</strong>
|
||||
<strong
|
||||
v-if="serverError"
|
||||
class="notif errors"
|
||||
title="Connection error to Sonarr API, check url and apikey in config.yml"
|
||||
>?</strong
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tag" :class="item.tagstyle" v-if="item.tag">
|
||||
<strong class="tag-text">#{{ item.tag }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Sonarr",
|
||||
props: {
|
||||
item: Object,
|
||||
},
|
||||
data: () => {
|
||||
return {
|
||||
activity: null,
|
||||
warnings: null,
|
||||
errors: null,
|
||||
serverError: false,
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
this.fetchConfig();
|
||||
},
|
||||
methods: {
|
||||
fetchConfig: function () {
|
||||
fetch(`${this.item.url}/api/health`, {
|
||||
credentials: "include",
|
||||
headers: { "X-Api-Key": `${this.item.apikey}` },
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((health) => {
|
||||
this.warnings = 0;
|
||||
this.errors = 0;
|
||||
for (var i = 0; i < health.length; i++) {
|
||||
if (health[i].type == "warning") {
|
||||
this.warnings++;
|
||||
} else if (health[i].type == "error") {
|
||||
this.errors++;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
this.serverError = true;
|
||||
});
|
||||
fetch(`${this.item.url}/api/queue`, {
|
||||
credentials: "include",
|
||||
headers: { "X-Api-Key": `${this.item.apikey}` },
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status != 200) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((queue) => {
|
||||
this.activity = 0;
|
||||
for (var i = 0; i < queue.length; i++) {
|
||||
if (queue[i].series) {
|
||||
this.activity++;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
this.serverError = true;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.media-left img {
|
||||
max-height: 100%;
|
||||
}
|
||||
.notifs {
|
||||
position: absolute;
|
||||
color: white;
|
||||
font-family: sans-serif;
|
||||
top: 0.3em;
|
||||
right: 0.5em;
|
||||
}
|
||||
.notif {
|
||||
padding-right: 0.35em;
|
||||
padding-left: 0.35em;
|
||||
padding-top: 0.2em;
|
||||
padding-bottom: 0.2em;
|
||||
border-radius: 0.25em;
|
||||
position: relative;
|
||||
margin-left: 0.3em;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.activity {
|
||||
background-color: #4fb5d6;
|
||||
}
|
||||
|
||||
.warnings {
|
||||
background-color: #d08d2e;
|
||||
}
|
||||
|
||||
.errors {
|
||||
background-color: #e51111;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user