Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Nextcloud custom service #650

Merged
merged 4 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/customservices.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ within Homer:
- [SABnzbd](#sabnzbd)
- [OctoPrint](#octoprint)
- [Tdarr](#tdarr)
- [Nextcloud](#nextcloud)

If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page.

Expand Down Expand Up @@ -411,3 +412,17 @@ for transcoding on your Tdarr instance as well as the number of errored items.
type: "Tdarr"
checkInterval: 5000 # (Optional) Interval (in ms) for updating the queue & error counts
```

## Nextcloud

This service displays a version string instead of a subtitle. The indicator
shows if Nextcloud is online, offline, or in [maintenance
mode](https://docs.nextcloud.com/server/stable/admin_manual/maintenance/upgrade.html#maintenance-mode).
Example configuration:

```yaml
- name: Nextcloud
type: Nextcloud
logo: assets/tools/sample.png
url: http://nextcloud.example.com
```
106 changes: 106 additions & 0 deletions src/components/services/Nextcloud.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<template>
<Generic :item="item">
<template #content>
<p class="title is-4">{{ item.name }}</p>
<p class="subtitle is-6">
<template v-if="versionstring">
Version {{ versionstring }}
</template>
</p>
</template>
<template #indicator>
<div v-if="status" class="status" :class="status">
{{ status }}
</div>
</template>
</Generic>
</template>

<script>
import service from "@/mixins/service.js";
import Generic from "./Generic.vue";

export default {
name: "Nextcloud",
mixins: [service],
props: {
item: Object,
},
components: {
Generic,
},
data: () => ({
status: null,
fetchOk: null,
versionstring: null,
maintenance: null,
}),
computed: {
status: function () {
if (this.fetchOk) {
if (this.maintenance) {
return "maintenance";
} else {
return "online";
}
} else {
return "offline";
}
meonkeys marked this conversation as resolved.
Show resolved Hide resolved
},
},
created() {
this.fetchStatus();
},
methods: {
fetchStatus: async function () {
this.fetch("/status.php")
.then((response) => {
this.fetchOk = true;
this.versionstring = response.versionstring;
this.maintenance = response.maintenance;
})
.catch((e) => {
this.fetchOk = false;
console.log(e);
});
},
},
};
</script>

<style scoped lang="scss">
.status {
font-size: 0.8rem;
color: var(--text-title);
white-space: nowrap;
margin-left: 0.25rem;

&.online:before {
background-color: #94e185;
border-color: #78d965;
box-shadow: 0 0 5px 1px #94e185;
}

&.maintenance:before {
background-color: #f8a306;
border-color: #e1b35e;
box-shadow: 0 0 5px 1px #f8a306;
}

&.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>