mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-22 14:05:18 -05:00
Add pagination
This commit is contained in:
parent
78f5d2cd8b
commit
a173700cd4
@ -31,6 +31,7 @@
|
|||||||
"socket.io-client": "^4.1.2",
|
"socket.io-client": "^4.1.2",
|
||||||
"sqlite3": "^5.0.0",
|
"sqlite3": "^5.0.0",
|
||||||
"tcp-ping": "^0.1.1",
|
"tcp-ping": "^0.1.1",
|
||||||
|
"v-pagination-3": "^0.1.6",
|
||||||
"vue": "^3.0.5",
|
"vue": "^3.0.5",
|
||||||
"vue-confirm-dialog": "^1.0.2",
|
"vue-confirm-dialog": "^1.0.2",
|
||||||
"vue-router": "^4.0.10",
|
"vue-router": "^4.0.10",
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="beat in importantHeartBeatList">
|
<tr v-for="(beat, index) in displayedRecords" :key="index">
|
||||||
<td>{{ beat.name }}</td>
|
<td>{{ beat.name }}</td>
|
||||||
<td><Status :status="beat.status" /></td>
|
<td><Status :status="beat.status" /></td>
|
||||||
<td><Datetime :value="beat.time" /></td>
|
<td><Datetime :value="beat.time" /></td>
|
||||||
@ -59,6 +59,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center kuma_pagination">
|
||||||
|
<pagination
|
||||||
|
v-model="page"
|
||||||
|
:records=importantHeartBeatList.length
|
||||||
|
:per-page="perPage" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -68,8 +75,21 @@
|
|||||||
<script>
|
<script>
|
||||||
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 Pagination from "v-pagination-3";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {Datetime, Status},
|
components: {
|
||||||
|
Datetime,
|
||||||
|
Status,
|
||||||
|
Pagination,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
page: 1,
|
||||||
|
perPage: 25,
|
||||||
|
heartBeatList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
stats() {
|
stats() {
|
||||||
let result = {
|
let result = {
|
||||||
@ -127,8 +147,16 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.heartBeatList = result;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
displayedRecords() {
|
||||||
|
const startIndex = this.perPage * (this.page - 1);
|
||||||
|
const endIndex = startIndex + this.perPage;
|
||||||
|
return this.heartBeatList.slice(startIndex, endIndex);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="beat in importantHeartBeatList">
|
<tr v-for="(beat, index) in displayedRecords" :key="index">
|
||||||
<td><Status :status="beat.status" /></td>
|
<td><Status :status="beat.status" /></td>
|
||||||
<td><Datetime :value="beat.time" /></td>
|
<td><Datetime :value="beat.time" /></td>
|
||||||
<td>{{ beat.msg }}</td>
|
<td>{{ beat.msg }}</td>
|
||||||
@ -75,6 +75,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center kuma_pagination">
|
||||||
|
<pagination
|
||||||
|
v-model="page"
|
||||||
|
:records=importantHeartBeatList.length
|
||||||
|
:per-page="perPage" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Confirm ref="confirmPause" @yes="pauseMonitor">
|
<Confirm ref="confirmPause" @yes="pauseMonitor">
|
||||||
@ -95,6 +102,7 @@ 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";
|
||||||
import Uptime from "../components/Uptime.vue";
|
import Uptime from "../components/Uptime.vue";
|
||||||
|
import Pagination from "v-pagination-3";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -104,13 +112,16 @@ export default {
|
|||||||
HeartbeatBar,
|
HeartbeatBar,
|
||||||
Confirm,
|
Confirm,
|
||||||
Status,
|
Status,
|
||||||
|
Pagination,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
page: 1,
|
||||||
|
perPage: 25,
|
||||||
|
heartBeatList: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -154,6 +165,7 @@ export default {
|
|||||||
|
|
||||||
importantHeartBeatList() {
|
importantHeartBeatList() {
|
||||||
if (this.$root.importantHeartbeatList[this.monitor.id]) {
|
if (this.$root.importantHeartbeatList[this.monitor.id]) {
|
||||||
|
this.heartBeatList = this.$root.importantHeartbeatList[this.monitor.id];
|
||||||
return this.$root.importantHeartbeatList[this.monitor.id]
|
return this.$root.importantHeartbeatList[this.monitor.id]
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
@ -166,8 +178,13 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
return { }
|
return { }
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
displayedRecords() {
|
||||||
|
const startIndex = this.perPage * (this.page - 1);
|
||||||
|
const endIndex = startIndex + this.perPage;
|
||||||
|
return this.heartBeatList.slice(startIndex, endIndex);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
testNotification() {
|
testNotification() {
|
||||||
|
Loading…
Reference in New Issue
Block a user