mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-19 04:34:33 -05:00
Organize notification list
This commit is contained in:
parent
df5da0054e
commit
fa7f75a930
@ -13,7 +13,10 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="notification-type" class="form-label">{{ $t("Notification Type") }}</label>
|
<label for="notification-type" class="form-label">{{ $t("Notification Type") }}</label>
|
||||||
<select id="notification-type" v-model="notification.type" class="form-select">
|
<select id="notification-type" v-model="notification.type" class="form-select">
|
||||||
<option v-for="(name, type) in notificationNameList" :key="type" :value="type">{{ name }}</option>
|
<option v-for="(name, type) in notificationNameList.regularList" :key="type" :value="type">{{ name }}</option>
|
||||||
|
<optgroup :label="$t('notificationRegional')">
|
||||||
|
<option v-for="(name, type) in notificationNameList.regionalList" :key="type" :value="type">{{ name }}</option>
|
||||||
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -106,17 +109,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
notificationNameList() {
|
notificationNameList() {
|
||||||
let list = {
|
let regularList = {
|
||||||
"alerta": "Alerta",
|
"alerta": "Alerta",
|
||||||
"AlertNow": "AlertNow",
|
"AlertNow": "AlertNow",
|
||||||
"AliyunSMS": "AliyunSMS (阿里云短信服务)",
|
|
||||||
"apprise": this.$t("apprise"),
|
"apprise": this.$t("apprise"),
|
||||||
"Bark": "Bark",
|
"Bark": "Bark",
|
||||||
"clicksendsms": "ClickSend SMS",
|
"clicksendsms": "ClickSend SMS",
|
||||||
"DingDing": "DingDing (钉钉自定义机器人)",
|
|
||||||
"discord": "Discord",
|
"discord": "Discord",
|
||||||
"Feishu": "Feishu (飞书)",
|
|
||||||
"FreeMobile": "FreeMobile",
|
|
||||||
"GoogleChat": "Google Chat (Google Workspace)",
|
"GoogleChat": "Google Chat (Google Workspace)",
|
||||||
"gorush": "Gorush",
|
"gorush": "Gorush",
|
||||||
"gotify": "Gotify",
|
"gotify": "Gotify",
|
||||||
@ -131,16 +130,12 @@ export default {
|
|||||||
"octopush": "Octopush",
|
"octopush": "Octopush",
|
||||||
"OneBot": "OneBot",
|
"OneBot": "OneBot",
|
||||||
"PagerDuty": "PagerDuty",
|
"PagerDuty": "PagerDuty",
|
||||||
"promosms": "PromoSMS",
|
|
||||||
"pushbullet": "Pushbullet",
|
"pushbullet": "Pushbullet",
|
||||||
"PushByTechulus": "Push by Techulus",
|
"PushByTechulus": "Push by Techulus",
|
||||||
"PushDeer": "PushDeer",
|
|
||||||
"pushover": "Pushover",
|
"pushover": "Pushover",
|
||||||
"pushy": "Pushy",
|
"pushy": "Pushy",
|
||||||
"rocket.chat": "Rocket.Chat",
|
"rocket.chat": "Rocket.Chat",
|
||||||
"serwersms": "SerwerSMS.pl",
|
|
||||||
"signal": "Signal",
|
"signal": "Signal",
|
||||||
"SMSManager": "SmsManager (smsmanager.cz)",
|
|
||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"squadcast": "SquadCast",
|
"squadcast": "SquadCast",
|
||||||
"SMSEagle": "SMSEagle",
|
"SMSEagle": "SMSEagle",
|
||||||
@ -150,23 +145,51 @@ export default {
|
|||||||
"telegram": "Telegram",
|
"telegram": "Telegram",
|
||||||
"Splunk": "Splunk",
|
"Splunk": "Splunk",
|
||||||
"webhook": "Webhook",
|
"webhook": "Webhook",
|
||||||
"WeCom": "WeCom (企业微信群机器人)",
|
|
||||||
"GoAlert": "GoAlert",
|
"GoAlert": "GoAlert",
|
||||||
"ServerChan": "ServerChan (Server酱)",
|
|
||||||
"ZohoCliq": "ZohoCliq"
|
"ZohoCliq": "ZohoCliq"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Put notifications here if it's not supported in most regions or its documentation is not in English
|
||||||
|
let regionalList = {
|
||||||
|
"AliyunSMS": "AliyunSMS (阿里云短信服务)",
|
||||||
|
"DingDing": "DingDing (钉钉自定义机器人)",
|
||||||
|
"Feishu": "Feishu (飞书)",
|
||||||
|
"FreeMobile": "FreeMobile (mobile.free.fr)",
|
||||||
|
"PushDeer": "PushDeer",
|
||||||
|
"promosms": "PromoSMS",
|
||||||
|
"serwersms": "SerwerSMS.pl",
|
||||||
|
"SMSManager": "SmsManager (smsmanager.cz)",
|
||||||
|
"WeCom": "WeCom (企业微信群机器人)",
|
||||||
|
"ServerChan": "ServerChan (Server酱)",
|
||||||
|
};
|
||||||
|
|
||||||
// Sort by notification name
|
// Sort by notification name
|
||||||
// No idea how, but it works
|
// No idea how, but it works
|
||||||
// https://stackoverflow.com/questions/1069666/sorting-object-property-by-values
|
// https://stackoverflow.com/questions/1069666/sorting-object-property-by-values
|
||||||
const sortable = Object.entries(list)
|
let sort = (list2) => {
|
||||||
.sort(([ , a ], [ , b ]) => a - b)
|
return Object.entries(list2)
|
||||||
|
.sort(([ , a ], [ , b ]) => a.localeCompare(b))
|
||||||
.reduce((r, [ k, v ]) => ({
|
.reduce((r, [ k, v ]) => ({
|
||||||
...r,
|
...r,
|
||||||
[k]: v
|
[k]: v
|
||||||
}), {});
|
}), {});
|
||||||
|
};
|
||||||
|
|
||||||
return sortable;
|
return {
|
||||||
|
regularList: sort(regularList),
|
||||||
|
regionalList: sort(regionalList),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
notificationFullNameList() {
|
||||||
|
let list = {};
|
||||||
|
for (let [ key, value ] of Object.entries(this.notificationNameList.regularList)) {
|
||||||
|
list[key] = value;
|
||||||
|
}
|
||||||
|
for (let [ key, value ] of Object.entries(this.notificationNameList.regionalList)) {
|
||||||
|
list[key] = value;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -272,7 +295,7 @@ export default {
|
|||||||
let name = "";
|
let name = "";
|
||||||
do {
|
do {
|
||||||
name = this.$t("defaultNotificationName", {
|
name = this.$t("defaultNotificationName", {
|
||||||
notification: this.notificationNameList[notificationKey].replace(/\(.+\)/, "").trim(),
|
notification: this.notificationFullNameList[notificationKey].replace(/\(.+\)/, "").trim(),
|
||||||
number: index++
|
number: index++
|
||||||
});
|
});
|
||||||
} while (this.$root.notificationList.find(it => it.name === name));
|
} while (this.$root.notificationList.find(it => it.name === name));
|
||||||
|
@ -432,6 +432,7 @@
|
|||||||
"uninstall": "Uninstall",
|
"uninstall": "Uninstall",
|
||||||
"uninstalling": "Uninstalling",
|
"uninstalling": "Uninstalling",
|
||||||
"confirmUninstallPlugin": "Are you sure want to uninstall this plugin?",
|
"confirmUninstallPlugin": "Are you sure want to uninstall this plugin?",
|
||||||
|
"notificationRegional": "Regional",
|
||||||
"smtp": "Email (SMTP)",
|
"smtp": "Email (SMTP)",
|
||||||
"secureOptionNone": "None / STARTTLS (25, 587)",
|
"secureOptionNone": "None / STARTTLS (25, 587)",
|
||||||
"secureOptionTLS": "TLS (465)",
|
"secureOptionTLS": "TLS (465)",
|
||||||
|
Loading…
Reference in New Issue
Block a user