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() { toggleGroup() {
this.collapsed = !this.collapsed; 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) { showTooltip(result, event) {
this.$emit('showTooltip', result, event); this.$emit('showTooltip', result, event);
@ -80,7 +80,7 @@ export default {
data() { data() {
return { return {
unhealthyCount: 0, 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: {}, props: {},
methods: { methods: {
setRefreshInterval(seconds) { setRefreshInterval(seconds) {
sessionStorage.setItem('gatus:refresh-interval', seconds); localStorage.setItem('gatus:refresh-interval', seconds);
let that = this; let that = this;
this.refreshIntervalHandler = setInterval(function () { this.refreshIntervalHandler = setInterval(function () {
that.refreshData(); that.refreshData();
@ -78,7 +78,7 @@ export default {
}, },
data() { data() {
return { 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, refreshIntervalHandler: 0,
darkMode: true darkMode: true
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long