Made chart-period global instead of individual (#6049)

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
Kanwarpreet Singh 2025-08-09 22:22:15 +05:30 committed by GitHub
parent 4b5ff08cdd
commit f027ce309e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -182,7 +182,7 @@ export default {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (newPeriod == "0") { if (newPeriod == "0") {
this.heartbeatList = null; this.heartbeatList = null;
this.$root.storage().removeItem(`chart-period-${this.monitorId}`); this.$root.storage()["chart-period"] = newPeriod;
} else { } else {
this.loading = true; this.loading = true;
@ -199,7 +199,7 @@ export default {
this.$root.toastError(res.msg); this.$root.toastError(res.msg);
} else { } else {
this.chartRawData = res.data; this.chartRawData = res.data;
this.$root.storage()[`chart-period-${this.monitorId}`] = newPeriod; this.$root.storage()["chart-period"] = newPeriod;
} }
this.loading = false; this.loading = false;
}); });
@ -216,7 +216,7 @@ export default {
}, },
created() { created() {
// Load chart period from storage if saved // Load chart period from storage if saved
let period = this.$root.storage()[`chart-period-${this.monitorId}`]; let period = this.$root.storage()["chart-period"];
if (period != null) { if (period != null) {
// Has this ever been not a string? // Has this ever been not a string?
if (typeof period !== "string") { if (typeof period !== "string") {
@ -224,7 +224,7 @@ export default {
} }
this.chartPeriodHrs = period; this.chartPeriodHrs = period;
} else { } else {
this.chartPeriodHrs = "24"; this.chartPeriodHrs = "0";
} }
}, },
beforeUnmount() { beforeUnmount() {