feat: auto update for glances widget

This commit is contained in:
Manuel Quarneti 2024-09-21 15:41:05 +02:00
parent e377b005e0
commit 4421fb99e4
2 changed files with 7 additions and 1 deletions

View File

@ -516,7 +516,7 @@ services:
container_name: glances container_name: glances
environment: environment:
- TZ=Europe/Rome - TZ=Europe/Rome
- GLANCES_OPT=-w --disable-webui - GLANCES_OPT=-w
ports: ports:
- 61208:61208 - 61208:61208
restart: unless-stopped restart: unless-stopped
@ -533,9 +533,11 @@ services:
url: http://192.168.1.2:61208 url: http://192.168.1.2:61208
type: Glances type: Glances
stat: cpu stat: cpu
updateInterval: 5000 # (Optional) Interval (in ms) for updating the stats
- name: Memory - name: Memory
icon: fas fa-memory icon: fas fa-memory
url: http://192.168.1.2:61208 url: http://192.168.1.2:61208
type: Glances type: Glances
stat: mem stat: mem
updateInterval: 5000 # (Optional) Interval (in ms) for updating the stats
``` ```

View File

@ -24,6 +24,10 @@ export default {
percentage: 0, percentage: 0,
}), }),
created() { created() {
const updateInterval = parseInt(this.item.updateInterval, 10) || 0;
if (updateInterval > 0) {
setInterval(() => this.fetchStat(), updateInterval);
}
this.fetchStat(); this.fetchStat();
}, },
methods: { methods: {