diff --git a/server/monitor-types/atlassian.js b/server/monitor-types/atlassian.js index cacd303e..fd5ceeaa 100644 --- a/server/monitor-types/atlassian.js +++ b/server/monitor-types/atlassian.js @@ -1,5 +1,5 @@ const { MonitorType } = require("./monitor-type"); -const { UP,log, DOWN } = require("../../src/util"); +const { UP, log, DOWN } = require("../../src/util"); /** * A AtlassianStatusPage class extends the MonitorType. @@ -19,28 +19,27 @@ class Atlassian extends MonitorType { */ async check(monitor, heartbeat) { try { - log.info("AtlassianStatus",monitor.url); - log.info("AtlassianStatus",monitor.component_name); + log.info("AtlassianStatus", monitor.url); + log.info("AtlassianStatus", monitor.component_name); const response = (await fetch(monitor.url)); const body = await response.json(); // log.debug("AtlassianStatus",body["components"]); - let component_status = new Map(); + let componentStatus = new Map(); for (let index = 0; index < body["components"].length; index++) { const element = body["components"][index]; - component_status.set(element["name"],element["status"]) + componentStatus.set(element["name"], element["status"]); } - log.debug("AtlassianStatus",component_status); - if (component_status.get(monitor.component_name)!= undefined ) { - if (component_status.get(monitor.component_name) === "operational") { - log.debug("AtlassianStatus",component_status.get(monitor.component_name)) - heartbeat.status = UP - }else { - heartbeat.status = DOWN + log.debug("AtlassianStatus", componentStatus); + if (componentStatus.get(monitor.component_name) !== undefined ) { + if (componentStatus.get(monitor.component_name) === "operational") { + log.debug("AtlassianStatus", componentStatus.get(monitor.component_name)); + heartbeat.status = UP; + } else { + heartbeat.status = DOWN; } } else { throw new Error("Component not exist into the status"); } - } catch (err) { // trigger log function somewhere to display a notification or alert to the user (but how?) throw new Error(`StatusPage check errors: ${err}`); diff --git a/server/uptime-kuma-server.js b/server/uptime-kuma-server.js index fc6ec275..c999e668 100644 --- a/server/uptime-kuma-server.js +++ b/server/uptime-kuma-server.js @@ -517,4 +517,4 @@ const { RealBrowserMonitorType } = require("./monitor-types/real-browser-monitor const { TailscalePing } = require("./monitor-types/tailscale-ping"); const { DnsMonitorType } = require("./monitor-types/dns"); const { MqttMonitorType } = require("./monitor-types/mqtt"); -const { Atlassian } = require("./monitor-types/atlassian"); \ No newline at end of file +const { Atlassian } = require("./monitor-types/atlassian");