ui: Use localStorage instead of sessionStorage for refresh interval + collapsed groups

Fixes #509

Supersedes #510
This commit is contained in:
TwiN 2023-10-16 21:35:43 -04:00
parent 315f9b7792
commit 71c4d3ade1
4 changed files with 6 additions and 6 deletions

View File

@ -60,7 +60,7 @@ export default {
},
toggleGroup() {
this.collapsed = !this.collapsed;
sessionStorage.setItem(`gatus:endpoint-group:${this.name}:collapsed`, this.collapsed);
localStorage.setItem(`gatus:endpoint-group:${this.name}:collapsed`, this.collapsed);
},
showTooltip(result, event) {
this.$emit('showTooltip', result, event);
@ -80,7 +80,7 @@ export default {
data() {
return {
unhealthyCount: 0,
collapsed: sessionStorage.getItem(`gatus:endpoint-group:${this.name}:collapsed`) === "true"
collapsed: localStorage.getItem(`gatus:endpoint-group:${this.name}:collapsed`) === "true"
}
}
}

View File

@ -33,7 +33,7 @@ export default {
props: {},
methods: {
setRefreshInterval(seconds) {
sessionStorage.setItem('gatus:refresh-interval', seconds);
localStorage.setItem('gatus:refresh-interval', seconds);
let that = this;
this.refreshIntervalHandler = setInterval(function () {
that.refreshData();
@ -78,7 +78,7 @@ export default {
},
data() {
return {
refreshInterval: sessionStorage.getItem('gatus:refresh-interval') < 10 ? 300 : parseInt(sessionStorage.getItem('gatus:refresh-interval')),
refreshInterval: localStorage.getItem('gatus:refresh-interval') < 10 ? 300 : parseInt(localStorage.getItem('gatus:refresh-interval')),
refreshIntervalHandler: 0,
darkMode: true
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long