@@ -53,6 +53,7 @@ export default {
|
||||
},
|
||||
itemSize: String,
|
||||
enableStatusCheck: Boolean,
|
||||
statusCheckInterval: Number,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -114,6 +115,7 @@ export default {
|
||||
}
|
||||
},
|
||||
checkWebsiteStatus() {
|
||||
this.statusResponse = undefined;
|
||||
const baseUrl = process.env.VUE_APP_DOMAIN || window.location.origin;
|
||||
const endpoint = `${baseUrl}/ping?url=${this.url}`;
|
||||
axios.get(endpoint)
|
||||
@@ -131,6 +133,9 @@ export default {
|
||||
mounted() {
|
||||
this.manageTitleEllipse();
|
||||
if (this.enableStatusCheck) this.checkWebsiteStatus();
|
||||
if (this.statusCheckInterval > 0) {
|
||||
setInterval(this.checkWebsiteStatus, this.statusCheckInterval * 1000);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
:backgroundColor="item.backgroundColor"
|
||||
:itemSize="newItemSize"
|
||||
:enableStatusCheck="shouldEnableStatusCheck(item.statusCheck)"
|
||||
:statusCheckInterval="getStatusCheckInterval()"
|
||||
@itemClicked="$emit('itemClicked')"
|
||||
@triggerModal="triggerModal"
|
||||
/>
|
||||
@@ -98,6 +99,13 @@ export default {
|
||||
const globalPreference = this.config.appConfig.statusCheck || false;
|
||||
return itemPreference !== undefined ? itemPreference : globalPreference;
|
||||
},
|
||||
getStatusCheckInterval() {
|
||||
let interval = this.config.appConfig.statusCheckInterval;
|
||||
if (!interval) return 0;
|
||||
if (interval > 60) interval = 60;
|
||||
if (interval < 1) interval = 0;
|
||||
return interval;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -131,6 +131,11 @@
|
||||
"default": false,
|
||||
"description": "Displays an online/ offline status for each of your services"
|
||||
},
|
||||
"statusCheckInterval": {
|
||||
"type": "number",
|
||||
"default": 0,
|
||||
"description": "How often to recheck statuses. If set to 0, status will only be checked on page load"
|
||||
},
|
||||
"auth": {
|
||||
"type": "array",
|
||||
"description": "Usernames and hashed credentials for frontend authentication",
|
||||
|
||||
Reference in New Issue
Block a user