lint: fix style

This commit is contained in:
xx 2024-12-21 15:11:59 +08:00
parent b0910138f3
commit b84b79b021
2 changed files with 8 additions and 9 deletions

View file

@ -11,18 +11,17 @@ class DingDing extends NotificationProvider {
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const mentionAll = notification.mentioning === "everyone"
const mobileList = notification.mentioning === "specify-mobiles" ? notification.mobileList.split(",") : []
const userList = notification.mentioning === "specify-users" ? notification.userList.split(",") : []
const mentionStr = [...mobileList || [], ...userList || []].map(item => `@${item}`).join(" ")
const mentionAll = notification.mentioning === "everyone";
const mobileList = notification.mentioning === "specify-mobiles" ? notification.mobileList.split(",") : [];
const userList = notification.mentioning === "specify-users" ? notification.userList.split(",") : [];
const mentionStr = [ ...mobileList || [], ...userList || [] ].map(item => `@${item}`).join(" ");
try {
if (heartbeatJSON != null) {
notification.mobileList
let params = {
msgtype: "markdown",
markdown: {
title: `[${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]}`,
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}${'\n\n' + mentionStr}`,
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}${"\n\n" + mentionStr}`,
},
at: {
isAtAll: mentionAll,
@ -37,7 +36,7 @@ class DingDing extends NotificationProvider {
let params = {
msgtype: "text",
text: {
content: `${msg}${'\n' + mentionStr}`
content: `${msg}${"\n" + mentionStr}`
},
at: {
isAtAll: mentionAll,

View file

@ -23,11 +23,11 @@
<option value="specify-users">{{ $t("Mention User List") }}</option>
</select>
</div>
<div class="mb-3" v-if="$parent.notification.mentioning === 'specify-mobiles'">
<div v-if="$parent.notification.mentioning === 'specify-mobiles'" class="mb-3">
<label for="mobileList" class="form-label">{{ $t("Dingtalk Mobile List") }}<span style="color: red;"><sup>*</sup></span></label>
<input id="mobileList" v-model="$parent.notification.mobileList" type="list" class="form-control" required>
</div>
<div class="mb-3" v-if="$parent.notification.mentioning === 'specify-users'">
<div v-if="$parent.notification.mentioning === 'specify-users'" class="mb-3">
<label for="userList" class="form-label">{{ $t("Dingtalk User List") }}<span style="color: red;"><sup>*</sup></span></label>
<input id="userList" v-model="$parent.notification.userList" type="list" class="form-control" required>
</div>