mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-05-22 06:52:33 +02:00
Fix the warning and error
This commit is contained in:
parent
c45660e49c
commit
5ace5c0024
1 changed files with 53 additions and 33 deletions
|
@ -387,21 +387,32 @@ export default {
|
|||
if (!a || !b) return 0;
|
||||
|
||||
let comparison = 0;
|
||||
let valueA, valueB;
|
||||
let valueA;
|
||||
let valueB;
|
||||
|
||||
if (sortKey === "status") {
|
||||
// Sort by status
|
||||
const getStatusPriority = (monitor) => {
|
||||
if (!monitor || !monitor.id) return 4;
|
||||
if (!monitor || !monitor.id) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
const hbList = this.$root.heartbeatList || {};
|
||||
const hbArr = hbList[monitor.id];
|
||||
if (hbArr && hbArr.length > 0) {
|
||||
const lastStatus = hbArr.at(-1).status;
|
||||
if (lastStatus === 0) return 0; // Down
|
||||
if (lastStatus === 1) return 1; // Up
|
||||
if (lastStatus === 2) return 2; // Pending
|
||||
if (lastStatus === 3) return 3; // Maintenance
|
||||
if (lastStatus === 0) {
|
||||
return 0;
|
||||
} // Down
|
||||
if (lastStatus === 1) {
|
||||
return 1;
|
||||
} // Up
|
||||
if (lastStatus === 2) {
|
||||
return 2;
|
||||
} // Pending
|
||||
if (lastStatus === 3) {
|
||||
return 3;
|
||||
} // Maintenance
|
||||
}
|
||||
return 4; // Unknown/No data
|
||||
};
|
||||
|
@ -471,7 +482,9 @@ export default {
|
|||
// We must check if there are any elements in monitorList to
|
||||
// prevent undefined errors if it hasn't been loaded yet
|
||||
if (this.$parent.editMode && ignoreSendUrl && Object.keys(this.$root.monitorList).length) {
|
||||
return this.$root.monitorList[monitor.element.id].type === "http" || this.$root.monitorList[monitor.element.id].type === "keyword" || this.$root.monitorList[monitor.element.id].type === "json-query";
|
||||
return this.$root.monitorList[monitor.element.id].type === "http" ||
|
||||
this.$root.monitorList[monitor.element.id].type === "keyword" ||
|
||||
this.$root.monitorList[monitor.element.id].type === "json-query";
|
||||
}
|
||||
return monitor.element.sendUrl && monitor.element.url && monitor.element.url !== "https://";
|
||||
},
|
||||
|
@ -516,13 +529,17 @@ export default {
|
|||
* @returns {void}
|
||||
*/
|
||||
loadSortSettingsFromURL() {
|
||||
if (!this.$root.publicGroupList) return;
|
||||
if (!this.$root.publicGroupList) {
|
||||
return;
|
||||
}
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
|
||||
// Iterate through all groups, look for sort parameters in URL
|
||||
this.$root.publicGroupList.forEach(group => {
|
||||
if (!group) return;
|
||||
if (!group) {
|
||||
return;
|
||||
}
|
||||
|
||||
const groupId = this.getGroupIdentifier(group);
|
||||
const sortParam = urlParams.get(`sort_${groupId}`);
|
||||
|
@ -544,7 +561,9 @@ export default {
|
|||
* @returns {void}
|
||||
*/
|
||||
updateURLSortParams() {
|
||||
if (!this.$root.publicGroupList) return;
|
||||
if (!this.$root.publicGroupList) {
|
||||
return;
|
||||
}
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
|
||||
|
@ -562,7 +581,9 @@ export default {
|
|||
|
||||
// Add current sort parameters
|
||||
this.$root.publicGroupList.forEach(group => {
|
||||
if (!group || !group.sortKey) return;
|
||||
if (!group || !group.sortKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
const groupId = this.getGroupIdentifier(group);
|
||||
urlParams.set(`sort_${groupId}`, `${group.sortKey}_${group.sortDirection}`);
|
||||
|
@ -769,5 +790,4 @@ export default {
|
|||
.bg-maintenance {
|
||||
background-color: $maintenance;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Add table
Reference in a new issue