From d23cb0b382fdd828d08b6aaacab0ee499f758fb7 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 8 May 2023 04:08:30 +0800 Subject: [PATCH 1/8] Fix maintenance do not start after 1.21.2 --- server/model/maintenance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/maintenance.js b/server/model/maintenance.js index 787953fb89..43f826b3a1 100644 --- a/server/model/maintenance.js +++ b/server/model/maintenance.js @@ -290,7 +290,7 @@ class Maintenance extends BeanModel { } getRunningTimeslot() { - let start = dayjs(this.beanMeta.job.nextRun(dayjs().add(-this.duration, "second").format("YYYY-MM-DD HH:mm:ss"))); + let start = dayjs(this.beanMeta.job.nextRun(dayjs().add(-this.duration, "second").toDate())); let end = start.add(this.duration, "second"); let current = dayjs(); From aa8454b73f0627f156f77ad5c8470c0dd4e267c3 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 8 May 2023 04:14:24 +0800 Subject: [PATCH 2/8] Slightly improve error check on maintenance edit page --- src/pages/EditMaintenance.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pages/EditMaintenance.vue b/src/pages/EditMaintenance.vue index eb9ef7fd7e..493005a899 100644 --- a/src/pages/EditMaintenance.vue +++ b/src/pages/EditMaintenance.vue @@ -218,17 +218,17 @@
- +
{{ $t("startDateTime") }}
- +
{{ $t("endDateTime") }}
- +
@@ -272,7 +272,6 @@ export default { selectedStatusPages: [], dark: (this.$root.theme === "dark"), neverEnd: false, - minDate: this.$root.date(dayjs()) + " 00:00", lastDays: [ { langKey: "lastDay1", @@ -411,7 +410,7 @@ export default { cron: "30 3 * * *", durationMinutes: 60, intervalDay: 1, - dateRange: [ this.minDate ], + dateRange: [], timeRange: [{ hours: 2, minutes: 0, From 72c16c3aa24c2ff82f9c8a683db3473e83ce1a3e Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 8 May 2023 04:26:11 +0800 Subject: [PATCH 3/8] Fix eslint warnings --- server/database.js | 1 - server/notification-providers/opsgenie.js | 2 +- src/pages/EditMaintenance.vue | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/server/database.js b/server/database.js index 8576bdedcc..d8e40b8dd2 100644 --- a/server/database.js +++ b/server/database.js @@ -2,7 +2,6 @@ const fs = require("fs"); const { R } = require("redbean-node"); const { setSetting, setting } = require("./util-server"); const { log, sleep } = require("../src/util"); -const dayjs = require("dayjs"); const knex = require("knex"); const { PluginsManager } = require("./plugins-manager"); diff --git a/server/notification-providers/opsgenie.js b/server/notification-providers/opsgenie.js index 16bf9fc600..5fa7f3e4ee 100644 --- a/server/notification-providers/opsgenie.js +++ b/server/notification-providers/opsgenie.js @@ -15,7 +15,7 @@ class Opsgenie extends NotificationProvider { */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let opsgenieAlertsUrl; - let priority = (notification.opsgeniePriority == "") ? 3 : notification.opsgeniePriority; + let priority = (!notification.opsgeniePriority) ? 3 : notification.opsgeniePriority; const textMsg = "Uptime Kuma Alert"; try { diff --git a/src/pages/EditMaintenance.vue b/src/pages/EditMaintenance.vue index 493005a899..93082e4cff 100644 --- a/src/pages/EditMaintenance.vue +++ b/src/pages/EditMaintenance.vue @@ -248,7 +248,6 @@