From a173700cd43d804927a4cdce460d159847d46357 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Sun, 18 Jul 2021 03:04:40 +0200 Subject: [PATCH] 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() {