From 410805052e48776dd83bf3973619e38f61030c35 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sun, 1 May 2022 17:46:43 +0800 Subject: [PATCH 1/2] Log this.chartPeriodHrs --- src/components/PingChart.vue | 5 ++++- src/util.js | 2 +- src/util.ts | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/PingChart.vue b/src/components/PingChart.vue index eb907e2d..b35d999c 100644 --- a/src/components/PingChart.vue +++ b/src/components/PingChart.vue @@ -24,7 +24,7 @@ import timezone from "dayjs/plugin/timezone"; import utc from "dayjs/plugin/utc"; import { LineChart } from "vue-chart-3"; import { useToast } from "vue-toastification"; -import { DOWN } from "../util.ts"; +import { DOWN, log } from "../util.ts"; dayjs.extend(utc); dayjs.extend(timezone); @@ -240,6 +240,9 @@ export default { // And mirror latest change to this.heartbeatList this.$watch(() => this.$root.heartbeatList[this.monitorId], (heartbeatList) => { + + log.debug("ping_chart", `this.chartPeriodHrs type ${typeof this.chartPeriodHrs}, value: ${this.chartPeriodHrs}`); + if (this.chartPeriodHrs !== "0") { const newBeat = heartbeatList.at(-1); if (newBeat && dayjs.utc(newBeat.time) > dayjs.utc(this.heartbeatList.at(-1)?.time)) { diff --git a/src/util.js b/src/util.js index b1f55201..ee6095e0 100644 --- a/src/util.js +++ b/src/util.js @@ -102,7 +102,7 @@ class Logger { } else if (level === "DEBUG") { if (exports.isDev) { - console.debug(formattedMessage); + console.log(formattedMessage); } } else { diff --git a/src/util.ts b/src/util.ts index 75abd662..057090b7 100644 --- a/src/util.ts +++ b/src/util.ts @@ -113,7 +113,7 @@ class Logger { console.error(formattedMessage); } else if (level === "DEBUG") { if (isDev) { - console.debug(formattedMessage); + console.log(formattedMessage); } } else { console.log(formattedMessage); From a12dffd1bc6bb9955f1d66ab1f9c1d269c051bb5 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sun, 1 May 2022 17:56:42 +0800 Subject: [PATCH 2/2] Fallback to eqeq for PingChart.vue --- src/components/PingChart.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/PingChart.vue b/src/components/PingChart.vue index b35d999c..67bdc00c 100644 --- a/src/components/PingChart.vue +++ b/src/components/PingChart.vue @@ -217,7 +217,9 @@ export default { watch: { // Update chart data when the selected chart period changes chartPeriodHrs: function (newPeriod) { - if (newPeriod === "0") { + + // eslint-disable-next-line eqeqeq + if (newPeriod == "0") { this.heartbeatList = null; this.$root.storage().removeItem(`chart-period-${this.monitorId}`); } else { @@ -243,7 +245,8 @@ export default { log.debug("ping_chart", `this.chartPeriodHrs type ${typeof this.chartPeriodHrs}, value: ${this.chartPeriodHrs}`); - if (this.chartPeriodHrs !== "0") { + // eslint-disable-next-line eqeqeq + if (this.chartPeriodHrs != "0") { const newBeat = heartbeatList.at(-1); if (newBeat && dayjs.utc(newBeat.time) > dayjs.utc(this.heartbeatList.at(-1)?.time)) { this.heartbeatList.push(heartbeatList.at(-1));