1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-12-10 10:10:14 +02:00

Sort the notification list by name and remove translation keys of brand names or product names

This commit is contained in:
Louis Lam 2023-02-22 04:27:12 +08:00
parent 9ccaa4d120
commit de7df46aa8
4 changed files with 71 additions and 36 deletions

View File

@ -13,7 +13,7 @@
<div class="mb-3">
<label for="notification-type" class="form-label">{{ $t("Notification Type") }}</label>
<select id="notification-type" v-model="notification.type" class="form-select">
<option v-for="type in notificationTypes" :key="type" :value="type">{{ $t(type) }}</option>
<option v-for="(name, type) in notificationNameList" :key="type" :value="type">{{ name }}</option>
</select>
</div>
@ -67,7 +67,7 @@
</Confirm>
</template>
<script lang="ts">
<script>
import { Modal } from "bootstrap";
import Confirm from "./Confirm.vue";
@ -103,7 +103,71 @@ export default {
return null;
}
return NotificationFormList[this.notification.type];
}
},
notificationNameList() {
let list = {
"alerta": "Alerta",
"AlertNow": "AlertNow",
"AliyunSMS": "AliyunSMS (阿里云短信服务)",
"apprise": this.$t("apprise"),
"Bark": "Bark",
"clicksendsms": "ClickSend SMS",
"DingDing": "DingDing (钉钉自定义机器人)",
"discord": "Discord",
"Feishu": "Feishu (飞书)",
"FreeMobile": "FreeMobile",
"GoogleChat": "Google Chat (Google Workspace)",
"gorush": "Gorush",
"gotify": "Gotify",
"HomeAssistant": "Home Assistant",
"Kook": "Kook",
"line": "LINE Messenger",
"LineNotify": "LINE Notify",
"lunasea": "LunaSea",
"matrix": "Matrix",
"mattermost": "Mattermost",
"ntfy": "Ntfy",
"octopush": "Octopush",
"OneBot": "OneBot",
"PagerDuty": "PagerDuty",
"promosms": "PromoSMS",
"pushbullet": "Pushbullet",
"PushByTechulus": "Push by Techulus",
"PushDeer": "PushDeer",
"pushover": "Pushover",
"pushy": "Pushy",
"rocket.chat": "Rocket.Chat",
"serwersms": "SerwerSMS.pl",
"signal": "Signal",
"SMSManager": "SmsManager (smsmanager.cz)",
"slack": "Slack",
"squadcast": "SquadCast",
"SMSEagle": "SMSEagle",
"smtp": this.$t("smtp"),
"stackfield": "Stackfield",
"teams": "Microsoft Teams",
"telegram": "Telegram",
"Splunk": "Splunk",
"webhook": "Webhook",
"WeCom": "WeCom (企业微信群机器人)",
"GoAlert": "GoAlert",
"ServerChan": "ServerChan (Server酱)",
"ZohoCliq": "ZohoCliq"
};
// Sort by notification name
// No idea how, but it works
// https://stackoverflow.com/questions/1069666/sorting-object-property-by-values
const sortable = Object.entries(list)
.sort(([ , a ], [ , b ]) => a - b)
.reduce((r, [ k, v ]) => ({
...r,
[k]: v
}), {});
return sortable;
},
},
watch: {
@ -203,6 +267,7 @@ export default {
* @return {string}
*/
getUniqueDefaultName(notificationKey) {
/*
let index = 1;
let name = "";
do {
@ -211,7 +276,8 @@ export default {
number: index++
});
} while (this.$root.notificationList.find(it => it.name === name));
return name;
return name;*/
return "123";
}
},
};

View File

@ -16,7 +16,7 @@
<div class="mb-3">
<label for="gorush-platform" class="form-label">{{ $t("Platform") }}</label><span style="color: red;"><sup>*</sup></span>
<select id="gorush-platform" v-model="$parent.notification.gorushPlatform" class="form-select">
<option value="ios">{{ $t("iOS") }}</option>
<option value="ios">iOS</option>
<option value="android">{{ $t("Android") }}</option>
<option value="huawei">{{ $t("Huawei") }}</option>
</select>

View File

