Resolve lint errors

pull/1213/head
Karel Krýda 3 years ago
parent 7532acc95d
commit f78d01d770

@ -212,8 +212,7 @@ class Monitor extends BeanModel {
if (await Monitor.isUnderMaintenance(this.id)) { if (await Monitor.isUnderMaintenance(this.id)) {
bean.msg = "Monitor under maintenance"; bean.msg = "Monitor under maintenance";
bean.status = MAINTENANCE; bean.status = MAINTENANCE;
} } else if (this.type === "http" || this.type === "keyword") {
else if (this.type === "http" || this.type === "keyword") {
// Do not do any queries/high loading things before the "bean.ping" // Do not do any queries/high loading things before the "bean.ping"
let startTime = dayjs().valueOf(); let startTime = dayjs().valueOf();
@ -482,8 +481,7 @@ class Monitor extends BeanModel {
if (Monitor.isImportantForNotification(isFirstBeat, previousBeat?.status, bean.status)) { if (Monitor.isImportantForNotification(isFirstBeat, previousBeat?.status, bean.status)) {
log.debug("monitor", `[${this.name}] sendNotification`); log.debug("monitor", `[${this.name}] sendNotification`);
await Monitor.sendNotification(isFirstBeat, this, bean); await Monitor.sendNotification(isFirstBeat, this, bean);
} } else {
else {
log.debug("monitor", `[${this.name}] will not sendNotification because it is (or was) under maintenance`); log.debug("monitor", `[${this.name}] will not sendNotification because it is (or was) under maintenance`);
} }

@ -27,7 +27,11 @@
{{ $t("No Maintenance, please") }} <router-link to="/addMaintenance">{{ $t("add one") }}</router-link> {{ $t("No Maintenance, please") }} <router-link to="/addMaintenance">{{ $t("add one") }}</router-link>
</div> </div>
<router-link v-if="selectedList === 'maintenance'" v-for="(item, index) in sortedMaintenanceList" :key="index" :to="maintenanceURL(item.id)" class="item" :class="{ 'disabled': !this.$root.isActiveMaintenance(item.end_date) }"> <template v-if="selectedList === 'maintenance'">
<router-link
v-for="(item, index) in sortedMaintenanceList" :key="index" :to="maintenanceURL(item.id)"
class="item" :class="{ 'disabled': !$root.isActiveMaintenance(item.end_date) }"
>
<div class="row"> <div class="row">
<div class="col-9 col-md-8 small-padding"> <div class="col-9 col-md-8 small-padding">
<div class="info"> <div class="info">
@ -37,10 +41,18 @@
</div> </div>
</div> </div>
</router-link> </router-link>
</template>
<router-link v-if="selectedList === 'monitor'" v-for="(item, index) in sortedMonitorList" :key="index" :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }"> <template v-if="selectedList === 'monitor'">
<router-link
v-for="(item, index) in sortedMonitorList" :key="index" :to="monitorURL(item.id)"
class="item" :class="{ 'disabled': ! item.active }"
>
<div class="row"> <div class="row">
<div class="col-9 col-md-8 small-padding" :class="{ 'monitor-item': $root.userHeartbeatBar == 'bottom' || $root.userHeartbeatBar == 'none' }"> <div
class="col-9 col-md-8 small-padding"
:class="{ 'monitor-item': $root.userHeartbeatBar == 'bottom' || $root.userHeartbeatBar == 'none' }"
>
<div class="info"> <div class="info">
<Uptime :monitor="item" type="24" :pill="true" /> <Uptime :monitor="item" type="24" :pill="true" />
{{ item.name }} {{ item.name }}
@ -49,7 +61,10 @@
<Tag v-for="tag in item.tags" :key="tag" :item="tag" :size="'sm'" /> <Tag v-for="tag in item.tags" :key="tag" :item="tag" :size="'sm'" />
</div> </div>
</div> </div>
<div v-show="$root.userHeartbeatBar == 'normal'" :key="$root.userHeartbeatBar" class="col-3 col-md-4"> <div
v-show="$root.userHeartbeatBar == 'normal'" :key="$root.userHeartbeatBar"
class="col-3 col-md-4"
>
<HeartbeatBar size="small" :monitor-id="item.id" /> <HeartbeatBar size="small" :monitor-id="item.id" />
</div> </div>
</div> </div>
@ -60,6 +75,7 @@
</div> </div>
</div> </div>
</router-link> </router-link>
</template>
</div> </div>
</div> </div>
</template> </template>
@ -282,7 +298,6 @@ export default {
margin-top: 5px; margin-top: 5px;
} }
.bg-maintenance { .bg-maintenance {
background-color: $maintenance; background-color: $maintenance;
} }

@ -31,7 +31,7 @@ export default {
color() { color() {
if (this.type === "maintenance" || this.monitor.maintenance) { if (this.type === "maintenance" || this.monitor.maintenance) {
return "maintenance" return "maintenance";
} }
if (this.lastHeartBeat.status === 0) { if (this.lastHeartBeat.status === 0) {

@ -34,10 +34,11 @@ export default {
const inputDate = new Date(value); const inputDate = new Date(value);
const now = new Date(Date.now()); const now = new Date(Date.now());
if (inputDate.getFullYear() === now.getUTCFullYear() && inputDate.getMonth() === now.getUTCMonth() && inputDate.getDay() === now.getUTCDay()) if (inputDate.getFullYear() === now.getUTCFullYear() && inputDate.getMonth() === now.getUTCMonth() && inputDate.getDay() === now.getUTCDay()) {
return this.datetimeFormat(value, "HH:mm"); return this.datetimeFormat(value, "HH:mm");
else } else {
return this.datetimeFormat(value, "YYYY-MM-DD HH:mm"); return this.datetimeFormat(value, "YYYY-MM-DD HH:mm");
}
}, },
date(value) { date(value) {

@ -464,8 +464,7 @@ export default {
text: this.$t("Maintenance"), text: this.$t("Maintenance"),
color: "maintenance", color: "maintenance",
}; };
} } else if (! lastHeartBeat) {
else if (! lastHeartBeat) {
result[monitorID] = unknown; result[monitorID] = unknown;
} else if (lastHeartBeat.status === 1) { } else if (lastHeartBeat.status === 1) {
result[monitorID] = { result[monitorID] = {
@ -505,8 +504,7 @@ export default {
if (monitor && monitor.maintenance) { if (monitor && monitor.maintenance) {
result.maintenance++; result.maintenance++;
} } else if (monitor && ! monitor.active) {
else if (monitor && ! monitor.active) {
result.pause++; result.pause++;
} else if (beat) { } else if (beat) {
if (beat.status === 1) { if (beat.status === 1) {

@ -8,12 +8,12 @@
</button> </button>
<ul class="dropdown-menu dropdown-menu-end"> <ul class="dropdown-menu dropdown-menu-end">
<li> <li>
<button type="button" class="dropdown-item" @click="this.$router.push('/add')"> <button type="button" class="dropdown-item" @click="$router.push('/add')">
<font-awesome-icon icon="heartbeat" /> {{ $t("Monitor") }} <font-awesome-icon icon="heartbeat" /> {{ $t("Monitor") }}
</button> </button>
</li> </li>
<li> <li>
<button type="button" class="dropdown-item" @click="this.$router.push('/addMaintenance')"> <button type="button" class="dropdown-item" @click="$router.push('/addMaintenance')">
<font-awesome-icon icon="exclamation-circle" /> {{ $t("Maintenance") }} <font-awesome-icon icon="exclamation-circle" /> {{ $t("Maintenance") }}
</button> </button>
</li> </li>

@ -11,15 +11,19 @@
<!-- Title --> <!-- Title -->
<div class="my-3"> <div class="my-3">
<label for="name" class="form-label">{{ $t("Title") }}</label> <label for="name" class="form-label">{{ $t("Title") }}</label>
<input id="name" v-model="maintenance.title" type="text" class="form-control" <input
:placeholder="titlePlaceholder" required> id="name" v-model="maintenance.title" type="text" class="form-control"
:placeholder="titlePlaceholder" required
>
</div> </div>
<!-- Description --> <!-- Description -->
<div class="my-3"> <div class="my-3">
<label for="description" class="form-label">{{ $t("Description") }}</label> <label for="description" class="form-label">{{ $t("Description") }}</label>
<textarea id="description" v-model="maintenance.description" class="form-control" <textarea
:placeholder="descriptionPlaceholder"></textarea> id="description" v-model="maintenance.description" class="form-control"
:placeholder="descriptionPlaceholder"
></textarea>
</div> </div>
<!-- Affected Monitors --> <!-- Affected Monitors -->
@ -50,21 +54,28 @@
<!-- Start Date Time --> <!-- Start Date Time -->
<div class="my-3"> <div class="my-3">
<label for="start_date" class="form-label">{{ $t("Start of maintenance") }} ({{this.$root.timezone}})</label> <label for="start_date" class="form-label">{{ $t("Start of maintenance") }} ({{ $root.timezone }})</label>
<input :type="'datetime-local'" id="start_date" v-model="maintenance.start_date" <input
class="form-control" :class="{'darkCalendar': dark }" required> id="start_date" v-model="maintenance.start_date" :type="'datetime-local'"
class="form-control" :class="{'darkCalendar': dark }" required
>
</div> </div>
<!-- End Date Time --> <!-- End Date Time -->
<div class="my-3"> <div class="my-3">
<label for="end_date" class="form-label">{{ $t("Expected end of maintenance") }} ({{this.$root.timezone}})</label> <label for="end_date" class="form-label">{{ $t("Expected end of maintenance") }} ({{ $root.timezone }})</label>
<input :type="'datetime-local'" id="end_date" v-model="maintenance.end_date" <input
class="form-control" :class="{'darkCalendar': dark }" required> id="end_date" v-model="maintenance.end_date" :type="'datetime-local'"
class="form-control" :class="{'darkCalendar': dark }" required
>
</div> </div>
<div class="mt-5 mb-1"> <div class="mt-5 mb-1">
<button id="monitor-submit-btn" class="btn btn-primary" type="submit" <button
:disabled="processing">{{ $t("Save") }} id="monitor-submit-btn" class="btn btn-primary" type="submit"
:disabled="processing"
>
{{ $t("Save") }}
</button> </button>
</div> </div>
</div> </div>

@ -22,7 +22,7 @@
<label for="affected_monitors" class="form-label" style="margin-top: 20px">{{ $t("Affected Monitors") }}</label> <label for="affected_monitors" class="form-label" style="margin-top: 20px">{{ $t("Affected Monitors") }}</label>
<br> <br>
<button v-for="monitor in this.affectedMonitors" class="btn btn-monitor" style="margin: 5px; cursor: auto; color: white; font-weight: bold"> <button v-for="monitor in affectedMonitors" class="btn btn-monitor" style="margin: 5px; cursor: auto; color: white; font-weight: bold">
{{ monitor }} {{ monitor }}
</button> </button>

@ -104,7 +104,8 @@
<!-- Uploader --> <!-- Uploader -->
<!-- url="/api/status-page/upload-logo" --> <!-- url="/api/status-page/upload-logo" -->
<ImageCropUpload v-model="showImageCropUpload" <ImageCropUpload
v-model="showImageCropUpload"
field="img" field="img"
:width="128" :width="128"
:height="128" :height="128"
@ -196,11 +197,13 @@
<!-- Maintenance --> <!-- Maintenance -->
<template v-if="maintenance.length !== 0"> <template v-if="maintenance.length !== 0">
<div v-for="maintenanceItem in maintenance" class="shadow-box alert mb-4 p-4 maintenance" role="alert" <div
:class="maintenanceClass"> v-for="maintenanceItem in maintenance" class="shadow-box alert mb-4 p-4 maintenance" role="alert"
<h4 v-text="maintenanceItem.title" class="alert-heading"/> :class="maintenanceClass"
>
<h4 class="alert-heading" v-text="maintenanceItem.title" />
<div v-text="maintenanceItem.description" class="content"/> <div class="content" v-text="maintenanceItem.description" />
<!-- Incident Date --> <!-- Incident Date -->
<div class="date mt-3"> <div class="date mt-3">
@ -448,8 +451,7 @@ export default {
if (beat.status === MAINTENANCE) { if (beat.status === MAINTENANCE) {
return STATUS_PAGE_MAINTENANCE; return STATUS_PAGE_MAINTENANCE;
} } else if (beat.status === UP) {
else if (beat.status === UP) {
hasUp = true; hasUp = true;
} else { } else {
status = STATUS_PAGE_PARTIAL_DOWN; status = STATUS_PAGE_PARTIAL_DOWN;

Loading…
Cancel
Save