diff --git a/db/patch9.sql b/db/patch9.sql
new file mode 100644
index 000000000..d4d13aab1
--- /dev/null
+++ b/db/patch9.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 notification
+ ADD is_default BOOLEAN default 0 NOT NULL;
+
+COMMIT;
diff --git a/server/database.js b/server/database.js
index 77c4da758..832166d2c 100644
--- a/server/database.js
+++ b/server/database.js
@@ -7,7 +7,7 @@ class Database {
static templatePath = "./db/kuma.db"
static dataDir;
static path;
- static latestVersion = 8;
+ static latestVersion = 9;
static noReject = true;
static sqliteInstance = null;
diff --git a/server/notification.js b/server/notification.js
index 5d2ffb030..1e1e0ccde 100644
--- a/server/notification.js
+++ b/server/notification.js
@@ -92,8 +92,13 @@ class Notification {
bean.name = notification.name;
bean.user_id = userID;
- bean.config = JSON.stringify(notification)
+ bean.config = JSON.stringify(notification);
+ bean.is_default = notification.isDefault;
await R.store(bean)
+
+ if (notification.applyExisting) {
+ await applyNotificationEveryMonitor(bean.id, userID);
+ }
}
static async delete(notificationID, userID) {
@@ -117,6 +122,26 @@ class Notification {
}
+async function applyNotificationEveryMonitor(notificationID, userID) {
+ let monitors = await R.getAll("SELECT id FROM monitor WHERE user_id = ?", [
+ 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,
+ ])
+
+ if (! checkNotification) {
+ let relation = R.dispense("monitor_notification");
+ relation.monitor_id = monitors[i].id;
+ relation.notification_id = notificationID;
+ await R.store(relation)
+ }
+ }
+}
+
module.exports = {
Notification,
}
diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue
index ebc8eec35..cd8ee8173 100644
--- a/src/components/NotificationDialog.vue
+++ b/src/components/NotificationDialog.vue
@@ -436,6 +436,25 @@
+
+
+
+
+
+
+
+
+
+ {{ $t("enableDefaultNotificationDescription") }}
+
+
+
+
+
+
+
+
+
@@ -485,6 +505,7 @@ export default {
name: "",
type: null,
gotifyPriority: 8,
+ isDefault: false,
},
appriseInstalled: false,
}
@@ -534,6 +555,7 @@ export default {
this.notification = {
name: "",
type: null,
+ isDefault: false,
}
// Default set to Telegram
diff --git a/src/languages/da-DK.js b/src/languages/da-DK.js
index c8e4e68fd..10c4ced7e 100644
--- a/src/languages/da-DK.js
+++ b/src/languages/da-DK.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/de-DE.js b/src/languages/de-DE.js
index a39d2b110..7c2dbb9c6 100644
--- a/src/languages/de-DE.js
+++ b/src/languages/de-DE.js
@@ -115,6 +115,9 @@ export default {
"Resource Record Type": "Resource Record Type",
respTime: "Antw. Zeit (ms)",
notAvailableShort: "N/A",
+ "Default enabled": "Standardmäßig aktiviert",
+ "Also apply to existing monitors": "Auch für alle existierenden Monitore aktivieren",
+ enableDefaultNotificationDescription: "Für jeden neuen Monitor wird diese Benachrichtigung standardmäßig aktiviert. Die Benachrichtigung kann weiterhin für jeden Monitor separat deaktiviert werden.",
Create: "Erstellen",
"Auto Get": "Auto Get"
}
diff --git a/src/languages/en.js b/src/languages/en.js
index cece7e96f..cff061a09 100644
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -16,6 +16,7 @@ export default {
resoverserverDescription: "Cloudflare is the default server, you can change the resolver server anytime.",
rrtypeDescription: "Select the RR-Type you want to monitor",
pauseMonitorMsg: "Are you sure want to pause?",
+ enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.",
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?",
@@ -112,6 +113,8 @@ export default {
"Repeat Password": "Repeat Password",
respTime: "Resp. Time (ms)",
notAvailableShort: "N/A",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors",
Create: "Create",
"Clear Data": "Clear Data",
Events: "Events",
diff --git a/src/languages/es-ES.js b/src/languages/es-ES.js
index 035608483..55fd4bc28 100644
--- a/src/languages/es-ES.js
+++ b/src/languages/es-ES.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/fr-FR.js b/src/languages/fr-FR.js
index dca82ac25..bc5c6adc3 100644
--- a/src/languages/fr-FR.js
+++ b/src/languages/fr-FR.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/ja.js b/src/languages/ja.js
index d7b4e6e2a..23a058aa0 100644
--- a/src/languages/ja.js
+++ b/src/languages/ja.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/ko-KR.js b/src/languages/ko-KR.js
index d57dcbd7e..8432ac1ad 100644
--- a/src/languages/ko-KR.js
+++ b/src/languages/ko-KR.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/nl-NL.js b/src/languages/nl-NL.js
index ef2305ca5..19d9535b3 100644
--- a/src/languages/nl-NL.js
+++ b/src/languages/nl-NL.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/pl.js b/src/languages/pl.js
index 74137dbbf..8e5fb58c8 100644
--- a/src/languages/pl.js
+++ b/src/languages/pl.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/ru-RU.js b/src/languages/ru-RU.js
index 1cea0567f..f8600466c 100644
--- a/src/languages/ru-RU.js
+++ b/src/languages/ru-RU.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/sr-latn.js b/src/languages/sr-latn.js
index 46a6efec7..c22f11d04 100644
--- a/src/languages/sr-latn.js
+++ b/src/languages/sr-latn.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/sr.js b/src/languages/sr.js
index c46244ada..ac8b3b026 100644
--- a/src/languages/sr.js
+++ b/src/languages/sr.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/sv-SE.js b/src/languages/sv-SE.js
index a07396678..aa4d78f83 100644
--- a/src/languages/sv-SE.js
+++ b/src/languages/sv-SE.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/zh-CN.js b/src/languages/zh-CN.js
index d837aced5..c1e59b0c9 100644
--- a/src/languages/zh-CN.js
+++ b/src/languages/zh-CN.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "Clear Data",
Events: "Events",
Heartbeats: "Heartbeats",
- "Auto Get": "Auto Get"
+ "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.",
+ "Default enabled": "Default enabled",
+ "Also apply to existing monitors": "Also apply to existing monitors"
}
diff --git a/src/languages/zh-HK.js b/src/languages/zh-HK.js
index d7aa9de88..c70248bb1 100644
--- a/src/languages/zh-HK.js
+++ b/src/languages/zh-HK.js
@@ -116,5 +116,8 @@ export default {
"Clear Data": "清除資料",
Events: "事件",
Heartbeats: "脈搏",
- "Auto Get": "自動獲取"
+ "Auto Get": "自動獲取",
+ enableDefaultNotificationDescription: "新增監測器時這個通知會預設啟用,當然每個監測器亦可分別控制開關。",
+ "Default enabled": "預設通知",
+ "Also apply to existing monitors": "同時取用至目前所有監測器"
}
diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue
index 552261735..ed09a7bad 100644
--- a/src/pages/EditMonitor.vue
+++ b/src/pages/EditMonitor.vue
@@ -178,6 +178,8 @@
{{ notification.name }}
{{ $t("Edit") }}
+
+ Default