feat: add missing notif for sonarr

pull/791/merge
royto 2023-08-06 23:18:02 +02:00 committed by Bastien Wirtz
parent 2389cac9b0
commit 4797047571
2 changed files with 22 additions and 18 deletions

View File

@ -104,7 +104,7 @@ The Medusa API key can be found in General configuration > Interface. It is need
## Lidarr, Prowlarr, Sonarr, Readarr and Radarr ## Lidarr, Prowlarr, Sonarr, Readarr and Radarr
This service displays Activity (blue), Warning (orange) or Error (red) notifications bubbles from the Lidarr, Readarr, Radarr or Sonarr application. This service displays Activity (blue), Warning (orange) or Error (red) notifications bubbles from the Lidarr, Readarr, Radarr or Sonarr application.
Readarr display also a Missing (purple) notification bubbles. Readarr and Sonarr display also a Missing (purple) notification bubbles.
Two lines are needed in the config.yml : Two lines are needed in the config.yml :
```yaml ```yaml

View File

@ -5,6 +5,9 @@
<strong v-if="activity > 0" class="notif activity" title="Activity"> <strong v-if="activity > 0" class="notif activity" title="Activity">
{{ activity }} {{ activity }}
</strong> </strong>
<strong v-if="missing > 0" class="notif missing" title="Missing">
{{ missing }}
</strong>
<strong v-if="warnings > 0" class="notif warnings" title="Warning"> <strong v-if="warnings > 0" class="notif warnings" title="Warning">
{{ warnings }} {{ warnings }}
</strong> </strong>
@ -47,6 +50,7 @@ export default {
data: () => { data: () => {
return { return {
activity: null, activity: null,
missing: null,
warnings: null, warnings: null,
errors: null, errors: null,
serverError: false, serverError: false,
@ -57,22 +61,16 @@ export default {
}, },
methods: { methods: {
fetchConfig: function () { fetchConfig: function () {
const handleError = (e) => {
console.error(e);
this.serverError = true;
};
this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`) this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`)
.then((health) => { .then((health) => {
this.warnings = 0; this.warnings = health.filter((h) => h.type === "warning").length;
this.errors = 0; this.errors = health.filter((h) => h.type === "errors").length;
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) => { .catch(handleError);
console.error(e);
this.serverError = true;
});
this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`) this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`)
.then((queue) => { .then((queue) => {
this.activity = 0; this.activity = 0;
@ -86,10 +84,12 @@ export default {
this.activity = queue.totalRecords; this.activity = queue.totalRecords;
} }
}) })
.catch((e) => { .catch(handleError);
console.error(e); this.fetch(`${this.apiPath}/wanted/missing?apikey=${this.item.apikey}`)
this.serverError = true; .then((missing) => {
}); this.missing = missing.totalRecords;
})
.catch(handleError);
}, },
}, },
}; };
@ -115,6 +115,10 @@ export default {
background-color: #4fb5d6; background-color: #4fb5d6;
} }
&.missing {
background-color: #9d00ff;
}
&.warnings { &.warnings {
background-color: #d08d2e; background-color: #d08d2e;
} }