From f78d01d770e36cb80abbb0c73858b53c4cde37f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Kr=C3=BDda?= Date: Sat, 30 Apr 2022 14:57:08 +0200 Subject: [PATCH] Resolve lint errors --- CNAME | 2 +- public/icon.svg | 2 +- server/model/monitor.js | 8 ++-- src/components/MonitorList.vue | 73 +++++++++++++++++++------------- src/components/Uptime.vue | 6 +-- src/mixins/datetime.js | 5 ++- src/mixins/socket.js | 6 +-- src/pages/Dashboard.vue | 4 +- src/pages/EditMaintenance.vue | 39 +++++++++++------ src/pages/MaintenanceDetails.vue | 8 ++-- src/pages/StatusPage.vue | 34 ++++++++------- 11 files changed, 106 insertions(+), 81 deletions(-) diff --git a/CNAME b/CNAME index a5348b076..442505166 100644 --- a/CNAME +++ b/CNAME @@ -1 +1 @@ -git.kuma.pet \ No newline at end of file +git.kuma.pet diff --git a/public/icon.svg b/public/icon.svg index 825c344e2..9c0bc6cae 100644 --- a/public/icon.svg +++ b/public/icon.svg @@ -1,3 +1,3 @@ - \ No newline at end of file + diff --git a/server/model/monitor.js b/server/model/monitor.js index 115f86dac..23876ac75 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -212,8 +212,7 @@ class Monitor extends BeanModel { if (await Monitor.isUnderMaintenance(this.id)) { bean.msg = "Monitor under maintenance"; bean.status = MAINTENANCE; - } - else if (this.type === "http" || this.type === "keyword") { + } else if (this.type === "http" || this.type === "keyword") { // Do not do any queries/high loading things before the "bean.ping" let startTime = dayjs().valueOf(); @@ -482,8 +481,7 @@ class Monitor extends BeanModel { if (Monitor.isImportantForNotification(isFirstBeat, previousBeat?.status, bean.status)) { log.debug("monitor", `[${this.name}] sendNotification`); await Monitor.sendNotification(isFirstBeat, this, bean); - } - else { + } else { log.debug("monitor", `[${this.name}] will not sendNotification because it is (or was) under maintenance`); } @@ -950,7 +948,7 @@ class Monitor extends BeanModel { } static async isUnderMaintenance(monitorID) { - const maintenance = await R.getRow("SELECT COUNT(*) AS count FROM monitor_maintenance mm JOIN maintenance ON mm.maintenance_id = maintenance.id WHERE mm.monitor_id = ? AND datetime(maintenance.start_date) <= datetime('now') AND datetime(maintenance.end_date) >= datetime('now') LIMIT 1", [monitorID]); + const maintenance = await R.getRow("SELECT COUNT(*) AS count FROM monitor_maintenance mm JOIN maintenance ON mm.maintenance_id = maintenance.id WHERE mm.monitor_id = ? AND datetime(maintenance.start_date) <= datetime('now') AND datetime(maintenance.end_date) >= datetime('now') LIMIT 1", [ monitorID ]); return maintenance.count !== 0; } } diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index 4e761e775..8662dfee4 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -3,8 +3,8 @@
@@ -27,39 +27,55 @@ {{ $t("No Maintenance, please") }} {{ $t("add one") }}
- -
-
-
- - {{ item.title }} + + +
@@ -282,7 +298,6 @@ export default { margin-top: 5px; } - .bg-maintenance { background-color: $maintenance; } diff --git a/src/components/Uptime.vue b/src/components/Uptime.vue index 226dfae32..d663db88a 100644 --- a/src/components/Uptime.vue +++ b/src/components/Uptime.vue @@ -15,7 +15,7 @@ export default { computed: { uptime() { - + if (this.type === "maintenance") { return this.$t("Maintenance"); } @@ -31,9 +31,9 @@ export default { color() { if (this.type === "maintenance" || this.monitor.maintenance) { - return "maintenance" + return "maintenance"; } - + if (this.lastHeartBeat.status === 0) { return "danger"; } diff --git a/src/mixins/datetime.js b/src/mixins/datetime.js index 3f4749af6..c64615624 100644 --- a/src/mixins/datetime.js +++ b/src/mixins/datetime.js @@ -34,10 +34,11 @@ export default { const inputDate = new Date(value); const now = new Date(Date.now()); - if (inputDate.getFullYear() === now.getUTCFullYear() && inputDate.getMonth() === now.getUTCMonth() && inputDate.getDay() === now.getUTCDay()) + if (inputDate.getFullYear() === now.getUTCFullYear() && inputDate.getMonth() === now.getUTCMonth() && inputDate.getDay() === now.getUTCDay()) { return this.datetimeFormat(value, "HH:mm"); - else + } else { return this.datetimeFormat(value, "YYYY-MM-DD HH:mm"); + } }, date(value) { diff --git a/src/mixins/socket.js b/src/mixins/socket.js index 8d419706d..6d4311b1f 100644 --- a/src/mixins/socket.js +++ b/src/mixins/socket.js @@ -464,8 +464,7 @@ export default { text: this.$t("Maintenance"), color: "maintenance", }; - } - else if (! lastHeartBeat) { + } else if (! lastHeartBeat) { result[monitorID] = unknown; } else if (lastHeartBeat.status === 1) { result[monitorID] = { @@ -505,8 +504,7 @@ export default { if (monitor && monitor.maintenance) { result.maintenance++; - } - else if (monitor && ! monitor.active) { + } else if (monitor && ! monitor.active) { result.pause++; } else if (beat) { if (beat.status === 1) { diff --git a/src/pages/Dashboard.vue b/src/pages/Dashboard.vue index e99422a41..207e5b3a1 100644 --- a/src/pages/Dashboard.vue +++ b/src/pages/Dashboard.vue @@ -8,12 +8,12 @@
@@ -78,7 +89,7 @@