2021-06-25 13:55:49 +00:00
|
|
|
<template>
|
2021-06-27 08:10:55 +00:00
|
|
|
<h1> {{ monitor.name }}</h1>
|
2021-07-01 06:03:06 +00:00
|
|
|
<p class="url">
|
2021-07-27 17:47:13 +00:00
|
|
|
<a v-if="monitor.type === 'http' || monitor.type === 'keyword' " :href="monitor.url" target="_blank">{{ monitor.url }}</a>
|
2021-07-01 09:00:23 +00:00
|
|
|
<span v-if="monitor.type === 'port'">TCP Ping {{ monitor.hostname }}:{{ monitor.port }}</span>
|
|
|
|
<span v-if="monitor.type === 'ping'">Ping: {{ monitor.hostname }}</span>
|
2021-07-01 09:19:28 +00:00
|
|
|
<span v-if="monitor.type === 'keyword'">
|
2021-07-27 17:47:13 +00:00
|
|
|
<br>
|
2021-08-08 05:47:29 +00:00
|
|
|
<span>Keyword:</span> <span class="keyword">{{ monitor.keyword }}</span>
|
2021-07-01 09:19:28 +00:00
|
|
|
</span>
|
2021-07-01 06:03:06 +00:00
|
|
|
</p>
|
2021-06-25 13:55:49 +00:00
|
|
|
|
|
|
|
<div class="functions">
|
2021-07-27 17:47:13 +00:00
|
|
|
<button v-if="monitor.active" class="btn btn-light" @click="pauseDialog">
|
|
|
|
<font-awesome-icon icon="pause" /> Pause
|
|
|
|
</button>
|
|
|
|
<button v-if="! monitor.active" class="btn btn-primary" @click="resumeMonitor">
|
2021-07-29 17:02:41 +00:00
|
|
|
<font-awesome-icon icon="play" /> Resume
|
2021-07-27 17:47:13 +00:00
|
|
|
</button>
|
|
|
|
<router-link :to=" '/edit/' + monitor.id " class="btn btn-secondary">
|
|
|
|
<font-awesome-icon icon="edit" /> Edit
|
|
|
|
</router-link>
|
|
|
|
<button class="btn btn-danger" @click="deleteDialog">
|
|
|
|
<font-awesome-icon icon="trash" /> Delete
|
|
|
|
</button>
|
2021-06-25 13:55:49 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="shadow-box">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-8">
|
2021-06-27 08:10:55 +00:00
|
|
|
<HeartbeatBar :monitor-id="monitor.id" />
|
|
|
|
<span class="word">Check every {{ monitor.interval }} seconds.</span>
|
2021-06-25 13:55:49 +00:00
|
|
|
</div>
|
2021-06-27 08:10:55 +00:00
|
|
|
<div class="col-md-4 text-center">
|
|
|
|
<span class="badge rounded-pill" :class=" 'bg-' + status.color " style="font-size: 30px">{{ status.text }}</span>
|
2021-06-25 13:55:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-06-30 13:04:58 +00:00
|
|
|
<div class="shadow-box big-padding text-center stats">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col">
|
|
|
|
<h4>{{ pingTitle }}</h4>
|
|
|
|
<p>(Current)</p>
|
|
|
|
<span class="num"><CountUp :value="ping" /></span>
|
|
|
|
</div>
|
|
|
|
<div class="col">
|
2021-07-27 17:53:59 +00:00
|
|
|
<h4>Avg. {{ pingTitle }}</h4>
|
2021-06-30 13:04:58 +00:00
|
|
|
<p>(24-hour)</p>
|
|
|
|
<span class="num"><CountUp :value="avgPing" /></span>
|
|
|
|
</div>
|
|
|
|
<div class="col">
|
|
|
|
<h4>Uptime</h4>
|
|
|
|
<p>(24-hour)</p>
|
2021-07-01 05:11:16 +00:00
|
|
|
<span class="num"><Uptime :monitor="monitor" type="24" /></span>
|
2021-06-30 13:04:58 +00:00
|
|
|
</div>
|
|
|
|
<div class="col">
|
|
|
|
<h4>Uptime</h4>
|
|
|
|
<p>(30-day)</p>
|
2021-07-01 05:11:16 +00:00
|
|
|
<span class="num"><Uptime :monitor="monitor" type="720" /></span>
|
2021-06-30 13:04:58 +00:00
|
|
|
</div>
|
2021-07-26 14:53:07 +00:00
|
|
|
|
2021-07-27 17:47:13 +00:00
|
|
|
<div v-if="certInfo" class="col">
|
2021-07-27 17:53:59 +00:00
|
|
|
<h4>Cert Exp.</h4>
|
2021-07-26 14:53:07 +00:00
|
|
|
<p>(<Datetime :value="certInfo.validTo" date-only />)</p>
|
2021-07-27 17:47:13 +00:00
|
|
|
<span class="num">
|
|
|
|
<a href="#" @click.prevent="toggleCertInfoBox = !toggleCertInfoBox">{{ certInfo.daysRemaining }} days</a>
|
2021-07-26 14:53:07 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
2021-06-30 13:04:58 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-07-27 17:47:13 +00:00
|
|
|
<div v-if="showCertInfoBox" class="shadow-box big-padding text-center">
|
2021-07-21 04:09:09 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col">
|
|
|
|
<h4>Certificate Info</h4>
|
|
|
|
<table class="text-start">
|
|
|
|
<tbody>
|
|
|
|
<tr class="my-3">
|
2021-07-27 17:47:13 +00:00
|
|
|
<td class="px-3">
|
|
|
|
Valid:
|
|
|
|
</td>
|
2021-07-21 04:09:09 +00:00
|
|
|
<td>{{ certInfo.valid }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="my-3">
|
2021-07-27 17:47:13 +00:00
|
|
|
<td class="px-3">
|
|
|
|
Valid To:
|
|
|
|
</td>
|
2021-07-26 14:53:07 +00:00
|
|
|
<td><Datetime :value="certInfo.validTo" /></td>
|
2021-07-21 04:09:09 +00:00
|
|
|
</tr>
|
|
|
|
<tr class="my-3">
|
2021-07-27 17:47:13 +00:00
|
|
|
<td class="px-3">
|
|
|
|
Days Remaining:
|
|
|
|
</td>
|
2021-07-21 04:09:09 +00:00
|
|
|
<td>{{ certInfo.daysRemaining }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="my-3">
|
2021-07-27 17:47:13 +00:00
|
|
|
<td class="px-3">
|
|
|
|
Issuer:
|
|
|
|
</td>
|
2021-07-21 04:09:09 +00:00
|
|
|
<td>{{ certInfo.issuer }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="my-3">
|
2021-07-27 17:47:13 +00:00
|
|
|
<td class="px-3">
|
|
|
|
Fingerprint:
|
|
|
|
</td>
|
2021-07-21 04:09:09 +00:00
|
|
|
<td>{{ certInfo.fingerprint }}</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-06-30 13:04:58 +00:00
|
|
|
<div class="shadow-box">
|
|
|
|
<table class="table table-borderless table-hover">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Status</th>
|
|
|
|
<th>DateTime</th>
|
|
|
|
<th>Message</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2021-07-18 01:04:40 +00:00
|
|
|
<tr v-for="(beat, index) in displayedRecords" :key="index">
|
2021-06-30 13:04:58 +00:00
|
|
|
<td><Status :status="beat.status" /></td>
|
|
|
|
<td><Datetime :value="beat.time" /></td>
|
|
|
|
<td>{{ beat.msg }}</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr v-if="importantHeartBeatList.length === 0">
|
2021-07-27 17:47:13 +00:00
|
|
|
<td colspan="3">
|
|
|
|
No important events
|
|
|
|
</td>
|
2021-06-30 13:04:58 +00:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2021-07-18 01:04:40 +00:00
|
|
|
|
|
|
|
<div class="d-flex justify-content-center kuma_pagination">
|
|
|
|
<pagination
|
|
|
|
v-model="page"
|
2021-07-27 17:47:13 +00:00
|
|
|
:records="importantHeartBeatList.length"
|
|
|
|
:per-page="perPage"
|
|
|
|
/>
|
2021-07-18 01:04:40 +00:00
|
|
|
</div>
|
2021-06-30 13:04:58 +00:00
|
|
|
</div>
|
|
|
|
|
2021-06-25 13:55:49 +00:00
|
|
|
<Confirm ref="confirmPause" @yes="pauseMonitor">
|
|
|
|
Are you sure want to pause?
|
|
|
|
</Confirm>
|
|
|
|
|
2021-07-27 17:47:13 +00:00
|
|
|
<Confirm ref="confirmDelete" btn-style="btn-danger" @yes="deleteMonitor">
|
2021-06-25 13:55:49 +00:00
|
|
|
Are you sure want to delete this monitor?
|
|
|
|
</Confirm>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-07-27 17:47:13 +00:00
|
|
|
import { useToast } from "vue-toastification"
|
2021-06-25 13:55:49 +00:00
|
|
|
const toast = useToast()
|
|
|
|
import Confirm from "../components/Confirm.vue";
|
2021-06-25 19:03:06 +00:00
|
|
|
import HeartbeatBar from "../components/HeartbeatBar.vue";
|
2021-06-30 13:04:58 +00:00
|
|
|
import Status from "../components/Status.vue";
|
|
|
|
import Datetime from "../components/Datetime.vue";
|
|
|
|
import CountUp from "../components/CountUp.vue";
|
2021-07-01 05:11:16 +00:00
|
|
|
import Uptime from "../components/Uptime.vue";
|
2021-07-18 01:04:40 +00:00
|
|
|
import Pagination from "v-pagination-3";
|
2021-06-25 13:55:49 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2021-07-01 05:11:16 +00:00
|
|
|
Uptime,
|
2021-06-30 13:04:58 +00:00
|
|
|
CountUp,
|
|
|
|
Datetime,
|
2021-06-25 19:03:06 +00:00
|
|
|
HeartbeatBar,
|
2021-06-30 13:04:58 +00:00
|
|
|
Confirm,
|
|
|
|
Status,
|
2021-07-18 01:04:40 +00:00
|
|
|
Pagination,
|
2021-06-25 13:55:49 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2021-07-18 01:04:40 +00:00
|
|
|
page: 1,
|
|
|
|
perPage: 25,
|
|
|
|
heartBeatList: [],
|
2021-07-26 14:53:07 +00:00
|
|
|
toggleCertInfoBox: false,
|
2021-06-25 13:55:49 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2021-06-30 13:04:58 +00:00
|
|
|
|
|
|
|
pingTitle() {
|
|
|
|
if (this.monitor.type === "http") {
|
|
|
|
return "Response"
|
|
|
|
}
|
2021-07-27 17:47:13 +00:00
|
|
|
|
|
|
|
return "Ping"
|
2021-06-30 13:04:58 +00:00
|
|
|
},
|
|
|
|
|
2021-06-25 13:55:49 +00:00
|
|
|
monitor() {
|
2021-06-27 08:10:55 +00:00
|
|
|
let id = this.$route.params.id
|
|
|
|
return this.$root.monitorList[id];
|
|
|
|
},
|
2021-06-25 13:55:49 +00:00
|
|
|
|
2021-06-27 08:10:55 +00:00
|
|
|
lastHeartBeat() {
|
|
|
|
if (this.monitor.id in this.$root.lastHeartbeatList && this.$root.lastHeartbeatList[this.monitor.id]) {
|
|
|
|
return this.$root.lastHeartbeatList[this.monitor.id]
|
2021-07-27 17:47:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
status: -1,
|
2021-06-25 13:55:49 +00:00
|
|
|
}
|
|
|
|
},
|
2021-06-27 08:10:55 +00:00
|
|
|
|
2021-06-30 13:04:58 +00:00
|
|
|
ping() {
|
2021-07-12 03:20:18 +00:00
|
|
|
if (this.lastHeartBeat.ping || this.lastHeartBeat.ping === 0) {
|
2021-06-30 13:04:58 +00:00
|
|
|
return this.lastHeartBeat.ping;
|
|
|
|
}
|
2021-07-27 17:47:13 +00:00
|
|
|
|
|
|
|
return "N/A"
|
2021-06-30 13:04:58 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
avgPing() {
|
2021-07-12 03:20:18 +00:00
|
|
|
if (this.$root.avgPingList[this.monitor.id] || this.$root.avgPingList[this.monitor.id] === 0) {
|
2021-06-30 13:04:58 +00:00
|
|
|
return this.$root.avgPingList[this.monitor.id];
|
|
|
|
}
|
2021-07-27 17:47:13 +00:00
|
|
|
|
|
|
|
return "N/A"
|
2021-06-30 13:04:58 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
importantHeartBeatList() {
|
|
|
|
if (this.$root.importantHeartbeatList[this.monitor.id]) {
|
2021-07-18 01:04:40 +00:00
|
|
|
this.heartBeatList = this.$root.importantHeartbeatList[this.monitor.id];
|
2021-06-30 13:04:58 +00:00
|
|
|
return this.$root.importantHeartbeatList[this.monitor.id]
|
|
|
|
}
|
2021-07-27 17:47:13 +00:00
|
|
|
|
|
|
|
return [];
|
2021-06-30 13:04:58 +00:00
|
|
|
},
|
|
|
|
|
2021-06-27 08:10:55 +00:00
|
|
|
status() {
|
|
|
|
if (this.$root.statusList[this.monitor.id]) {
|
|
|
|
return this.$root.statusList[this.monitor.id]
|
|
|
|
}
|
2021-07-27 17:47:13 +00:00
|
|
|
|
|
|
|
return { }
|
2021-07-18 01:04:40 +00:00
|
|
|
},
|
2021-06-27 08:10:55 +00:00
|
|
|
|
2021-07-21 04:09:09 +00:00
|
|
|
certInfo() {
|
|
|
|
if (this.$root.certInfoList[this.monitor.id]) {
|
|
|
|
return this.$root.certInfoList[this.monitor.id]
|
|
|
|
}
|
2021-07-27 17:47:13 +00:00
|
|
|
|
|
|
|
return null
|
2021-07-21 04:09:09 +00:00
|
|
|
},
|
|
|
|
|
2021-07-26 14:53:07 +00:00
|
|
|
showCertInfoBox() {
|
|
|
|
return this.certInfo != null && this.toggleCertInfoBox;
|
|
|
|
},
|
|
|
|
|
2021-07-18 01:04:40 +00:00
|
|
|
displayedRecords() {
|
|
|
|
const startIndex = this.perPage * (this.page - 1);
|
|
|
|
const endIndex = startIndex + this.perPage;
|
|
|
|
return this.heartBeatList.slice(startIndex, endIndex);
|
|
|
|
},
|
2021-07-27 17:47:13 +00:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
|
2021-06-25 13:55:49 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2021-06-30 13:04:58 +00:00
|
|
|
testNotification() {
|
|
|
|
this.$root.getSocket().emit("testNotification", this.monitor.id)
|
|
|
|
toast.success("Test notification is requested.")
|
|
|
|
},
|
|
|
|
|
2021-06-25 13:55:49 +00:00
|
|
|
pauseDialog() {
|
|
|
|
this.$refs.confirmPause.show();
|
|
|
|
},
|
2021-06-30 13:04:58 +00:00
|
|
|
|
2021-06-25 13:55:49 +00:00
|
|
|
resumeMonitor() {
|
|
|
|
this.$root.getSocket().emit("resumeMonitor", this.monitor.id, (res) => {
|
|
|
|
this.$root.toastRes(res)
|
|
|
|
})
|
|
|
|
},
|
2021-06-30 13:04:58 +00:00
|
|
|
|
2021-06-25 13:55:49 +00:00
|
|
|
pauseMonitor() {
|
|
|
|
this.$root.getSocket().emit("pauseMonitor", this.monitor.id, (res) => {
|
|
|
|
this.$root.toastRes(res)
|
|
|
|
})
|
|
|
|
},
|
2021-06-30 13:04:58 +00:00
|
|
|
|
2021-06-25 13:55:49 +00:00
|
|
|
deleteDialog() {
|
|
|
|
this.$refs.confirmDelete.show();
|
|
|
|
},
|
2021-06-30 13:04:58 +00:00
|
|
|
|
2021-06-25 13:55:49 +00:00
|
|
|
deleteMonitor() {
|
|
|
|
this.$root.deleteMonitor(this.monitor.id, (res) => {
|
|
|
|
if (res.ok) {
|
|
|
|
toast.success(res.msg);
|
|
|
|
this.$router.push("/dashboard")
|
|
|
|
} else {
|
|
|
|
toast.error(res.msg);
|
|
|
|
}
|
|
|
|
})
|
2021-07-27 17:47:13 +00:00
|
|
|
},
|
2021-06-30 13:04:58 +00:00
|
|
|
|
2021-07-27 17:47:13 +00:00
|
|
|
},
|
2021-06-25 13:55:49 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import "../assets/vars.scss";
|
|
|
|
|
2021-08-10 16:29:47 +00:00
|
|
|
@media (max-width: 550px) {
|
|
|
|
.functions {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
button, a {
|
|
|
|
margin-left: 10px !important;
|
|
|
|
margin-right: 10px !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 400px) {
|
|
|
|
.btn {
|
|
|
|
display: inline-flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
padding-top: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
a.btn {
|
|
|
|
padding-left: 25px;
|
|
|
|
padding-right: 25px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-27 08:10:55 +00:00
|
|
|
.url {
|
2021-06-25 13:55:49 +00:00
|
|
|
color: $primary;
|
|
|
|
margin-bottom: 20px;
|
2021-06-27 08:10:55 +00:00
|
|
|
font-weight: bold;
|
|
|
|
|
|
|
|
a {
|
|
|
|
color: $primary;
|
|
|
|
}
|
2021-06-25 13:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.functions {
|
|
|
|
button, a {
|
|
|
|
margin-right: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.shadow-box {
|
|
|
|
padding: 20px;
|
|
|
|
margin-top: 25px;
|
|
|
|
}
|
2021-06-27 08:10:55 +00:00
|
|
|
|
|
|
|
.word {
|
|
|
|
color: #AAA;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
2021-06-30 13:04:58 +00:00
|
|
|
|
|
|
|
table {
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
tr {
|
|
|
|
transition: all ease-in-out 0.2ms;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.stats p {
|
|
|
|
font-size: 13px;
|
|
|
|
color: #AAA;
|
|
|
|
}
|
2021-07-26 14:53:07 +00:00
|
|
|
|
|
|
|
.stats {
|
|
|
|
padding: 10px;
|
|
|
|
|
|
|
|
.col {
|
|
|
|
margin: 20px 0;
|
|
|
|
}
|
|
|
|
}
|
2021-08-08 05:47:29 +00:00
|
|
|
|
|
|
|
.keyword {
|
|
|
|
color: black;
|
|
|
|
}
|
|
|
|
|
|
|
|
.dark {
|
|
|
|
.keyword {
|
|
|
|
color: $dark-font-color;
|
|
|
|
}
|
|
|
|
}
|
2021-06-25 13:55:49 +00:00
|
|
|
</style>
|