Make auto refresh interval customizable (#4260)

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
Laurent Aupse
2024-05-19 21:56:55 +02:00
committed by GitHub
parent 4e24e96dab
commit e856cb6007
5 changed files with 34 additions and 8 deletions

View File

@@ -361,6 +361,8 @@
"Proxy": "Proxy",
"Date Created": "Date Created",
"Footer Text": "Footer Text",
"Refresh Interval": "Refresh Interval",
"Refresh Interval Description": "The status page will do a full site refresh every {0} seconds",
"Show Powered By": "Show Powered By",
"Domain Names": "Domain Names",
"signedInDisp": "Signed in as {0}",

View File

@@ -34,6 +34,14 @@
</div>
</div>
<div class="my-3">
<label for="auto-refresh-interval" class="form-label">{{ $t("Refresh Interval") }}</label>
<input id="auto-refresh-interval" v-model="config.autoRefreshInterval" type="number" class="form-control" :min="5">
<div class="form-text">
{{ $t("Refresh Interval Description", [config.autoRefreshInterval]) }}
</div>
</div>
<div class="my-3">
<label for="switch-theme" class="form-label">{{ $t("Theme") }}</label>
<select id="switch-theme" v-model="config.theme" class="form-select">
@@ -438,7 +446,6 @@ export default {
baseURL: "",
clickedEditButton: false,
maintenanceList: [],
autoRefreshInterval: 5,
lastUpdateTime: dayjs(),
updateCountdown: null,
updateCountdownText: null,
@@ -708,6 +715,13 @@ export default {
this.$root.publicGroupList = res.data.publicGroupList;
this.loading = false;
// Configure auto-refresh loop
feedInterval = setInterval(() => {
this.updateHeartbeatList();
}, (this.config.autoRefreshInterval + 10) * 1000);
this.updateUpdateTimer();
}).catch( function (error) {
if (error.response.status === 404) {
location.href = "/page-not-found";
@@ -715,13 +729,7 @@ export default {
console.log(error);
});
// Configure auto-refresh loop
this.updateHeartbeatList();
feedInterval = setInterval(() => {
this.updateHeartbeatList();
}, (this.autoRefreshInterval * 60 + 10) * 1000);
this.updateUpdateTimer();
// Go to edit page if ?edit present
// null means ?edit present, but no value
@@ -797,7 +805,7 @@ export default {
clearInterval(this.updateCountdown);
this.updateCountdown = setInterval(() => {
const countdown = dayjs.duration(this.lastUpdateTime.add(this.autoRefreshInterval, "minutes").add(10, "seconds").diff(dayjs()));
const countdown = dayjs.duration(this.lastUpdateTime.add(this.config.autoRefreshInterval, "seconds").add(10, "seconds").diff(dayjs()));
if (countdown.as("seconds") < 0) {
clearInterval(this.updateCountdown);
} else {