lint: minimal lint

pull/4619/head
Seluard 2 months ago
parent 8e0d8cc3b2
commit 85c9e12b25

@ -1,5 +1,5 @@
const { MonitorType } = require("./monitor-type"); 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. * A AtlassianStatusPage class extends the MonitorType.
@ -19,28 +19,27 @@ class Atlassian extends MonitorType {
*/ */
async check(monitor, heartbeat) { async check(monitor, heartbeat) {
try { try {
log.info("AtlassianStatus",monitor.url); log.info("AtlassianStatus", monitor.url);
log.info("AtlassianStatus",monitor.component_name); log.info("AtlassianStatus", monitor.component_name);
const response = (await fetch(monitor.url)); const response = (await fetch(monitor.url));
const body = await response.json(); const body = await response.json();
// log.debug("AtlassianStatus",body["components"]); // log.debug("AtlassianStatus",body["components"]);
let component_status = new Map(); let componentStatus = new Map();
for (let index = 0; index < body["components"].length; index++) { for (let index = 0; index < body["components"].length; index++) {
const element = body["components"][index]; const element = body["components"][index];
component_status.set(element["name"],element["status"]) componentStatus.set(element["name"], element["status"]);
} }
log.debug("AtlassianStatus",component_status); log.debug("AtlassianStatus", componentStatus);
if (component_status.get(monitor.component_name)!= undefined ) { if (componentStatus.get(monitor.component_name) !== undefined ) {
if (component_status.get(monitor.component_name) === "operational") { if (componentStatus.get(monitor.component_name) === "operational") {
log.debug("AtlassianStatus",component_status.get(monitor.component_name)) log.debug("AtlassianStatus", componentStatus.get(monitor.component_name));
heartbeat.status = UP heartbeat.status = UP;
}else { } else {
heartbeat.status = DOWN heartbeat.status = DOWN;
} }
} else { } else {
throw new Error("Component not exist into the status"); throw new Error("Component not exist into the status");
} }
} catch (err) { } catch (err) {
// trigger log function somewhere to display a notification or alert to the user (but how?) // trigger log function somewhere to display a notification or alert to the user (but how?)
throw new Error(`StatusPage check errors: ${err}`); throw new Error(`StatusPage check errors: ${err}`);

@ -517,4 +517,4 @@ const { RealBrowserMonitorType } = require("./monitor-types/real-browser-monitor
const { TailscalePing } = require("./monitor-types/tailscale-ping"); const { TailscalePing } = require("./monitor-types/tailscale-ping");
const { DnsMonitorType } = require("./monitor-types/dns"); const { DnsMonitorType } = require("./monitor-types/dns");
const { MqttMonitorType } = require("./monitor-types/mqtt"); const { MqttMonitorType } = require("./monitor-types/mqtt");
const { Atlassian } = require("./monitor-types/atlassian"); const { Atlassian } = require("./monitor-types/atlassian");

Loading…
Cancel
Save