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";
}
},
};