@ -186,7 +186,6 @@
"defaultNotificationName": "My {notification} Alert ({number})",
"here": "here",
"Required": "Required",
"webhook": "Webhook",
"Post URL": "Post URL",
"Content Type": "Content Type",
"webhookJsonDesc": "{0} is good for any modern HTTP servers such as Express.js",
@ -360,7 +359,6 @@
"Workstation": "Workstation",
"Packet Size": "Packet Size",
"telegram": "Telegram",
"ZohoCliq": "ZohoCliq",
"Bot Token": "Bot Token",
"wayToGetTelegramToken": "You can get a token from {0}.",
"Chat ID": "Chat ID",
@ -388,7 +386,6 @@
"backupOutdatedWarning": "Deprecated: Since a lot of features were added and this backup feature is a bit unmaintained, it cannot generate or restore a complete backup.",
"backupRecommend": "Please backup the volume or the data folder (./data/) directly instead.",
"Optional": "Optional",
"squadcast": "Squadcast",
"or": "or",
"recurringInterval": "Interval",
"Recurring": "Recurring",
@ -530,28 +527,11 @@
"pushoversounds none": "None (silent)",
"pushyAPIKey": "Secret API Key",
"pushyToken": "Device token",
"discord": "Discord",
"teams": "Microsoft Teams",
"signal": "Signal",
"gotify": "Gotify",
"slack": "Slack",
"rocket.chat": "Rocket.Chat",
"pushover": "Pushover",
"pushy": "Pushy",
"PushByTechulus": "Push by Techulus",
"octopush": "Octopush",
"promosms": "PromoSMS",
"clicksendsms": "ClickSend SMS",
"lunasea": "LunaSea",
"apprise": "Apprise (Support 50+ Notification services)",
"GoogleChat": "Google Chat (Google Workspace only)",
"pushbullet": "Pushbullet",
"Kook": "Kook",
"wayToGetKookBotToken": "Create application and get your bot token at {0}",
"wayToGetKookGuildID": "Switch on 'Developer Mode' in Kook setting, and right click the guild to get its ID",
"Guild ID": "Guild ID",
"line": "Line Messenger",
"mattermost": "Mattermost",
"User Key": "User Key",
"Device": "Device",
"Message Title": "Message Title",
@ -586,12 +566,10 @@
"SendKey": "SendKey",
"SMSManager API Docs": "SMSManager API Docs ",
"Gateway Type": "Gateway Type",
"SMSManager": "SMSManager",
"You can divide numbers with": "You can divide numbers with",
"Base URL": "Base URL",
"goAlertInfo": "GoAlert is a An open source application for on-call scheduling, automated escalations and notifications (like SMS or voice calls). Automatically engage the right person, the right way, and at the right time! {0}",
"goAlertIntegrationKeyInfo": "Get generic API integration key for the service in this format \"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\" usually the value of token parameter of copied URL.",
"goAlert": "GoAlert",
"AccessKeyId": "AccessKey ID",
"SecretAccessKey": "AccessKey Secret",
"PhoneNumbers": "PhoneNumbers",
@ -606,7 +584,6 @@
"For safety, must use secret key": "For safety, must use secret key",
"Device Token": "Device Token",
"Platform": "Platform",
"iOS": "iOS",
"Android": "Android",
"Huawei": "Huawei",
"High": "High",
@ -617,7 +594,6 @@
"Proxy Protocol": "Proxy Protocol",
"Proxy Server": "Proxy Server",
"Proxy server has authentication": "Proxy server has authentication",
"matrix": "Matrix",
"promosmsTypeEco": "SMS ECO - cheap but slow and often overloaded. Limited only to Polish recipients.",
"promosmsTypeFlash": "SMS FLASH - Message will automatically show on recipient device. Limited only to Polish recipients.",
"promosmsTypeFull": "SMS FULL - Premium tier of SMS, You can use your Sender Name (You need to register name first). Reliable for alerts.",
@ -653,19 +629,15 @@
"do nothing": "do nothing",
"auto acknowledged": "auto acknowledged",
"auto resolve": "auto resolve",
"gorush": "Gorush",
"alerta": "Alerta",
"alertaApiEndpoint": "API Endpoint",
"alertaEnvironment": "Environment",
"alertaApiKey": "API Key",
"alertaAlertState": "Alert State",
"alertaRecoverState": "Recover State",
"serwersms": "SerwerSMS.pl",
"serwersmsAPIUser": "API Username (incl. webapi_ prefix)",
"serwersmsAPIPassword": "API Password",
"serwersmsPhoneNumber": "Phone number",
"serwersmsSenderName": "SMS Sender Name (registered via customer portal)",
"smseagle": "SMSEagle",
"smseagleTo": "Phone number(s)",
"smseagleGroup": "Phonebook group name(s)",
"smseagleContact": "Phonebook contact name(s)",
@ -675,7 +647,6 @@
"smseagleUrl": "Your SMSEagle device URL",
"smseagleEncoding": "Send as Unicode",
"smseaglePriority": "Message priority (0-9, default = 0)",
"stackfield": "Stackfield",
"Recipient Number": "Recipient Number",
"From Name/Number": "From Name/Number",
"Leave blank to use a shared sender number.": "Leave blank to use a shared sender number.",

View File

@ -272,7 +272,6 @@
"apprise": "Apprise (支持 50+ 种通知服务)",
"GoogleChat": "Google Chat(仅 Google Workspace)",
"pushbullet": "Pushbullet",
"AliyunSMS": "阿里云短信服务",
"Kook": "Kook",
"wayToGetKookBotToken": "在 {0} 创建应用并获取机器人 Token",
"wayToGetKookGuildID": "在 Kook 设置中打开“开发者模式”,然后右键点击频道可获取其 ID",
@ -448,7 +447,6 @@
"Bark Endpoint": "Bark 接入点",
"Bark Group": "Bark 群组",
"Bark Sound": "Bark 铃声",
"DingDing": "钉钉自定义机器人",
"WebHookUrl": "钉钉自定义机器人 Webhook 地址",
"SecretKey": "钉钉自定义机器人加签密钥",
"For safety, must use secret key": "出于安全考虑,必须使用加签密钥",