mirror of
				https://github.com/louislam/uptime-kuma.git
				synced 2025-11-04 13:46:13 +08:00 
			
		
		
		
	Feat: Full server-side pagination for important events (#3515)
* Feat: Serverside pagination for importantBeats * Chore: Remove unused state * Apply suggestions from code review Co-authored-by: Frank Elsinga <frank@elsinga.de> * Fix: Add watch for monitor * Fix: Fix compatibility with dynamic page length * Chore: Fix lint * Merge conflict --------- Co-authored-by: Frank Elsinga <frank@elsinga.de> Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
		@@ -3,6 +3,8 @@ import { useToast } from "vue-toastification";
 | 
			
		||||
import jwtDecode from "jwt-decode";
 | 
			
		||||
import Favico from "favico.js";
 | 
			
		||||
import dayjs from "dayjs";
 | 
			
		||||
import mitt from "mitt";
 | 
			
		||||
 | 
			
		||||
import { DOWN, MAINTENANCE, PENDING, UP } from "../util.ts";
 | 
			
		||||
import { getDevContainerServerHostname, isDevContainer, getToastSuccessTimeout, getToastErrorTimeout } from "../util-frontend.js";
 | 
			
		||||
const toast = useToast();
 | 
			
		||||
@@ -39,7 +41,6 @@ export default {
 | 
			
		||||
            maintenanceList: {},
 | 
			
		||||
            apiKeyList: {},
 | 
			
		||||
            heartbeatList: { },
 | 
			
		||||
            importantHeartbeatList: { },
 | 
			
		||||
            avgPingList: { },
 | 
			
		||||
            uptimeList: { },
 | 
			
		||||
            tlsInfoList: {},
 | 
			
		||||
@@ -59,6 +60,7 @@ export default {
 | 
			
		||||
                currentPassword: "",
 | 
			
		||||
            },
 | 
			
		||||
            faviconUpdateDebounce: null,
 | 
			
		||||
            emitter: mitt(),
 | 
			
		||||
        };
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
@@ -201,11 +203,7 @@ export default {
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (! (data.monitorID in this.importantHeartbeatList)) {
 | 
			
		||||
                        this.importantHeartbeatList[data.monitorID] = [];
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    this.importantHeartbeatList[data.monitorID].unshift(data);
 | 
			
		||||
                    this.emitter.emit("newImportantHeartbeat", data);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
@@ -229,14 +227,6 @@ export default {
 | 
			
		||||
                this.tlsInfoList[monitorID] = JSON.parse(data);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            socket.on("importantHeartbeatList", (monitorID, data, overwrite) => {
 | 
			
		||||
                if (! (monitorID in this.importantHeartbeatList) || overwrite) {
 | 
			
		||||
                    this.importantHeartbeatList[monitorID] = data;
 | 
			
		||||
                } else {
 | 
			
		||||
                    this.importantHeartbeatList[monitorID] = data.concat(this.importantHeartbeatList[monitorID]);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            socket.on("connect_error", (err) => {
 | 
			
		||||
                console.error(`Failed to connect to the backend. Socket.io connect_error: ${err.message}`);
 | 
			
		||||
                this.connectionErrorMsg = `${this.$t("Cannot connect to the socket server.")} [${err}] ${this.$t("Reconnecting...")}`;
 | 
			
		||||
@@ -630,7 +620,6 @@ export default {
 | 
			
		||||
        clearData() {
 | 
			
		||||
            console.log("reset heartbeat list");
 | 
			
		||||
            this.heartbeatList = {};
 | 
			
		||||
            this.importantHeartbeatList = {};
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user