Standardize Default Sort Order

This commit is contained in:
Marshu 2025-04-20 22:02:47 +08:00
parent 7e9dc81999
commit 934bad04c6

View file

@ -202,10 +202,6 @@ export default {
return (this.$root.publicGroupList.length >= 2); return (this.$root.publicGroupList.length >= 2);
} }
}, },
created() {
// Initialize sort settings
this.initializeSortSettings();
},
watch: { watch: {
// Watch for changes in heartbeat list, reapply sorting // Watch for changes in heartbeat list, reapply sorting
"$root.heartbeatList": { "$root.heartbeatList": {
@ -235,6 +231,10 @@ export default {
deep: true, deep: true,
}, },
}, },
created() {
// Initialize sort settings
this.initializeSortSettings();
},
mounted() { mounted() {
// Load sort settings from URL // Load sort settings from URL
this.loadSortSettingsFromURL(); this.loadSortSettingsFromURL();
@ -267,7 +267,7 @@ export default {
group.sortKey = "status"; group.sortKey = "status";
} }
if (group.sortDirection === undefined) { if (group.sortDirection === undefined) {
group.sortDirection = "desc"; group.sortDirection = "asc";
} }
} }
// Apply initial sorting // Apply initial sorting
@ -288,7 +288,7 @@ export default {
group.sortDirection = savedSettings.direction; group.sortDirection = savedSettings.direction;
} else { } else {
group.sortKey = "status"; group.sortKey = "status";
group.sortDirection = "desc"; group.sortDirection = "asc";
} }
this.applySort(group); this.applySort(group);
@ -349,7 +349,7 @@ export default {
group.sortDirection = group.sortDirection === "asc" ? "desc" : "asc"; group.sortDirection = group.sortDirection === "asc" ? "desc" : "asc";
} else { } else {
group.sortKey = key; group.sortKey = key;
group.sortDirection = (key === "status") ? "desc" : "asc"; group.sortDirection = "asc";
} }
try { try {
const groupId = this.getGroupIdentifier(group); const groupId = this.getGroupIdentifier(group);