mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-18 12:14:41 -05:00
Fix linting
This commit is contained in:
parent
776a482a1d
commit
d9558833fc
@ -2,8 +2,8 @@ const NotificationProvider = require("./notification-provider");
|
|||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
const { UP, DOWN } = require("../../src/util");
|
const { UP, DOWN } = require("../../src/util");
|
||||||
|
|
||||||
const opsgenieAlertsUrlEU = "https://api.eu.opsgenie.com/v2/alerts"
|
const opsgenieAlertsUrlEU = "https://api.eu.opsgenie.com/v2/alerts";
|
||||||
const opsgenieAlertsUrlUS = "https://api.opsgenie.com/v2/alerts"
|
const opsgenieAlertsUrlUS = "https://api.opsgenie.com/v2/alerts";
|
||||||
let okMsg = "Sent Successfully.";
|
let okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
class Opsgenie extends NotificationProvider {
|
class Opsgenie extends NotificationProvider {
|
||||||
@ -28,7 +28,7 @@ class Opsgenie extends NotificationProvider {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
opsgenieAlertsUrl = opsgenieAlertsUrlUS;
|
opsgenieAlertsUrl = opsgenieAlertsUrlUS;
|
||||||
};
|
}
|
||||||
|
|
||||||
if (heartbeatJSON == null) {
|
if (heartbeatJSON == null) {
|
||||||
let notificationTestAlias = "uptime-kuma-notification-test";
|
let notificationTestAlias = "uptime-kuma-notification-test";
|
||||||
@ -39,8 +39,8 @@ class Opsgenie extends NotificationProvider {
|
|||||||
"priority": "P5"
|
"priority": "P5"
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.post(notification, opsgenieAlertsUrl, data)
|
return this.post(notification, opsgenieAlertsUrl, data);
|
||||||
};
|
}
|
||||||
|
|
||||||
if (heartbeatJSON.status === DOWN) {
|
if (heartbeatJSON.status === DOWN) {
|
||||||
let data = {
|
let data = {
|
||||||
@ -51,8 +51,8 @@ class Opsgenie extends NotificationProvider {
|
|||||||
"priority": `P${priority}`
|
"priority": `P${priority}`
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.post(notification, opsgenieAlertsUrl, data)
|
return this.post(notification, opsgenieAlertsUrl, data);
|
||||||
};
|
}
|
||||||
|
|
||||||
if (heartbeatJSON.status === UP) {
|
if (heartbeatJSON.status === UP) {
|
||||||
let opsgenieAlertsCloseUrl = `${opsgenieAlertsUrl}/${encodeURIComponent(monitorJSON.name)}/close?identifierType=alias`;
|
let opsgenieAlertsCloseUrl = `${opsgenieAlertsUrl}/${encodeURIComponent(monitorJSON.name)}/close?identifierType=alias`;
|
||||||
@ -60,8 +60,8 @@ class Opsgenie extends NotificationProvider {
|
|||||||
"source": "Uptime Kuma",
|
"source": "Uptime Kuma",
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.post(notification, opsgenieAlertsCloseUrl, data)
|
return this.post(notification, opsgenieAlertsCloseUrl, data);
|
||||||
};
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.throwGeneralAxiosError(error);
|
this.throwGeneralAxiosError(error);
|
||||||
}
|
}
|
||||||
@ -85,12 +85,12 @@ class Opsgenie extends NotificationProvider {
|
|||||||
let res = await axios.post(url, data, config);
|
let res = await axios.post(url, data, config);
|
||||||
if (res.status == null) {
|
if (res.status == null) {
|
||||||
return "Opsgenie notification failed with invalid response!";
|
return "Opsgenie notification failed with invalid response!";
|
||||||
};
|
}
|
||||||
if (res.status < 200 || res.status >= 300) {
|
if (res.status < 200 || res.status >= 300) {
|
||||||
return `Opsgenie notification failed with status code ${res.status}`;
|
return `Opsgenie notification failed with status code ${res.status}`;
|
||||||
};
|
}
|
||||||
|
|
||||||
return okMsg
|
return okMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user