mirror of https://github.com/bastienwirtz/homer
Scrutiny custom service
parent
794ac79f52
commit
88d675d7f5
|
@ -406,6 +406,18 @@ the "Config" > "General" section of the SABnzbd config in the SABnzbd web UI.
|
|||
downloadInterval: 5000 # (Optional) Interval (in ms) for updating the download count
|
||||
```
|
||||
|
||||
## Scrutiny
|
||||
|
||||
This service displays info about the total number of disk passed and failed S.M.A.R.T and scrutiny checks
|
||||
|
||||
```yaml
|
||||
- name: "Scrutiny"
|
||||
logo: "assets/tools/sample.png"
|
||||
url: "http://192.168.0.151:8080"
|
||||
type: "Scrutiny"
|
||||
updateInterval: 5000 # (Optional) Interval (in ms) for updating the status
|
||||
```
|
||||
|
||||
## OctoPrint/Moonraker
|
||||
|
||||
The OctoPrint/Moonraker service only needs an `apikey` & `endpoint` and optionally a `display` or `url` option. `url` can be used when you click on the service it will launch the `url`
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<Generic :item="item">
|
||||
<template #indicator>
|
||||
<div class="notifs">
|
||||
<strong v-if="passed > 0" class="notif passed" title="Passed">
|
||||
{{ passed }}
|
||||
</strong>
|
||||
<strong v-if="failed > 0" class="notif failed" title="Failed">
|
||||
{{ failed }}
|
||||
</strong>
|
||||
<strong v-if="unknown > 0" class="notif unknown" title="Unknown">
|
||||
{{ unknown }}
|
||||
</strong>
|
||||
<strong
|
||||
v-if="serverError"
|
||||
class="notif errors"
|
||||
title="Connection error to Scrutiny API, check your url in config.yml"
|
||||
>?</strong
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</Generic>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import service from "@/mixins/service.js";
|
||||
import Generic from "./Generic.vue";
|
||||
|
||||
export default {
|
||||
name: "Scrutiny",
|
||||
components: {
|
||||
Generic,
|
||||
},
|
||||
mixins: [service],
|
||||
props: {
|
||||
item: Object,
|
||||
},
|
||||
data: () => {
|
||||
return {
|
||||
passed: null,
|
||||
failed: null,
|
||||
unknown: null,
|
||||
serverError: false,
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
const updateInterval = parseInt(this.item.updateInterval, 10) || 0;
|
||||
if (updateInterval > 0) {
|
||||
setInterval(() => this.fetchSummary(), updateInterval);
|
||||
}
|
||||
this.fetchSummary();
|
||||
},
|
||||
methods: {
|
||||
fetchSummary: function () {
|
||||
this.fetch(`/api/summary`)
|
||||
.then((scrutinyData) => {
|
||||
const devices = Object.values(scrutinyData.data.summary);
|
||||
this.passed = devices.filter(device => device.device.device_status === 0)?.length || 0;
|
||||
this.failed = devices.filter(device => device.device.device_status > 0 && device.device.device_status <= 3)?.length || 0;
|
||||
this.unknown = devices.length - (this.passed + this.failed) || 0;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
this.serverError = true;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.notifs {
|
||||
position: absolute;
|
||||
color: white;
|
||||
font-family: sans-serif;
|
||||
top: 0.3em;
|
||||
right: 0.5em;
|
||||
.notif {
|
||||
display: inline-block;
|
||||
padding: 0.2em 0.35em;
|
||||
border-radius: 0.25em;
|
||||
position: relative;
|
||||
margin-left: 0.3em;
|
||||
font-size: 0.8em;
|
||||
&.passed {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
&.failed {
|
||||
background-color: #e51111;
|
||||
}
|
||||
|
||||
&.unknown {
|
||||
background-color: #d08d2e;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue