implement tcping

This commit is contained in:
LouisLam
2021-07-01 14:03:06 +08:00
parent 84c21b71c0
commit 9c653c3d05
8 changed files with 58 additions and 5 deletions

View File

@@ -48,7 +48,7 @@ export default {
let frames = 12;
let step = Math.floor(diff / frames);
if ((diff > 0 && step < 1) || (diff < 0 && step > 1) || diff === 0) {
if (! this.isNum || (diff > 0 && step < 1) || (diff < 0 && step > 1) || diff === 0) {
// Lazy to NOT this condition, hahaha.
} else {
for (let i = 1; i < frames; i++) {

View File

@@ -1,6 +1,9 @@
<template>
<h1> {{ monitor.name }}</h1>
<p class="url"><a :href="monitor.url" target="_blank" v-if="monitor.type === 'http'">{{ monitor.url }}</a></p>
<p class="url">
<a :href="monitor.url" target="_blank" v-if="monitor.type === 'http'">{{ monitor.url }}</a>
<span v-if="monitor.type === 'port'">{{ monitor.hostname }}:{{ monitor.port }}</span>
</p>
<div class="functions">
<button class="btn btn-light" @click="pauseDialog" v-if="monitor.active">Pause</button>

View File

@@ -22,11 +22,24 @@
<input type="text" class="form-control" id="name" v-model="monitor.name" required>
</div>
<div class="mb-3">
<div class="mb-3" v-if="monitor.type === 'http' ">
<label for="url" class="form-label">URL</label>
<input type="url" class="form-control" id="url" v-model="monitor.url" pattern="https?://.+" required>
</div>
<template v-if="monitor.type === 'port' ">
<div class="mb-3">
<label for="hostname" class="form-label">Hostname</label>
<input type="text" class="form-control" id="hostname" v-model="monitor.hostname" required>
</div>
<div class="mb-3">
<label for="port" class="form-label">Port</label>
<input type="number" class="form-control" id="port" v-model="monitor.port" required min="0" max="65535">
</div>
</template>
<div class="mb-3">
<label for="interval" class="form-label">Heartbeat Interval (Every {{ monitor.interval }} seconds)</label>
<input type="number" class="form-control" id="interval" v-model="monitor.interval" required min="20">