mirror of https://github.com/Lissy93/dashy.git
✨ Adds option for continious status checking
This commit is contained in:
parent
88c48ec1f3
commit
8eeadbc98f
|
@ -37,6 +37,17 @@ sections:
|
||||||
statusCheck: true
|
statusCheck: true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Continuous Checking
|
||||||
|
By default, with status indicators enabled Dashy will check an applications status on page load, and will not keep indicators updated. This is usually desirable behavior. However, if you do want the status indicators to continue to poll your running services, this can be enabled by setting the `statusCheckInterval` attribute. Here you define an interval in seconds, and Dashy will poll your apps every x seconds. Note that if this number is very low (below 5 seconds), you may notice the app running slightly slower.
|
||||||
|
|
||||||
|
The following example, will instruct Dashy to continuously check the status of your services every 20 seconds
|
||||||
|
|
||||||
|
```
|
||||||
|
appConfig:
|
||||||
|
statusCheck: true
|
||||||
|
statusCheckInterval: 20
|
||||||
|
```
|
||||||
|
|
||||||
## How it Works
|
## How it Works
|
||||||
|
|
||||||
When Dashy is loaded, items with `statusCheck` enabled will make a request, to `https://[your-host-name]/ping?url=[address-or-servce]`, which in turn will ping that running service, and respond with a status code. Response time is calculated from the difference between start and end time of the request.
|
When Dashy is loaded, items with `statusCheck` enabled will make a request, to `https://[your-host-name]/ping?url=[address-or-servce]`, which in turn will ping that running service, and respond with a status code. Response time is calculated from the difference between start and end time of the request.
|
||||||
|
|
|
@ -53,6 +53,7 @@ export default {
|
||||||
},
|
},
|
||||||
itemSize: String,
|
itemSize: String,
|
||||||
enableStatusCheck: Boolean,
|
enableStatusCheck: Boolean,
|
||||||
|
statusCheckInterval: Number,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -114,6 +115,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkWebsiteStatus() {
|
checkWebsiteStatus() {
|
||||||
|
this.statusResponse = undefined;
|
||||||
const baseUrl = process.env.VUE_APP_DOMAIN || window.location.origin;
|
const baseUrl = process.env.VUE_APP_DOMAIN || window.location.origin;
|
||||||
const endpoint = `${baseUrl}/ping?url=${this.url}`;
|
const endpoint = `${baseUrl}/ping?url=${this.url}`;
|
||||||
axios.get(endpoint)
|
axios.get(endpoint)
|
||||||
|
@ -131,6 +133,9 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.manageTitleEllipse();
|
this.manageTitleEllipse();
|
||||||
if (this.enableStatusCheck) this.checkWebsiteStatus();
|
if (this.enableStatusCheck) this.checkWebsiteStatus();
|
||||||
|
if (this.statusCheckInterval > 0) {
|
||||||
|
setInterval(this.checkWebsiteStatus, this.statusCheckInterval * 1000);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
:backgroundColor="item.backgroundColor"
|
:backgroundColor="item.backgroundColor"
|
||||||
:itemSize="newItemSize"
|
:itemSize="newItemSize"
|
||||||
:enableStatusCheck="shouldEnableStatusCheck(item.statusCheck)"
|
:enableStatusCheck="shouldEnableStatusCheck(item.statusCheck)"
|
||||||
|
:statusCheckInterval="getStatusCheckInterval()"
|
||||||
@itemClicked="$emit('itemClicked')"
|
@itemClicked="$emit('itemClicked')"
|
||||||
@triggerModal="triggerModal"
|
@triggerModal="triggerModal"
|
||||||
/>
|
/>
|
||||||
|
@ -98,6 +99,13 @@ export default {
|
||||||
const globalPreference = this.config.appConfig.statusCheck || false;
|
const globalPreference = this.config.appConfig.statusCheck || false;
|
||||||
return itemPreference !== undefined ? itemPreference : globalPreference;
|
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>
|
</script>
|
||||||
|
|
|
@ -131,6 +131,11 @@
|
||||||
"default": false,
|
"default": false,
|
||||||
"description": "Displays an online/ offline status for each of your services"
|
"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": {
|
"auth": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Usernames and hashed credentials for frontend authentication",
|
"description": "Usernames and hashed credentials for frontend authentication",
|
||||||
|
|
Loading…
Reference in New Issue