zoho cliq code style

This commit is contained in:
panos 2022-12-08 13:41:05 +02:00
parent 73bfdb9ef9
commit 68bc7ac421
1 changed files with 16 additions and 20 deletions

View File

@ -43,8 +43,7 @@ class ZohoCliq extends NotificationProvider {
monitorMessage,
monitorName,
monitorUrl,
}) => {
}) => {
const payload = ["### Uptime Kuma\n"];
payload.push(this._statusMessageFactory(status, monitorName));
payload.push(`*Description:* ${monitorMessage}`);
@ -74,23 +73,6 @@ class ZohoCliq extends NotificationProvider {
return this._sendNotification(webhookUrl, payload);
};
_monitorUrlFactory = (monitorJSON) => {
let url;
switch(monitorJSON["type"]) {
case "http":
case "keywork":
url = monitorJSON["url"];
break;
case "docker":
url = monitorJSON["docker_host"];
break;
default:
url = monitorJSON["hostname"];
break;
}
return url;
};
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully.";
@ -100,10 +82,24 @@ class ZohoCliq extends NotificationProvider {
return okMsg;
}
let url;
switch(monitorJSON["type"]) {
case "http":
case "keywork":
url = monitorJSON["url"];
break;
case "docker":
url = monitorJSON["docker_host"];
break;
default:
url = monitorJSON["hostname"];
break;
}
const payload = this._notificationPayloadFactory({
monitorMessage: heartbeatJSON.msg,
monitorName: monitorJSON.name,
monitorUrl: this._monitorUrlFactory(monitorJSON),
monitorUrl: url,
status: heartbeatJSON.status,
});