From a173700cd43d804927a4cdce460d159847d46357 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Sun, 18 Jul 2021 03:04:40 +0200 Subject: [PATCH 01/17] Add pagination --- package.json | 1 + src/pages/DashboardHome.vue | 34 +++++++++++++++++++++++++++++++--- src/pages/Details.vue | 23 ++++++++++++++++++++--- 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 8c03f9d3b..4a0cd42cc 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "socket.io-client": "^4.1.2", "sqlite3": "^5.0.0", "tcp-ping": "^0.1.1", + "v-pagination-3": "^0.1.6", "vue": "^3.0.5", "vue-confirm-dialog": "^1.0.2", "vue-router": "^4.0.10", diff --git a/src/pages/DashboardHome.vue b/src/pages/DashboardHome.vue index 820842bac..4c6c82e2b 100644 --- a/src/pages/DashboardHome.vue +++ b/src/pages/DashboardHome.vue @@ -47,7 +47,7 @@ - + {{ beat.name }} @@ -59,6 +59,13 @@ + +
+ +
@@ -68,8 +75,21 @@ diff --git a/src/pages/Details.vue b/src/pages/Details.vue index f925c2849..56b6427d7 100644 --- a/src/pages/Details.vue +++ b/src/pages/Details.vue @@ -64,7 +64,7 @@ - + {{ beat.msg }} @@ -75,6 +75,13 @@ + +
+ +
@@ -95,6 +102,7 @@ import Status from "../components/Status.vue"; import Datetime from "../components/Datetime.vue"; import CountUp from "../components/CountUp.vue"; import Uptime from "../components/Uptime.vue"; +import Pagination from "v-pagination-3"; export default { components: { @@ -104,13 +112,16 @@ export default { HeartbeatBar, Confirm, Status, + Pagination, }, mounted() { }, data() { return { - + page: 1, + perPage: 25, + heartBeatList: [], } }, computed: { @@ -154,6 +165,7 @@ export default { importantHeartBeatList() { if (this.$root.importantHeartbeatList[this.monitor.id]) { + this.heartBeatList = this.$root.importantHeartbeatList[this.monitor.id]; return this.$root.importantHeartbeatList[this.monitor.id] } else { return []; @@ -166,8 +178,13 @@ export default { } else { return { } } - } + }, + displayedRecords() { + const startIndex = this.perPage * (this.page - 1); + const endIndex = startIndex + this.perPage; + return this.heartBeatList.slice(startIndex, endIndex); + }, }, methods: { testNotification() { From d94894b7e0b57f345203918f1af3665cca2be00a Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Sun, 18 Jul 2021 03:10:15 +0200 Subject: [PATCH 02/17] Fix `require-v-for-key`, remove unused declarations and double spaces --- server/model/heartbeat.js | 2 -- server/notification.js | 15 ++++++++------- server/server.js | 4 ---- src/components/Datetime.vue | 6 +++--- src/components/NotificationDialog.vue | 10 +++++----- src/pages/Dashboard.vue | 2 +- src/pages/Details.vue | 2 +- src/pages/EditMonitor.vue | 2 +- src/pages/Settings.vue | 8 ++++---- src/util-frontend.js | 6 +++--- 10 files changed, 26 insertions(+), 31 deletions(-) diff --git a/server/model/heartbeat.js b/server/model/heartbeat.js index 74e329811..01fb71ff9 100644 --- a/server/model/heartbeat.js +++ b/server/model/heartbeat.js @@ -3,8 +3,6 @@ const utc = require('dayjs/plugin/utc') var timezone = require('dayjs/plugin/timezone') dayjs.extend(utc) dayjs.extend(timezone) -const axios = require("axios"); -const {R} = require("redbean-node"); const {BeanModel} = require("redbean-node/dist/bean-model"); diff --git a/server/notification.js b/server/notification.js index 99cc1568c..9e6c5e065 100644 --- a/server/notification.js +++ b/server/notification.js @@ -58,7 +58,7 @@ class Notification { finalData = data; } - let res = await axios.post(notification.webhookURL, finalData, config) + await axios.post(notification.webhookURL, finalData, config) return true; } catch (error) { console.log(error) @@ -102,7 +102,8 @@ class Notification { ] }] } - let res = await axios.post(notification.discordWebhookUrl, data) + + await axios.post(notification.discordWebhookUrl, data) return true; } catch(error) { console.log(error) @@ -118,18 +119,18 @@ class Notification { }; let config = {}; - let res = await axios.post(notification.signalURL, data, config) + await axios.post(notification.signalURL, data, config) return true; } catch (error) { console.log(error) return false; } - + } else if (notification.type === "slack") { try { if (heartbeatJSON == null) { let data = {'text': "Uptime Kuma Slack testing successful."} - let res = await axios.post(notification.slackwebhookURL, data) + await axios.post(notification.slackwebhookURL, data) return true; } @@ -170,7 +171,7 @@ class Notification { } ] } - let res = await axios.post(notification.slackwebhookURL, data) + await axios.post(notification.slackwebhookURL, data) return true; } catch (error) { console.log(error) @@ -231,7 +232,7 @@ class Notification { }); // send mail with defined transport object - let info = await transporter.sendMail({ + await transporter.sendMail({ from: `"Uptime Kuma" <${notification.smtpFrom}>`, to: notification.smtpTo, subject: msg, diff --git a/server/server.js b/server/server.js index 93e43cd6e..a64ff512e 100644 --- a/server/server.js +++ b/server/server.js @@ -162,10 +162,6 @@ let needSetup = false; msg: e.message }); } - - - - }); // Auth Only API diff --git a/src/components/Datetime.vue b/src/components/Datetime.vue index 47702236a..e84c877bc 100644 --- a/src/components/Datetime.vue +++ b/src/components/Datetime.vue @@ -4,9 +4,9 @@