mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Compare commits
28 commits
2ca36c3c6d
...
198ef41bd2
Author | SHA1 | Date | |
---|---|---|---|
|
198ef41bd2 | ||
|
6899603eb7 | ||
|
ea97159b75 | ||
|
4c588336d5 | ||
|
6e93ed1392 | ||
|
6d25d6d772 | ||
|
f65e5e5848 | ||
|
a4ab9caa43 | ||
|
5ce3f0615f | ||
|
d7f9a9b471 | ||
|
e90965a212 | ||
|
f010d7f874 | ||
|
9684d34ad0 | ||
|
dcb675a343 | ||
|
e868ebb68e | ||
|
adb5cbe425 | ||
|
949198d09e | ||
|
87f3c2ef94 | ||
|
498786eb39 | ||
|
95a9e0a096 | ||
|
0d2b380f44 | ||
|
56b3cf412b | ||
|
72849de1b4 | ||
|
e2ce0e38a6 | ||
|
da831893de | ||
|
45b6c8a91d | ||
|
1dceb96c7c | ||
|
401710c3bd |
8 changed files with 152 additions and 9 deletions
|
@ -42,6 +42,9 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.modal = new Modal(this.$refs.modal);
|
this.modal = new Modal(this.$refs.modal);
|
||||||
},
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
this.cleanupModal();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Show the confirm dialog
|
* Show the confirm dialog
|
||||||
|
@ -58,6 +61,19 @@ export default {
|
||||||
this.$emit("added", this.groupName);
|
this.$emit("added", this.groupName);
|
||||||
this.modal.hide();
|
this.modal.hide();
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Clean up modal and restore scroll behavior
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
cleanupModal() {
|
||||||
|
if (this.modal) {
|
||||||
|
try {
|
||||||
|
this.modal.hide();
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Modal hide failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
54
src/components/NextPingTimer.vue
Normal file
54
src/components/NextPingTimer.vue
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<template>
|
||||||
|
<span class="word"> ({{ $t("nextCheckIn") }}: {{ formattedTime }})</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
/** Time remaining in seconds */
|
||||||
|
timeRemaining: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
/**
|
||||||
|
* Formatted time remaining
|
||||||
|
* @returns {string} Formatted time
|
||||||
|
*/
|
||||||
|
formattedTime() {
|
||||||
|
const days = Math.floor(this.timeRemaining / 86400);
|
||||||
|
const hours = Math.floor((this.timeRemaining % 86400) / 3600);
|
||||||
|
const minutes = Math.floor((this.timeRemaining % 3600) / 60);
|
||||||
|
const seconds = this.timeRemaining % 60;
|
||||||
|
|
||||||
|
let formattedTime = "";
|
||||||
|
if (seconds >= 0) {
|
||||||
|
formattedTime = seconds > 1 ? `${seconds}secs` : `${seconds}sec`;
|
||||||
|
}
|
||||||
|
if (minutes > 0) {
|
||||||
|
formattedTime = minutes > 1 ? `~ ${minutes}mins` : `~ ${minutes}min`;
|
||||||
|
}
|
||||||
|
if (hours > 0) {
|
||||||
|
formattedTime = hours > 1 ? `~ ${hours}hrs` : `~ ${hours}hr`;
|
||||||
|
}
|
||||||
|
if (days > 0) {
|
||||||
|
formattedTime = days > 1 ? `~ ${days}days` : `~ ${days}day`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return formattedTime.trim();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "../assets/vars.scss";
|
||||||
|
|
||||||
|
.word {
|
||||||
|
color: $secondary-text;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
|
@ -232,6 +232,9 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.modal = new Modal(this.$refs.modal);
|
this.modal = new Modal(this.$refs.modal);
|
||||||
},
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
this.cleanupModal();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -336,6 +339,20 @@ export default {
|
||||||
});
|
});
|
||||||
} while (this.$root.notificationList.find(it => it.name === name));
|
} while (this.$root.notificationList.find(it => it.name === name));
|
||||||
return name;
|
return name;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up modal and restore scroll behavior
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
cleanupModal() {
|
||||||
|
if (this.modal) {
|
||||||
|
try {
|
||||||
|
this.modal.hide();
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Modal hide failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -125,11 +125,12 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.modal = new Modal(this.$refs.modal);
|
this.modal = new Modal(this.$refs.modal);
|
||||||
},
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
this.cleanupModal();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Show dialog to confirm deletion
|
* Show dialog to confirm deletion
|
||||||
|
@ -209,6 +210,20 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up modal and restore scroll behavior
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
cleanupModal() {
|
||||||
|
if (this.modal) {
|
||||||
|
try {
|
||||||
|
this.modal.hide();
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Modal hide failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -248,6 +248,9 @@ export default {
|
||||||
this.modal = new Modal(this.$refs.modal);
|
this.modal = new Modal(this.$refs.modal);
|
||||||
this.getExistingTags();
|
this.getExistingTags();
|
||||||
},
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
this.cleanupModal();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Show the add tag dialog
|
* Show the add tag dialog
|
||||||
|
@ -459,6 +462,19 @@ export default {
|
||||||
this.newTags = [];
|
this.newTags = [];
|
||||||
this.deleteTags = [];
|
this.deleteTags = [];
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Clean up modal and restore scroll behavior
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
cleanupModal() {
|
||||||
|
if (this.modal) {
|
||||||
|
try {
|
||||||
|
this.modal.hide();
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Modal hide failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,20 +5,20 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="sendgrid-from-email" class="form-label">{{ $t("From Email") }}</label>
|
<label for="sendgrid-from-email" class="form-label">{{ $t("From Email") }}</label>
|
||||||
<input id="sendgrid-from-email" v-model="$parent.notification.sendgridFromEmail" type="email" class="form-control" required>
|
<input id="sendgrid-from-email" v-model="$parent.notification.sendgridFromEmail" type="text" class="form-control" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="sendgrid-to-email" class="form-label">{{ $t("To Email") }}</label>
|
<label for="sendgrid-to-email" class="form-label">{{ $t("To Email") }}</label>
|
||||||
<input id="sendgrid-to-email" v-model="$parent.notification.sendgridToEmail" type="email" class="form-control" required>
|
<input id="sendgrid-to-email" v-model="$parent.notification.sendgridToEmail" type="text" class="form-control" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="sendgrid-cc-email" class="form-label">{{ $t("smtpCC") }}</label>
|
<label for="sendgrid-cc-email" class="form-label">{{ $t("smtpCC") }}</label>
|
||||||
<input id="sendgrid-cc-email" v-model="$parent.notification.sendgridCcEmail" type="email" class="form-control">
|
<input id="sendgrid-cc-email" v-model="$parent.notification.sendgridCcEmail" type="text" class="form-control">
|
||||||
<div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div>
|
<div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="sendgrid-bcc-email" class="form-label">{{ $t("smtpBCC") }}</label>
|
<label for="sendgrid-bcc-email" class="form-label">{{ $t("smtpBCC") }}</label>
|
||||||
<input id="sendgrid-bcc-email" v-model="$parent.notification.sendgridBccEmail" type="email" class="form-control">
|
<input id="sendgrid-bcc-email" v-model="$parent.notification.sendgridBccEmail" type="text" class="form-control">
|
||||||
<small class="form-text text-muted">{{ $t("Separate multiple email addresses with commas") }}</small>
|
<small class="form-text text-muted">{{ $t("Separate multiple email addresses with commas") }}</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|
|
@ -1050,6 +1050,7 @@
|
||||||
"RabbitMQ Username": "RabbitMQ Username",
|
"RabbitMQ Username": "RabbitMQ Username",
|
||||||
"RabbitMQ Password": "RabbitMQ Password",
|
"RabbitMQ Password": "RabbitMQ Password",
|
||||||
"rabbitmqHelpText": "To use the monitor, you will need to enable the Management Plugin in your RabbitMQ setup. For more information, please consult the {rabitmq_documentation}.",
|
"rabbitmqHelpText": "To use the monitor, you will need to enable the Management Plugin in your RabbitMQ setup. For more information, please consult the {rabitmq_documentation}.",
|
||||||
|
"nextCheckIn": "Next in ",
|
||||||
"SendGrid API Key": "SendGrid API Key",
|
"SendGrid API Key": "SendGrid API Key",
|
||||||
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas"
|
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas"
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,10 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<HeartbeatBar :monitor-id="monitor.id" />
|
<HeartbeatBar :monitor-id="monitor.id" />
|
||||||
<span class="word">{{ $t("checkEverySecond", [ monitor.interval ]) }}</span>
|
<div>
|
||||||
|
<span class="word">{{ $t("checkEverySecond", [ monitor.interval ]) }}</span>
|
||||||
|
<span class="word"><NextPingTimer :timeRemaining="timeRemaining" /></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 text-center">
|
<div class="col-md-4 text-center">
|
||||||
<span class="badge rounded-pill" :class=" 'bg-' + status.color " style="font-size: 30px;" data-testid="monitor-status">{{ status.text }}</span>
|
<span class="badge rounded-pill" :class=" 'bg-' + status.color " style="font-size: 30px;" data-testid="monitor-status">{{ status.text }}</span>
|
||||||
|
@ -275,6 +278,7 @@ import { useToast } from "vue-toastification";
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
import Confirm from "../components/Confirm.vue";
|
import Confirm from "../components/Confirm.vue";
|
||||||
import HeartbeatBar from "../components/HeartbeatBar.vue";
|
import HeartbeatBar from "../components/HeartbeatBar.vue";
|
||||||
|
import NextPingTimer from "../components/NextPingTimer.vue";
|
||||||
import Status from "../components/Status.vue";
|
import Status from "../components/Status.vue";
|
||||||
import Datetime from "../components/Datetime.vue";
|
import Datetime from "../components/Datetime.vue";
|
||||||
import CountUp from "../components/CountUp.vue";
|
import CountUp from "../components/CountUp.vue";
|
||||||
|
@ -293,6 +297,7 @@ import "prismjs/components/prism-css";
|
||||||
import { PrismEditor } from "vue-prism-editor";
|
import { PrismEditor } from "vue-prism-editor";
|
||||||
import "vue-prism-editor/dist/prismeditor.min.css";
|
import "vue-prism-editor/dist/prismeditor.min.css";
|
||||||
import ScreenshotDialog from "../components/ScreenshotDialog.vue";
|
import ScreenshotDialog from "../components/ScreenshotDialog.vue";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -300,6 +305,7 @@ export default {
|
||||||
CountUp,
|
CountUp,
|
||||||
Datetime,
|
Datetime,
|
||||||
HeartbeatBar,
|
HeartbeatBar,
|
||||||
|
NextPingTimer,
|
||||||
Confirm,
|
Confirm,
|
||||||
Status,
|
Status,
|
||||||
Pagination,
|
Pagination,
|
||||||
|
@ -313,6 +319,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
page: 1,
|
page: 1,
|
||||||
perPage: 25,
|
perPage: 25,
|
||||||
|
timeRemaining: 0,
|
||||||
heartBeatList: [],
|
heartBeatList: [],
|
||||||
toggleCertInfoBox: false,
|
toggleCertInfoBox: false,
|
||||||
showPingChartBox: true,
|
showPingChartBox: true,
|
||||||
|
@ -340,6 +347,8 @@ export default {
|
||||||
// Also trigger screenshot refresh here
|
// Also trigger screenshot refresh here
|
||||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
this.cacheTime = Date.now();
|
this.cacheTime = Date.now();
|
||||||
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
|
this.timeRemaining = this.monitor.interval;
|
||||||
|
|
||||||
if (this.monitor.id in this.$root.lastHeartbeatList && this.$root.lastHeartbeatList[this.monitor.id]) {
|
if (this.monitor.id in this.$root.lastHeartbeatList && this.$root.lastHeartbeatList[this.monitor.id]) {
|
||||||
return this.$root.lastHeartbeatList[this.monitor.id];
|
return this.$root.lastHeartbeatList[this.monitor.id];
|
||||||
|
@ -399,7 +408,7 @@ export default {
|
||||||
|
|
||||||
screenshotURL() {
|
screenshotURL() {
|
||||||
return getResBaseURL() + this.monitor.screenshot + "?time=" + this.cacheTime;
|
return getResBaseURL() + this.monitor.screenshot + "?time=" + this.cacheTime;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -419,7 +428,14 @@ export default {
|
||||||
this.loadPushExample();
|
this.loadPushExample();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
if (this.lastHeartBeat.end_time) {
|
||||||
|
const lastpingtime = dayjs().utc().diff(dayjs.utc(this.lastHeartBeat.end_time), "seconds");
|
||||||
|
this.timeRemaining = this.monitor.interval - lastpingtime;
|
||||||
|
} else {
|
||||||
|
this.timeRemaining = this.monitor.interval;
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getImportantHeartbeatListLength();
|
this.getImportantHeartbeatListLength();
|
||||||
|
|
||||||
|
@ -431,10 +447,17 @@ export default {
|
||||||
}
|
}
|
||||||
this.loadPushExample();
|
this.loadPushExample();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.interval = setInterval(() => {
|
||||||
|
if (this.timeRemaining > 1) {
|
||||||
|
this.timeRemaining--;
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
this.$root.emitter.off("newImportantHeartbeat", this.onNewImportantHeartbeat);
|
this.$root.emitter.off("newImportantHeartbeat", this.onNewImportantHeartbeat);
|
||||||
|
clearInterval(this.interval);
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -464,6 +487,7 @@ export default {
|
||||||
this.$root.getSocket().emit("resumeMonitor", this.monitor.id, (res) => {
|
this.$root.getSocket().emit("resumeMonitor", this.monitor.id, (res) => {
|
||||||
this.$root.toastRes(res);
|
this.$root.toastRes(res);
|
||||||
});
|
});
|
||||||
|
this.timeRemaining = this.monitor.interval;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue