From 246316f55b178449ef99ac6ef8bf1ecb07d87386 Mon Sep 17 00:00:00 2001 From: Humberto Evans Date: Mon, 12 Feb 2024 17:24:42 -0800 Subject: [PATCH] Undo my overzelous linter --- server/notification.js | 38 ++++----- src/components/NotificationDialog.vue | 118 +++++--------------------- 2 files changed, 35 insertions(+), 121 deletions(-) diff --git a/server/notification.js b/server/notification.js index 71310b000..5a412c6e6 100644 --- a/server/notification.js +++ b/server/notification.js @@ -57,6 +57,7 @@ const ServerChan = require("./notification-providers/serverchan"); const ZohoCliq = require("./notification-providers/zoho-cliq"); class Notification { + providerList = {}; /** @@ -125,10 +126,10 @@ class Notification { new Webhook(), new WeCom(), new GoAlert(), - new ZohoCliq(), + new ZohoCliq() ]; for (let item of list) { - if (!item.name) { + if (! item.name) { throw new Error("Notification provider without name"); } @@ -148,19 +149,9 @@ class Notification { * @returns {Promise} Successful msg * @throws Error with fail msg */ - static async send( - notification, - msg, - monitorJSON = null, - heartbeatJSON = null - ) { + static async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { if (this.providerList[notification.type]) { - return this.providerList[notification.type].send( - notification, - msg, - monitorJSON, - heartbeatJSON - ); + return this.providerList[notification.type].send(notification, msg, monitorJSON, heartbeatJSON); } else { throw new Error("Notification type is not supported"); } @@ -182,9 +173,10 @@ class Notification { userID, ]); - if (!bean) { + if (! bean) { throw new Error("notification not found"); } + } else { bean = R.dispense("notification"); } @@ -214,7 +206,7 @@ class Notification { userID, ]); - if (!bean) { + if (! bean) { throw new Error("notification not found"); } @@ -230,6 +222,7 @@ class Notification { let exists = commandExistsSync("apprise"); return exists; } + } /** @@ -240,17 +233,16 @@ class Notification { */ async function applyNotificationEveryMonitor(notificationID, userID) { let monitors = await R.getAll("SELECT id FROM monitor WHERE user_id = ?", [ - userID, + userID ]); for (let i = 0; i < monitors.length; i++) { - let checkNotification = await R.findOne( - "monitor_notification", - " monitor_id = ? AND notification_id = ? ", - [ monitors[i].id, notificationID ] - ); + let checkNotification = await R.findOne("monitor_notification", " monitor_id = ? AND notification_id = ? ", [ + monitors[i].id, + notificationID, + ]); - if (!checkNotification) { + if (! checkNotification) { let relation = R.dispense("monitor_notification"); relation.monitor_id = monitors[i].id; relation.notification_id = notificationID; diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 4a16fdf3e..57a2fdf2d 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -1,132 +1,62 @@ @@ -197,7 +121,6 @@ export default { "gotify": "Gotify", "GrafanaOncall": "Grafana Oncall", "HomeAssistant": "Home Assistant", - "HeiiOnCall": "Heii On-Call", "Kook": "Kook", "line": "LINE Messenger", "LineNotify": "LINE Notify", @@ -407,8 +330,7 @@ export default { @import "../assets/vars.scss"; .dark { - .modal-dialog .form-text, - .modal-dialog p { + .modal-dialog .form-text, .modal-dialog p { color: $dark-font-color; } }