diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 220ff8d7..78d89091 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -13,23 +13,7 @@
@@ -38,370 +22,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
@@ -450,18 +72,11 @@ import { Modal } from "bootstrap" import { ucfirst } from "../util.ts" import Confirm from "./Confirm.vue"; -import HiddenInput from "./HiddenInput.vue"; -import Telegram from "./notifications/Telegram.vue"; -import Teams from "./notifications/Teams.vue"; -import SMTP from "./notifications/SMTP.vue"; +import NotificationFormList from "./notifications" export default { components: { Confirm, - HiddenInput, - Telegram, - Teams, - SMTP, }, props: {}, emits: ["added"], @@ -470,13 +85,23 @@ export default { model: null, processing: false, id: null, + notificationTypes: Object.keys(NotificationFormList), notification: { name: "", + /** @type { null | keyof NotificationFormList } */ type: null, isDefault: false, // Do not set default value here, please scroll to show() - }, - appriseInstalled: false, + } + } + }, + + computed: { + currentForm() { + if (!this.notification.type) { + return null + } + return NotificationFormList[this.notification.type] } }, @@ -497,10 +122,6 @@ export default { }, mounted() { this.modal = new Modal(this.$refs.modal) - - this.$root.getSocket().emit("checkApprise", (installed) => { - this.appriseInstalled = installed; - }) }, methods: { @@ -528,9 +149,7 @@ export default { } // Set Default value here - this.notification.type = "telegram"; - this.notification.gotifyPriority = 8; - this.notification.smtpSecure = false; + this.notification.type = this.notificationTypes[0]; } this.modal.show() diff --git a/src/components/notifications/Apprise.vue b/src/components/notifications/Apprise.vue new file mode 100644 index 00000000..de3fe52b --- /dev/null +++ b/src/components/notifications/Apprise.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/components/notifications/Discord.vue b/src/components/notifications/Discord.vue new file mode 100644 index 00000000..c45a5262 --- /dev/null +++ b/src/components/notifications/Discord.vue @@ -0,0 +1,20 @@ + diff --git a/src/components/notifications/Gotify.vue b/src/components/notifications/Gotify.vue new file mode 100644 index 00000000..f8039d58 --- /dev/null +++ b/src/components/notifications/Gotify.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/components/notifications/Line.vue b/src/components/notifications/Line.vue new file mode 100644 index 00000000..7d5312c3 --- /dev/null +++ b/src/components/notifications/Line.vue @@ -0,0 +1,29 @@ + + + diff --git a/src/components/notifications/LunaSea.vue b/src/components/notifications/LunaSea.vue new file mode 100644 index 00000000..1511f411 --- /dev/null +++ b/src/components/notifications/LunaSea.vue @@ -0,0 +1,9 @@ + diff --git a/src/components/notifications/Mattermost.vue b/src/components/notifications/Mattermost.vue new file mode 100644 index 00000000..3e1a7bdc --- /dev/null +++ b/src/components/notifications/Mattermost.vue @@ -0,0 +1,32 @@ + diff --git a/src/components/notifications/Octopush.vue b/src/components/notifications/Octopush.vue new file mode 100644 index 00000000..10fb6df7 --- /dev/null +++ b/src/components/notifications/Octopush.vue @@ -0,0 +1,40 @@ + + + diff --git a/src/components/notifications/Pushbullet.vue b/src/components/notifications/Pushbullet.vue new file mode 100644 index 00000000..2c805e0a --- /dev/null +++ b/src/components/notifications/Pushbullet.vue @@ -0,0 +1,20 @@ + + + diff --git a/src/components/notifications/Pushover.vue b/src/components/notifications/Pushover.vue new file mode 100644 index 00000000..ae836b5c --- /dev/null +++ b/src/components/notifications/Pushover.vue @@ -0,0 +1,67 @@ + + + diff --git a/src/components/notifications/Pushy.vue b/src/components/notifications/Pushy.vue new file mode 100644 index 00000000..64e4ef9c --- /dev/null +++ b/src/components/notifications/Pushy.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/components/notifications/RocketChat.vue b/src/components/notifications/RocketChat.vue new file mode 100644 index 00000000..0776a154 --- /dev/null +++ b/src/components/notifications/RocketChat.vue @@ -0,0 +1,29 @@ + diff --git a/src/components/notifications/SMTP.vue b/src/components/notifications/SMTP.vue index 47661aa5..b86a6260 100644 --- a/src/components/notifications/SMTP.vue +++ b/src/components/notifications/SMTP.vue @@ -66,9 +66,9 @@ export default { components: { HiddenInput, }, - data() { - return { - name: "smtp", + mounted() { + if (typeof this.$parent.notification.smtpSecure === "undefined") { + this.$parent.notification.smtpSecure = false; } }, } diff --git a/src/components/notifications/Signal.vue b/src/components/notifications/Signal.vue new file mode 100644 index 00000000..8598d07f --- /dev/null +++ b/src/components/notifications/Signal.vue @@ -0,0 +1,32 @@ + diff --git a/src/components/notifications/Slack.vue b/src/components/notifications/Slack.vue new file mode 100644 index 00000000..1ec2cdfc --- /dev/null +++ b/src/components/notifications/Slack.vue @@ -0,0 +1,29 @@ + diff --git a/src/components/notifications/Teams.vue b/src/components/notifications/Teams.vue index 748bf7ad..45ba26c8 100644 --- a/src/components/notifications/Teams.vue +++ b/src/components/notifications/Teams.vue @@ -17,13 +17,3 @@
- - diff --git a/src/components/notifications/Telegram.vue b/src/components/notifications/Telegram.vue index 9be1e004..a59c804a 100644 --- a/src/components/notifications/Telegram.vue +++ b/src/components/notifications/Telegram.vue @@ -47,11 +47,6 @@ export default { components: { HiddenInput, }, - data() { - return { - name: "telegram", - } - }, computed: { telegramGetUpdatesURL() { let token = "" @@ -62,9 +57,6 @@ export default { return `https://api.telegram.org/bot${token}/getUpdates`; }, - }, - mounted() { - }, methods: { async autoGetTelegramChatID() { diff --git a/src/components/notifications/Webhook.vue b/src/components/notifications/Webhook.vue new file mode 100644 index 00000000..1554a83d --- /dev/null +++ b/src/components/notifications/Webhook.vue @@ -0,0 +1,23 @@ + diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js new file mode 100644 index 00000000..e377803e --- /dev/null +++ b/src/components/notifications/index.js @@ -0,0 +1,44 @@ +import STMP from "./SMTP.vue" +import Telegram from "./Telegram.vue"; +import Discord from "./Discord.vue"; +import Webhook from "./Webhook.vue"; +import Signal from "./Signal.vue"; +import Gotify from "./Gotify.vue"; +import Slack from "./Slack.vue"; +import RocketChat from "./RocketChat.vue"; +import Teams from "./Teams.vue"; +import Pushover from "./Pushover.vue"; +import Pushy from "./Pushy.vue"; +import Octopush from "./Octopush.vue"; +import LunaSea from "./LunaSea.vue"; +import Apprise from "./Apprise.vue"; +import Pushbullet from "./Pushbullet.vue"; +import Line from "./Line.vue"; +import Mattermost from "./Mattermost.vue"; + +/** + * Manage all notification form. + * + * @type { Record } + */ +const NotificationFormList = { + "telegram": Telegram, + "webhook": Webhook, + "smtp": STMP, + "discord": Discord, + "teams": Teams, + "signal": Signal, + "gotify": Gotify, + "slack": Slack, + "rocket.chat": RocketChat, + "pushover": Pushover, + "pushy": Pushy, + "octopush": Octopush, + "lunasea": LunaSea, + "apprise": Apprise, + "pushbullet": Pushbullet, + "line": Line, + "mattermost": Mattermost +} + +export default NotificationFormList diff --git a/src/languages/en.js b/src/languages/en.js index c3faca82..46298b01 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -178,4 +178,21 @@ export default { "Add a monitor": "Add a monitor", "Edit Status Page": "Edit Status Page", "Go to Dashboard": "Go to Dashboard", + "telegram": "Telegram", + "webhook": "Webhook", + "smtp": "Email (SMTP)", + "discord": "Discord", + "teams": "Microsoft Teams", + "signal": "Signal", + "gotify": "Gotify", + "slack": "Slack", + "rocket.chat": "Rocket.chat", + "pushover": "Pushover", + "pushy": "Pushy", + "octopush": "Octopush", + "lunasea": "LunaSea", + "apprise": "Apprise (Support 50+ Notification services)", + "pushbullet": "Pushbullet", + "line": "Line Messenger", + "mattermost": "Mattermost", };