mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 00:26:47 +08:00
improve page load performance of large amount urls (#5025)
Co-authored-by: vishal sabhaya <vishals@vebuin.com> Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
@@ -141,19 +141,23 @@ export default {
|
||||
});
|
||||
|
||||
socket.on("monitorList", (data) => {
|
||||
// Add Helper function
|
||||
Object.entries(data).forEach(([ monitorID, monitor ]) => {
|
||||
monitor.getUrl = () => {
|
||||
try {
|
||||
return new URL(monitor.url);
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
});
|
||||
this.assignMonitorUrlParser(data);
|
||||
this.monitorList = data;
|
||||
});
|
||||
|
||||
socket.on("updateMonitorIntoList", (data) => {
|
||||
this.assignMonitorUrlParser(data);
|
||||
Object.entries(data).forEach(([ monitorID, updatedMonitor ]) => {
|
||||
this.monitorList[monitorID] = updatedMonitor;
|
||||
});
|
||||
});
|
||||
|
||||
socket.on("deleteMonitorFromList", (monitorID) => {
|
||||
if (this.monitorList[monitorID]) {
|
||||
delete this.monitorList[monitorID];
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("monitorTypeList", (data) => {
|
||||
this.monitorTypeList = data;
|
||||
});
|
||||
@@ -289,6 +293,23 @@ export default {
|
||||
location.reload();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* parse all urls from list.
|
||||
* @param {object} data Monitor data to modify
|
||||
* @returns {object} list
|
||||
*/
|
||||
assignMonitorUrlParser(data) {
|
||||
Object.entries(data).forEach(([ monitorID, monitor ]) => {
|
||||
monitor.getUrl = () => {
|
||||
try {
|
||||
return new URL(monitor.url);
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
});
|
||||
return data;
|
||||
},
|
||||
|
||||
/**
|
||||
* The storage currently in use
|
||||
|
@@ -1813,7 +1813,6 @@ message HealthCheckResponse {
|
||||
await this.startParentGroupMonitor();
|
||||
}
|
||||
this.processing = false;
|
||||
this.$root.getMonitorList();
|
||||
this.$router.push("/dashboard/" + res.monitorID);
|
||||
} else {
|
||||
this.processing = false;
|
||||
|
@@ -83,6 +83,7 @@ exports.CONSOLE_STYLE_BgMagenta = "\x1b[45m";
|
||||
exports.CONSOLE_STYLE_BgCyan = "\x1b[46m";
|
||||
exports.CONSOLE_STYLE_BgWhite = "\x1b[47m";
|
||||
exports.CONSOLE_STYLE_BgGray = "\x1b[100m";
|
||||
|
||||
const consoleModuleColors = [
|
||||
exports.CONSOLE_STYLE_FgCyan,
|
||||
exports.CONSOLE_STYLE_FgGreen,
|
||||
|
Reference in New Issue
Block a user