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

View File

@ -23,11 +23,11 @@
<option value="specify-users">{{ $t("Mention User List") }}</option> <option value="specify-users">{{ $t("Mention User List") }}</option>
</select> </select>
</div> </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> <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> <input id="mobileList" v-model="$parent.notification.mobileList" type="list" class="form-control" required>
</div> </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> <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> <input id="userList" v-model="$parent.notification.userList" type="list" class="form-control" required>
</div> </div>