From f8f9f59464ab8fcc6bf57b159d51f2660b74152c Mon Sep 17 00:00:00 2001 From: No0Vad Date: Sat, 11 Sep 2021 18:54:55 +0200 Subject: [PATCH 01/11] Added support for a retry interval to monitors If a check fails and retries are used you can now specify a specific value for that. So you can check faster if the site goes back up again. --- db/patch-add-retry-interval-monitor.sql | 7 +++++++ server/database.js | 1 + server/model/monitor.js | 14 ++++++++++---- server/server.js | 1 + src/languages/en.js | 4 ++++ src/pages/EditMonitor.vue | 13 +++++++++++++ 6 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 db/patch-add-retry-interval-monitor.sql diff --git a/db/patch-add-retry-interval-monitor.sql b/db/patch-add-retry-interval-monitor.sql new file mode 100644 index 00000000..adb64623 --- /dev/null +++ b/db/patch-add-retry-interval-monitor.sql @@ -0,0 +1,7 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +ALTER TABLE monitor + ADD retry_interval INTEGER default 0 not null; + +COMMIT; \ No newline at end of file diff --git a/server/database.js b/server/database.js index e0bb0c9b..579f1b06 100644 --- a/server/database.js +++ b/server/database.js @@ -30,6 +30,7 @@ class Database { static patchList = { "patch-setting-value-type.sql": true, "patch-improve-performance.sql": true, + "patch-add-retry-interval-monitor.sql": true } /** diff --git a/server/model/monitor.js b/server/model/monitor.js index 89208a3f..876d0ca1 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -43,6 +43,7 @@ class Monitor extends BeanModel { active: this.active, type: this.type, interval: this.interval, + retryInterval: this.retryInterval, keyword: this.keyword, ignoreTls: this.getIgnoreTls(), upsideDown: this.isUpsideDown(), @@ -293,12 +294,17 @@ class Monitor extends BeanModel { bean.important = false; } + let beatInterval = this.interval; + if (bean.status === UP) { - console.info(`Monitor #${this.id} '${this.name}': Successful Response: ${bean.ping} ms | Interval: ${this.interval} seconds | Type: ${this.type}`) + console.info(`Monitor #${this.id} '${this.name}': Successful Response: ${bean.ping} ms | Interval: ${beatInterval} seconds | Type: ${this.type}`) } else if (bean.status === PENDING) { - console.warn(`Monitor #${this.id} '${this.name}': Pending: ${bean.msg} | Max retries: ${this.maxretries} | Type: ${this.type}`) + if (this.retryInterval > 0) { + beatInterval = this.retryInterval; + } + console.warn(`Monitor #${this.id} '${this.name}': Pending: ${bean.msg} | Max retries: ${this.maxretries} | Retry: ${retries} | Retry Interval: ${beatInterval} seconds | Type: ${this.type}`) } else { - console.warn(`Monitor #${this.id} '${this.name}': Failing: ${bean.msg} | Type: ${this.type}`) + console.warn(`Monitor #${this.id} '${this.name}': Failing: ${bean.msg} | Interval: ${beatInterval} seconds | Type: ${this.type}`) } io.to(this.user_id).emit("heartbeat", bean.toJSON()); @@ -310,7 +316,7 @@ class Monitor extends BeanModel { previousBeat = bean; if (! this.isStop) { - this.heartbeatInterval = setTimeout(beat, this.interval * 1000); + this.heartbeatInterval = setTimeout(beat, beatInterval * 1000); } } diff --git a/server/server.js b/server/server.js index 2949c4be..67b99b17 100644 --- a/server/server.js +++ b/server/server.js @@ -324,6 +324,7 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString(); bean.type = monitor.type bean.url = monitor.url bean.interval = monitor.interval + bean.retryInterval = monitor.retryInterval; bean.hostname = monitor.hostname; bean.maxretries = monitor.maxretries; bean.port = monitor.port; diff --git a/src/languages/en.js b/src/languages/en.js index 58573685..31fc0ef4 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -1,8 +1,11 @@ export default { languageName: "English", checkEverySecond: "Check every {0} seconds.", + retryCheckEverySecond: "Retry every {0} seconds.", "Avg.": "Avg. ", retriesDescription: "Maximum retries before the service is marked as down and a notification is sent", + retryIntervalInactive: "Inactive", + retryIntervalDescription: "If retries are and used this value is greater then zero this interval will be used instead.", ignoreTLSError: "Ignore TLS/SSL error for HTTPS websites", upsideDownModeDescription: "Flip the status upside down. If the service is reachable, it is DOWN.", maxRedirectDescription: "Maximum number of redirects to follow. Set to 0 to disable redirects.", @@ -64,6 +67,7 @@ export default { Port: "Port", "Heartbeat Interval": "Heartbeat Interval", Retries: "Retries", + "Heartbeat Retry Interval": "Heartbeat Retry Interval", Advanced: "Advanced", "Upside Down Mode": "Upside Down Mode", "Max. Redirects": "Max. Redirects", diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 420c4900..6eae8a89 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -106,6 +106,18 @@ +
+ + +
+ {{ $t("retryIntervalDescription") }} +
+
+

{{ $t("Advanced") }}

@@ -289,6 +301,7 @@ export default { name: "", url: "https://", interval: 60, + retryInterval: 0, maxretries: 0, notificationIDList: {}, ignoreTls: false, From 7fee4a7ea73aeb0930078acd5790efbb60ebd163 Mon Sep 17 00:00:00 2001 From: Ponkhy Date: Sat, 11 Sep 2021 21:53:17 +0200 Subject: [PATCH 02/11] Added import options --- server/server.js | 106 +++++++++++++++++++++++++---------------- src/languages/de-DE.js | 8 +++- src/languages/en.js | 8 +++- src/mixins/socket.js | 4 +- src/pages/Settings.vue | 33 +++++++++++-- 5 files changed, 112 insertions(+), 47 deletions(-) diff --git a/server/server.js b/server/server.js index 2949c4be..e4ad586a 100644 --- a/server/server.js +++ b/server/server.js @@ -594,7 +594,7 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString(); } }); - socket.on("uploadBackup", async (uploadedJSON, callback) => { + socket.on("uploadBackup", async (uploadedJSON, importHandle, callback) => { try { checkLogin(socket) @@ -602,54 +602,80 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString(); console.log(`Importing Backup, User ID: ${socket.userID}, Version: ${backupData.version}`) - let notificationList = backupData.notificationList; - let monitorList = backupData.monitorList; + let notificationListData = backupData.notificationList; + let monitorListData = backupData.monitorList; - if (notificationList.length >= 1) { - for (let i = 0; i < notificationList.length; i++) { - let notification = JSON.parse(notificationList[i].config); - await Notification.save(notification, null, socket.userID) + if (importHandle == "overwrite") { + for (let id in monitorList) { + let monitor = monitorList[id] + await monitor.stop() } + await R.exec("DELETE FROM heartbeat"); + await R.exec("DELETE FROM monitor_notification"); + await R.exec("DELETE FROM monitor_tls_info"); + await R.exec("DELETE FROM notification"); + await R.exec("DELETE FROM monitor"); } - if (monitorList.length >= 1) { - for (let i = 0; i < monitorList.length; i++) { - let monitor = { - name: monitorList[i].name, - type: monitorList[i].type, - url: monitorList[i].url, - interval: monitorList[i].interval, - hostname: monitorList[i].hostname, - maxretries: monitorList[i].maxretries, - port: monitorList[i].port, - keyword: monitorList[i].keyword, - ignoreTls: monitorList[i].ignoreTls, - upsideDown: monitorList[i].upsideDown, - maxredirects: monitorList[i].maxredirects, - accepted_statuscodes: monitorList[i].accepted_statuscodes, - dns_resolve_type: monitorList[i].dns_resolve_type, - dns_resolve_server: monitorList[i].dns_resolve_server, - notificationIDList: {}, - } - - let bean = R.dispense("monitor") + if (notificationListData.length >= 1) { + let notificationNameList = await R.getAll("SELECT name FROM notification"); + let notificationNameListString = JSON.stringify(notificationNameList); - let notificationIDList = monitor.notificationIDList; - delete monitor.notificationIDList; + for (let i = 0; i < notificationListData.length; i++) { + if ((importHandle == "skip" && notificationNameListString.includes(notificationListData[i].name) == false) || importHandle == "keep" || importHandle == "overwrite") { - monitor.accepted_statuscodes_json = JSON.stringify(monitor.accepted_statuscodes); - delete monitor.accepted_statuscodes; + let notification = JSON.parse(notificationListData[i].config); + await Notification.save(notification, null, socket.userID) - bean.import(monitor) - bean.user_id = socket.userID - await R.store(bean) + } + } + } - await updateMonitorNotification(bean.id, notificationIDList) + if (monitorListData.length >= 1) { + let monitorNameList = await R.getAll("SELECT name FROM monitor"); + let monitorNameListString = JSON.stringify(monitorNameList); + + for (let i = 0; i < monitorListData.length; i++) { + if ((importHandle == "skip" && monitorNameListString.includes(monitorListData[i].name) == false) || importHandle == "keep" || importHandle == "overwrite") { + + let monitor = { + name: monitorListData[i].name, + type: monitorListData[i].type, + url: monitorListData[i].url, + interval: monitorListData[i].interval, + hostname: monitorListData[i].hostname, + maxretries: monitorListData[i].maxretries, + port: monitorListData[i].port, + keyword: monitorListData[i].keyword, + ignoreTls: monitorListData[i].ignoreTls, + upsideDown: monitorListData[i].upsideDown, + maxredirects: monitorListData[i].maxredirects, + accepted_statuscodes: monitorListData[i].accepted_statuscodes, + dns_resolve_type: monitorListData[i].dns_resolve_type, + dns_resolve_server: monitorListData[i].dns_resolve_server, + notificationIDList: {}, + } + + let bean = R.dispense("monitor") + + let notificationIDList = monitor.notificationIDList; + delete monitor.notificationIDList; + + monitor.accepted_statuscodes_json = JSON.stringify(monitor.accepted_statuscodes); + delete monitor.accepted_statuscodes; + + bean.import(monitor) + bean.user_id = socket.userID + await R.store(bean) + + await updateMonitorNotification(bean.id, notificationIDList) + + if (monitorListData[i].active == 1) { + await startMonitor(socket.userID, bean.id); + } else { + await pauseMonitor(socket.userID, bean.id); + } - if (monitorList[i].active == 1) { - await startMonitor(socket.userID, bean.id); - } else { - await pauseMonitor(socket.userID, bean.id); } } diff --git a/src/languages/de-DE.js b/src/languages/de-DE.js index a8cf5a7c..083d939a 100644 --- a/src/languages/de-DE.js +++ b/src/languages/de-DE.js @@ -128,5 +128,11 @@ export default { backupDescription3: "Sensible Daten wie Benachrichtigungstoken sind in der Exportdatei enthalten, bitte bewahre sie sorgfältig auf.", alertNoFile: "Bitte wähle eine Datei zum importieren aus.", alertWrongFileType: "Bitte wähle eine JSON Datei aus.", - "Clear all statistics": "Lösche alle Statistiken" + "Clear all statistics": "Lösche alle Statistiken", + importHandleDescription: "Wähle 'Vorhandene überspringen' aus, wenn jeder Monitor oder Benachrichtigung mit demselben Namen übersprungen werden soll. 'Überschreiben' löscht jeden vorhandenen Monitor sowie Benachrichtigungen.", + "Skip existing": "Vorhandene überspringen", + "Overwrite": "Überschreiben", + "Import Options": "Import Optionen", + confirmImportMsg: "Möchtest du das Backup wirklich importieren? Bitte stelle sicher, dass die richtige Import Option ausgewählt ist.", + "Keep both": "Beide behalten", } diff --git a/src/languages/en.js b/src/languages/en.js index 58573685..14bf20b2 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -20,6 +20,8 @@ export default { clearEventsMsg: "Are you sure want to delete all events for this monitor?", clearHeartbeatsMsg: "Are you sure want to delete all heartbeats for this monitor?", confirmClearStatisticsMsg: "Are you sure want to delete ALL statistics?", + importHandleDescription: "Choose 'Skip Existing' if you want to skip every monitor or notification with the same name. 'Overwrite' will delete every existing monitor and notification.", + confirmImportMsg: "Are you sure to import the backup? Please make sure you've selected the right import option.", Settings: "Settings", Dashboard: "Dashboard", "New Update": "New Update", @@ -128,5 +130,9 @@ export default { backupDescription3: "Sensitive data such as notification tokens is included in the export file, please keep it carefully.", alertNoFile: "Please select a file to import.", alertWrongFileType: "Please select a JSON file.", - "Clear all statistics": "Clear all Statistics" + "Clear all statistics": "Clear all Statistics", + "Skip existing": "Skip existing", + "Overwrite": "Overwrite", + "Import Options": "Import Options", + "Keep both": "Keep both", } diff --git a/src/mixins/socket.js b/src/mixins/socket.js index 9771db0d..e0088a59 100644 --- a/src/mixins/socket.js +++ b/src/mixins/socket.js @@ -256,8 +256,8 @@ export default { this.importantHeartbeatList = {} }, - uploadBackup(uploadedJSON, callback) { - socket.emit("uploadBackup", uploadedJSON, callback) + uploadBackup(uploadedJSON, importHandle, callback) { + socket.emit("uploadBackup", uploadedJSON, importHandle, callback) }, clearEvents(monitorID, callback) { diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue index cd1a95bc..9502f11c 100644 --- a/src/pages/Settings.vue +++ b/src/pages/Settings.vue @@ -127,14 +127,33 @@ ({{ $t("backupDescription2") }})

-
+
-
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ {{ $t("importHandleDescription") }} +
+
{{ importAlert }}
@@ -259,6 +278,9 @@ {{ $t("confirmClearStatisticsMsg") }} + + {{ $t("confirmImportMsg") }} +
@@ -297,6 +319,7 @@ export default { }, loaded: false, importAlert: null, + importHandle: "skip", processing: false, } }, @@ -363,6 +386,10 @@ export default { this.$refs.confirmClearStatistics.show(); }, + confirmImport() { + this.$refs.confirmImport.show(); + }, + disableAuth() { this.settings.disableAuth = true; this.saveSettings(); @@ -408,7 +435,7 @@ export default { fileReader.readAsText(uploadItem.item(0)); fileReader.onload = item => { - this.$root.uploadBackup(item.target.result, (res) => { + this.$root.uploadBackup(item.target.result, this.importHandle, (res) => { this.processing = false; if (res.ok) { From 862672731f9c1034f8e4d53d4a05802262baf356 Mon Sep 17 00:00:00 2001 From: Ponkhy Date: Sat, 11 Sep 2021 22:06:26 +0200 Subject: [PATCH 03/11] Minor typo fix --- src/languages/en.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.js b/src/languages/en.js index 14bf20b2..0644610d 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -20,7 +20,7 @@ export default { clearEventsMsg: "Are you sure want to delete all events for this monitor?", clearHeartbeatsMsg: "Are you sure want to delete all heartbeats for this monitor?", confirmClearStatisticsMsg: "Are you sure want to delete ALL statistics?", - importHandleDescription: "Choose 'Skip Existing' if you want to skip every monitor or notification with the same name. 'Overwrite' will delete every existing monitor and notification.", + importHandleDescription: "Choose 'Skip existing' if you want to skip every monitor or notification with the same name. 'Overwrite' will delete every existing monitor and notification.", confirmImportMsg: "Are you sure to import the backup? Please make sure you've selected the right import option.", Settings: "Settings", Dashboard: "Dashboard", From 3d27561e5a276589e4c3627146bf628790b3d0b5 Mon Sep 17 00:00:00 2001 From: No0Vad Date: Sun, 12 Sep 2021 00:24:33 +0200 Subject: [PATCH 04/11] Update en.js Fixed spelling error --- src/languages/en.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.js b/src/languages/en.js index 31fc0ef4..08ef3b8c 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -5,7 +5,7 @@ export default { "Avg.": "Avg. ", retriesDescription: "Maximum retries before the service is marked as down and a notification is sent", retryIntervalInactive: "Inactive", - retryIntervalDescription: "If retries are and used this value is greater then zero this interval will be used instead.", + retryIntervalDescription: "If retries are used and this value is greater then zero this interval will be used instead.", ignoreTLSError: "Ignore TLS/SSL error for HTTPS websites", upsideDownModeDescription: "Flip the status upside down. If the service is reachable, it is DOWN.", maxRedirectDescription: "Maximum number of redirects to follow. Set to 0 to disable redirects.", From 389d247463fdda737c21a0f847c29d356723fb24 Mon Sep 17 00:00:00 2001 From: No0Vad Date: Sun, 12 Sep 2021 17:05:23 +0200 Subject: [PATCH 05/11] Update server/database.js Co-authored-by: Adam Stachowicz --- server/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/database.js b/server/database.js index 579f1b06..4cc01a5a 100644 --- a/server/database.js +++ b/server/database.js @@ -30,7 +30,7 @@ class Database { static patchList = { "patch-setting-value-type.sql": true, "patch-improve-performance.sql": true, - "patch-add-retry-interval-monitor.sql": true + "patch-add-retry-interval-monitor.sql": true, } /** From ea723c7595c56c621f33a6b9c2988c178809efed Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Sun, 12 Sep 2021 21:35:37 +0200 Subject: [PATCH 06/11] Separate import and export. Fix ESLint --- src/pages/Settings.vue | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue index 84c3f8b7..8b013c5f 100644 --- a/src/pages/Settings.vue +++ b/src/pages/Settings.vue @@ -128,46 +128,54 @@
-

{{ $t("Import/Export Backup") }}

+

{{ $t("Export Backup") }}

{{ $t("backupDescription") }}
({{ $t("backupDescription2") }})

-
- - - +
+
+

{{ $t("backupDescription3") }}

+ +

{{ $t("Import Backup") }}

+
- +
- +
- +
{{ $t("importHandleDescription") }}
+
+ +
+ +
+ +
+
{{ importAlert }}
-

{{ $t("backupDescription3") }}

-

{{ $t("Advanced") }}

From 7199bb5ead275307f3443980472df069ed6a1e40 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Sun, 12 Sep 2021 23:11:07 +0200 Subject: [PATCH 07/11] Remove unused i18n key --- src/languages/da-DK.js | 1 - src/languages/de-DE.js | 3 +-- src/languages/en.js | 6 +++--- src/languages/es-ES.js | 1 - src/languages/et-EE.js | 1 - src/languages/fr-FR.js | 1 - src/languages/it-IT.js | 1 - src/languages/ja.js | 1 - src/languages/ko-KR.js | 1 - src/languages/nl-NL.js | 1 - src/languages/pl.js | 1 - src/languages/ru-RU.js | 1 - src/languages/sr-latn.js | 1 - src/languages/sr.js | 1 - src/languages/sv-SE.js | 1 - src/languages/zh-CN.js | 1 - src/languages/zh-HK.js | 1 - src/pages/Settings.vue | 2 +- 18 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/languages/da-DK.js b/src/languages/da-DK.js index 6e8069aa..eefe7467 100644 --- a/src/languages/da-DK.js +++ b/src/languages/da-DK.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For hver ny overvåger aktiveres denne underretning som standard. Du kan stadig deaktivere underretningen separat for hver skærm.", "Default enabled": "Standard aktiveret", "Also apply to existing monitors": "Anvend også på eksisterende overvågere", - "Import/Export Backup": " Importér/Eksportér sikkerhedskopi", Export: "Eksport", Import: "Import", backupDescription: "Du kan sikkerhedskopiere alle Overvågere og alle underretninger til en JSON-fil.", diff --git a/src/languages/de-DE.js b/src/languages/de-DE.js index e401f2bf..95cc3d69 100644 --- a/src/languages/de-DE.js +++ b/src/languages/de-DE.js @@ -113,7 +113,6 @@ export default { "Create your admin account": "Erstelle dein Admin Konto", "Repeat Password": "Wiederhole das Passwort", "Resource Record Type": "Resource Record Type", - "Import/Export Backup": "Import/Export Backup", "Export": "Export", "Import": "Import", respTime: "Antw. Zeit (ms)", @@ -132,7 +131,7 @@ export default { importHandleDescription: "Wähle 'Vorhandene überspringen' aus, wenn jeder Monitor oder Benachrichtigung mit demselben Namen übersprungen werden soll. 'Überschreiben' löscht jeden vorhandenen Monitor sowie Benachrichtigungen.", "Skip existing": "Vorhandene überspringen", "Overwrite": "Überschreiben", - "Import Options": "Import Optionen", + "Options": "Optionen", confirmImportMsg: "Möchtest du das Backup wirklich importieren? Bitte stelle sicher, dass die richtige Import Option ausgewählt ist.", "Keep both": "Beide behalten", twoFAVerifyLabel: "Bitte trage deinen Token ein um zu verifizieren das 2FA funktioniert", diff --git a/src/languages/en.js b/src/languages/en.js index c81db310..fc9b6001 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -117,7 +117,8 @@ export default { "Last Result": "Last Result", "Create your admin account": "Create your admin account", "Repeat Password": "Repeat Password", - "Import/Export Backup": "Import/Export Backup", + "Import Backup": "Import Backup", + "Export Backup": "Export Backup", Export: "Export", Import: "Import", respTime: "Resp. Time (ms)", @@ -137,7 +138,7 @@ export default { "Clear all statistics": "Clear all Statistics", "Skip existing": "Skip existing", "Overwrite": "Overwrite", - "Import Options": "Import Options", + "Options": "Options", "Keep both": "Keep both", "Verify Token": "Verify Token", "Setup 2FA": "Setup 2FA", @@ -149,5 +150,4 @@ export default { Inactive: "Inactive", Token: "Token", "Show URI": "Show URI", - "Clear all statistics": "Clear all Statistics" } diff --git a/src/languages/es-ES.js b/src/languages/es-ES.js index b52c1654..cef00568 100644 --- a/src/languages/es-ES.js +++ b/src/languages/es-ES.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/et-EE.js b/src/languages/et-EE.js index fca24a33..9c28730d 100644 --- a/src/languages/et-EE.js +++ b/src/languages/et-EE.js @@ -113,7 +113,6 @@ export default { clearEventsMsg: "Kas soovid seire kõik sündmused kustutada?", clearHeartbeatsMsg: "Kas soovid seire kõik tuksed kustutada?", confirmClearStatisticsMsg: "Kas soovid KÕIK statistika kustutada?", - "Import/Export Backup": "Impordi/Ekspordi varukoopia", Export: "Eksport", Import: "Import", "Default enabled": "Kasuta vaikimisi", diff --git a/src/languages/fr-FR.js b/src/languages/fr-FR.js index 4821b818..44f20e9c 100644 --- a/src/languages/fr-FR.js +++ b/src/languages/fr-FR.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/it-IT.js b/src/languages/it-IT.js index 1d337810..5cad910d 100644 --- a/src/languages/it-IT.js +++ b/src/languages/it-IT.js @@ -118,7 +118,6 @@ export default { Heartbeats: "Controlli", "Auto Get": "Auto Get", enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", "Default enabled": "Default enabled", diff --git a/src/languages/ja.js b/src/languages/ja.js index 6d0693d5..11f4ab2d 100644 --- a/src/languages/ja.js +++ b/src/languages/ja.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/ko-KR.js b/src/languages/ko-KR.js index 68479ade..2bf6cd5d 100644 --- a/src/languages/ko-KR.js +++ b/src/languages/ko-KR.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/nl-NL.js b/src/languages/nl-NL.js index 48e3b3a2..624a4ec6 100644 --- a/src/languages/nl-NL.js +++ b/src/languages/nl-NL.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/pl.js b/src/languages/pl.js index 3029b349..dbaed36a 100644 --- a/src/languages/pl.js +++ b/src/languages/pl.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/ru-RU.js b/src/languages/ru-RU.js index 7f5eae76..5b81f6fc 100644 --- a/src/languages/ru-RU.js +++ b/src/languages/ru-RU.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/sr-latn.js b/src/languages/sr-latn.js index 3dd73d2c..b8e19e3e 100644 --- a/src/languages/sr-latn.js +++ b/src/languages/sr-latn.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/sr.js b/src/languages/sr.js index 6931d272..b00de38a 100644 --- a/src/languages/sr.js +++ b/src/languages/sr.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/sv-SE.js b/src/languages/sv-SE.js index f8749e28..f735dbbf 100644 --- a/src/languages/sv-SE.js +++ b/src/languages/sv-SE.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", "Default enabled": "Default enabled", "Also apply to existing monitors": "Also apply to existing monitors", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", backupDescription: "You can backup all monitors and all notifications into a JSON file.", diff --git a/src/languages/zh-CN.js b/src/languages/zh-CN.js index 1d15c3d9..085b64e3 100644 --- a/src/languages/zh-CN.js +++ b/src/languages/zh-CN.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "新的监控项将默认启用,你也可以在每个监控项中分别设置", "Default enabled": "默认开启", "Also apply to existing monitors": "应用到所有监控项", - "Import/Export Backup": "导入/导出备份", Export: "导出", Import: "导入", backupDescription: "你可以将所有的监控项和消息通知备份到一个 JSON 文件中", diff --git a/src/languages/zh-HK.js b/src/languages/zh-HK.js index 314b6e69..0a108be0 100644 --- a/src/languages/zh-HK.js +++ b/src/languages/zh-HK.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "新增監測器時這個通知會預設啟用,當然每個監測器亦可分別控制開關。", "Default enabled": "預設通知", "Also apply to existing monitors": "同時取用至目前所有監測器", - "Import/Export Backup": "匯入/匯出 備份", Export: "匯出", Import: "匯入", backupDescription: "您可以備份所有監測器及所有通知。", diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue index 8b013c5f..aefdd446 100644 --- a/src/pages/Settings.vue +++ b/src/pages/Settings.vue @@ -143,7 +143,7 @@

{{ $t("Import Backup") }}

- +
From 2617e1f4d80c1bebbb39deb26ca2ae75f9081fbf Mon Sep 17 00:00:00 2001 From: No0Vad Date: Mon, 13 Sep 2021 00:25:18 +0200 Subject: [PATCH 08/11] Update database.js --- server/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/database.js b/server/database.js index b8f3f992..18da3298 100644 --- a/server/database.js +++ b/server/database.js @@ -29,7 +29,7 @@ class Database { */ static patchList = { "patch-setting-value-type.sql": true, - "patch-improve-performance.sql": true, + "patch-improve-performance.sql": true, "patch-2fa.sql": true, "patch-add-retry-interval-monitor.sql": true, } From fc9b4617ca9726f3650b8da5e12e7e4249cd629a Mon Sep 17 00:00:00 2001 From: LouisLam Date: Tue, 14 Sep 2021 15:48:25 +0800 Subject: [PATCH 09/11] link interval and retryInterval --- src/pages/EditMonitor.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 82aa7d23..73ab0479 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -108,11 +108,11 @@
- +
{{ $t("retryIntervalDescription") }}
@@ -261,6 +261,12 @@ export default { "$route.fullPath"() { this.init(); }, + "monitor.interval"(value, oldValue) { + // Link interval and retryInerval if they are the same value. + if (this.monitor.retryInterval === oldValue) { + this.monitor.retryInterval = value; + } + } }, mounted() { this.init(); @@ -302,7 +308,7 @@ export default { name: "", url: "https://", interval: 60, - retryInterval: 0, + retryInterval: this.interval, maxretries: 0, notificationIDList: {}, ignoreTls: false, From 1300448bed9f7f05f5f8f6bc2862e2b0dbbc4d88 Mon Sep 17 00:00:00 2001 From: No0Vad Date: Wed, 15 Sep 2021 00:59:06 +0200 Subject: [PATCH 10/11] Adjustments to the retry interval The monitor logic for when to use "retryInterval" is updated. Also removed some texts when they are no longer needed. --- server/model/monitor.js | 2 +- src/languages/en.js | 2 -- src/pages/EditMonitor.vue | 6 +----- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 876d0ca1..92ef9834 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -299,7 +299,7 @@ class Monitor extends BeanModel { if (bean.status === UP) { console.info(`Monitor #${this.id} '${this.name}': Successful Response: ${bean.ping} ms | Interval: ${beatInterval} seconds | Type: ${this.type}`) } else if (bean.status === PENDING) { - if (this.retryInterval > 0) { + if (this.retryInterval !== this.interval) { beatInterval = this.retryInterval; } console.warn(`Monitor #${this.id} '${this.name}': Pending: ${bean.msg} | Max retries: ${this.maxretries} | Retry: ${retries} | Retry Interval: ${beatInterval} seconds | Type: ${this.type}`) diff --git a/src/languages/en.js b/src/languages/en.js index 88c3dc1e..98a4010e 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -4,8 +4,6 @@ export default { retryCheckEverySecond: "Retry every {0} seconds.", "Avg.": "Avg.", retriesDescription: "Maximum retries before the service is marked as down and a notification is sent", - retryIntervalInactive: "Inactive", - retryIntervalDescription: "If retries are used and this value is greater then zero this interval will be used instead.", ignoreTLSError: "Ignore TLS/SSL error for HTTPS websites", upsideDownModeDescription: "Flip the status upside down. If the service is reachable, it is DOWN.", maxRedirectDescription: "Maximum number of redirects to follow. Set to 0 to disable redirects.", diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 73ab0479..04582628 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -109,13 +109,9 @@
-
- {{ $t("retryIntervalDescription") }} -

{{ $t("Advanced") }}

From f679c1cbafcb24e3852c6fcedc1ae74bbc5ef152 Mon Sep 17 00:00:00 2001 From: Ponkhy Date: Wed, 15 Sep 2021 12:01:30 +0200 Subject: [PATCH 11/11] Export button align left --- src/pages/Settings.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue index aefdd446..79cb0cc1 100644 --- a/src/pages/Settings.vue +++ b/src/pages/Settings.vue @@ -135,7 +135,7 @@ ({{ $t("backupDescription2") }})

-
+