Resolve conflicts

This commit is contained in:
Karel Krýda
2022-04-30 14:33:54 +02:00
parent ed84e56a85
commit 7532acc95d
10 changed files with 74 additions and 65 deletions

View File

@@ -24,7 +24,7 @@ import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";
import { LineChart } from "vue-chart-3";
import { useToast } from "vue-toastification";
import { DOWN, MAINTENANCE } from "../util.ts";
import { DOWN, PENDING, MAINTENANCE } from "../util.ts";
dayjs.extend(utc);
dayjs.extend(timezone);
@@ -187,7 +187,7 @@ export default {
x,
y: (beat.status === DOWN || beat.status === MAINTENANCE || beat.status === PENDING) ? 1 : 0,
});
colorData.push((beat.status === MAINTENANCE) ? "rgba(23,71,245,0.41)" : ((beat.status === PENDING) ? "rgba(245,182,23,0.41)" : "#DC354568"))
colorData.push((beat.status === MAINTENANCE) ? "rgba(23,71,245,0.41)" : ((beat.status === PENDING) ? "rgba(245,182,23,0.41)" : "#DC354568"));
});
return {

View File

@@ -42,6 +42,7 @@ import {
faPlusCircle,
faAngleDown,
faWrench,
faHeartbeat,
} from "@fortawesome/free-solid-svg-icons";
library.add(
@@ -83,6 +84,7 @@ library.add(
faPlusCircle,
faAngleDown,
faWrench,
faHeartbeat,
);
export { FontAwesomeIcon };

View File

@@ -494,6 +494,7 @@ export default {
let result = {
up: 0,
down: 0,
maintenance: 0,
unknown: 0,
pause: 0,
};
@@ -502,7 +503,10 @@ export default {
let beat = this.$root.lastHeartbeatList[monitorID];
let monitor = this.$root.monitorList[monitorID];
if (monitor && ! monitor.active) {
if (monitor && monitor.maintenance) {
result.maintenance++;
}
else if (monitor && ! monitor.active) {
result.pause++;
} else if (beat) {
if (beat.status === 1) {

View File

@@ -2,9 +2,22 @@
<div class="container-fluid">
<div class="row">
<div v-if="! $root.isMobile" class="col-12 col-md-5 col-xl-4">
<div>
<router-link to="/add" class="btn btn-primary mb-3"><font-awesome-icon icon="plus" /> {{ $t("Add New Monitor") }}</router-link>
<router-link to="/addMaintenance" class="btn btn-primary mb-3 float-end"><font-awesome-icon icon="wrench" /> {{ $t("Add New Maintenance") }}</router-link>
<div class="dropdown dropdown-create">
<button class="btn btn-primary mb-3 dropdown-toggle" type="button" data-bs-toggle="dropdown">
<font-awesome-icon icon="plus" /> {{ $t("Create") }}
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li>
<button type="button" class="dropdown-item" @click="this.$router.push('/add')">
<font-awesome-icon icon="heartbeat" /> {{ $t("Monitor") }}
</button>
</li>
<li>
<button type="button" class="dropdown-item" @click="this.$router.push('/addMaintenance')">
<font-awesome-icon icon="exclamation-circle" /> {{ $t("Maintenance") }}
</button>
</li>
</ul>
</div>
<MonitorList :scrollbar="true" />
</div>

View File

@@ -17,7 +17,7 @@
</div>
<div class="col">
<h3>{{ $t("Maintenance") }}</h3>
<span class="num text-maintenance">{{ stats.maintenance }}</span>
<span class="num text-maintenance">{{ $root.stats.maintenance }}</span>
</div>
<div class="col">
<h3>{{ $t("Unknown") }}</h3>

View File

@@ -606,7 +606,7 @@ export default {
toast.success(res.msg);
this.processing = false;
this.$root.getMonitorList();
this.$router.push("/dashboard/monitor/" + res.monitorID);
this.$router.push("/dashboard/" + res.monitorID);
} else {
toast.error(res.msg);
this.processing = false;

View File

@@ -195,16 +195,20 @@
</div>
<!-- Maintenance -->
<div v-if="maintenance.length !== 0" v-for="maintenanceItem in maintenance" class="shadow-box alert mb-4 p-4 maintenance" role="alert" :class="maintenanceClass">
<h4 v-text="maintenanceItem.title" class="alert-heading" />
<template v-if="maintenance.length !== 0">
<div v-for="maintenanceItem in maintenance" class="shadow-box alert mb-4 p-4 maintenance" role="alert"
:class="maintenanceClass">
<h4 v-text="maintenanceItem.title" class="alert-heading"/>
<div v-text="maintenanceItem.description" class="content" />
<div v-text="maintenanceItem.description" class="content"/>
<!-- Incident Date -->
<div class="date mt-3">
{{ $t("End") }}: {{ $root.datetimeMaintenance(maintenanceItem.end_date) }} ({{ dateFromNow(maintenanceItem.start_date) }})<br />
<!-- Incident Date -->
<div class="date mt-3">
{{ $t("End") }}: {{ $root.datetimeMaintenance(maintenanceItem.end_date) }}
({{ dateFromNow(maintenanceItem.start_date) }})<br/>
</div>
</div>
</div>
</template>
<!-- Overall Status -->
<div class="shadow-box list p-4 overall-status mb-4">
@@ -300,7 +304,7 @@
import axios from "axios";
import PublicGroupList from "../components/PublicGroupList.vue";
import ImageCropUpload from "vue-image-crop-upload";
import { STATUS_PAGE_ALL_DOWN, STATUS_PAGE_ALL_UP, STATUS_PAGE_MAINTENANCE, STATUS_PAGE_PARTIAL_DOWN, UP } from "../util.ts";
import { STATUS_PAGE_ALL_DOWN, STATUS_PAGE_ALL_UP, STATUS_PAGE_MAINTENANCE, STATUS_PAGE_PARTIAL_DOWN, UP, MAINTENANCE } from "../util.ts";
import { useToast } from "vue-toastification";
import dayjs from "dayjs";
import Favico from "favico.js";
@@ -579,14 +583,10 @@ export default {
}
this.incident = res.data.incident;
this.maintenance = res.data.maintenance;
this.$root.publicGroupList = res.data.publicGroupList;
});
//TODO: make OK with multi status pages
axios.get("/api/status-page/maintenance-list").then((res) => {
this.maintenance = res.data;
});
// 5mins a loop
this.updateHeartbeatList();
feedInterval = setInterval(() => {

View File

@@ -280,7 +280,7 @@ export function genSecret(length = 64) {
}
export function getMonitorRelativeURL(id: string) {
return "/dashboard/monitor/" + id;
return "/dashboard/" + id;
}
export function getMaintenanceRelativeURL(id: string) {